You are not logged in.

#1 2020-08-21 17:20:31

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 661

Skript add-apt-repository fails

Hi!

The skript add-apt-repository, which is provided by the package software-properties-common, seems buggy.

It will not work on BL and KaliLinux among some debian derivates.

It is used to add third party repositories and Personal Package Archive (PPA) to your sources, from the commandline.

Adding third party repos, shuld be used very cautios. Avoid adding a PPA on productive machine...

More about Apt Sources on https://wiki.debian.org/SourcesList and

It is simple (and safer if the command will work in the future) to manualy add the repository to /etc/apt/sources.list or a new file
/etc/apt/sources.list.d/RepoName.list.

More about Apt Sources on https://wiki.debian.org/SourcesList and

$ man sources.list

(Maybee this can be moved to Annoyances and workarounds)

Last edited by rbh (2020-08-21 17:24:08)


// Regards rbh

Offline

#2 2020-08-21 19:04:20

damo
....moderator....
Registered: 2015-08-20
Posts: 6,271

Re: Skript add-apt-repository fails

rbh wrote:

...
(Maybee this can be moved to Annoyances and workarounds)

Apart from the fact that Bunsenlabs specifically emphasizes that adding PPA's is definitely NOT recommended. In fact, during the bl-welcome Introduction the user is required to type "I understand" after being warned.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2020-08-21 19:14:06

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 661

Re: Skript add-apt-repository fails

I do not know, but suspects, that the script add-apt-repository, was developed particularly to ease adding ppa's.

But, nevermind that. I think we had three writing and asking about add-apt-repository, so  for some it is an anoyance but so easy to work around (or not use...).


// Regards rbh

Offline

#4 2020-08-21 19:39:14

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,942

Re: Skript add-apt-repository fails

rbh wrote:

Hi!

The skript add-apt-repository, which is provided by the package software-properties-common, seems buggy.

It will not work on BL and KaliLinux among some debian derivates.

It is used to add third party repositories and Personal Package Archive (PPA) to your sources, from the commandline.

Adding third party repos, shuld be used very cautios. Avoid adding a PPA on productive machine...

More about Apt Sources on https://wiki.debian.org/SourcesList and

It is simple (and safer if the command will work in the future) to manualy add the repository to /etc/apt/sources.list or a new file
/etc/apt/sources.list.d/RepoName.list.

More about Apt Sources on https://wiki.debian.org/SourcesList and

$ man sources.list

(Maybee this can be moved to Annoyances and workarounds)

Is it

aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Bunsenlabs/buster

The system surrounding add-apt-repository/software-properties-common is a mess; it consists of a bunch of Python libraries gobbling information together from random files in the file system; and the fact that lsb_release is now implemented by gobbling os-release doesn't help (lsb_release -s -i delivers a wrongly cased "Bunsenlabs" string).

I'll investigate; there's definitely the VERSION_CODENAME missing from /usr/lib/os-release which is likely partly responsible for the behaviour you're seeing. If I can get it to work I'll push an update to bunsen-os-release and bunsen-python-apt-template which are responsible for hooking into this mess.

PS. Even if this issue is fixed, I can't guarantee that the software-properties-common framework will work. Not without a reason I started writing apt-sourcemgr https://github.com/BunsenLabs/apt-sourcemgr which you could try by running "pip3 install apt-sourcemgr" There definitely are bugs in there though (it's NOT released) and there are 2 commits on the master branch that haven't been released, so I think it should be tried from source. Here's the thread on it https://forums.bunsenlabs.org/viewtopic.php?id=4571 For the past 3 years it's been a dead project, alas. The thing that should be done today is probably to use ansible instead.


Per aspera ad astra.

Offline

#5 2020-08-21 20:04:28

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,942

Re: Skript add-apt-repository fails

@rbh how does this work for you (regardless of the bugs in bunsen-os-release):

sudo apt install ansible

Now, to add any repository:

# Add a PPA from launchpad to the sources (including importing the keys, so like add-apt-repository) 
sudo ansible localhost -m apt_repository -a repo=ppa:nginx/stable
# Add a regular repo to the sources, it'll also run immediately apt-get update
sudo ansible localhost -m apt_repository -a 'repo="deb https://pkg.bunsenlabs.org/debian helium main"'

See here for docs  https://docs.ansible.com/ansible/latest … odule.html and here for the syntax https://docs.ansible.com/ansible/latest … adhoc.html .

Ansible can also be used to remove the repos again.


Per aspera ad astra.

Offline

#6 2020-08-21 20:33:54

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 661

Re: Skript add-apt-repository fails

twoion wrote:

The system surrounding add-apt-repository/software-properties-common is a mess;

So I have understood. I can not see it to be an high priority to fix it if it.


// Regards rbh

Offline

#7 2020-08-21 21:10:51

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 661

Re: Skript add-apt-repository fails

twoion wrote:

@rbh how does this work for you (regardless of the bugs in bunsen-os-release):

# Add a PPA from launchpad to the sources (including importing the keys, so like add-apt-repository) 
sudo ansible localhost -m apt_repository -a repo=ppa:nginx/stable

It throws some errors:

 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

But, it creates /etc/apt/sources.list.d/ppa_nginx_stable_buster.list on my localhost...

localhost | FAILED! => {
    "changed": false,
    "msg": "E:The repository 'http://ppa.launchpad.net/nginx/stable/ubuntu buster Release' does not have a Release file."
}

So one knows that the entry is not usable, as the ppa does not contain any debian packages.

# Add a regular repo to the sources, it'll also run immediately apt-get update
sudo ansible localhost -m apt_repository -a 'repo="deb https://pkg.bunsenlabs.org/debian helium main"'

Yep, as I have not deleted nginx-ppa, it again complain about that. It created /etc/apt/sources.list.d/pkg_bunsenlabs_org_debian.list, with correct info.

Ansible can also be used to remove the repos again.

Quite competent program suite.

But, I prefer manualy editing sources...

Last edited by rbh (2020-08-21 21:12:15)


// Regards rbh

Offline

#8 2020-08-22 21:32:34

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,942

Re: Skript add-apt-repository fails

@rbh I found the root cause and will be publishing a workaround in bunsen-os-release/bunsen-python-apt-template tomorrow, you need to update then. After the workaround, add-apt-repository will work correctly (tested it quickly).

The root cause is a bug in Debian's lsb-release via python3-apt, which is used by software-properties-common.

software-properties-common uses a series of templates in /usr/share/python-apt/templates, where we placed BunsenLabs.info correctly. These templates are ALLOWED to have mixed-case names.

python3-apt tries to determine a "template" to collect distro meta data at runtime based on the output of lsb_release -idrc. lsb_release in turn was implemented by Debian to read /etc/os-release and, as the distro ID, returns the "ID" key from os-release, which according to https://www.freedesktop.org/software/sy … lease.html is required to be a lowercase string, in our case "bunsenlabs", AND CAPITALIZES THE DAMN STRING, producing "Bunsenlabs". This in turn doesn't match our .info file, because the stem must be "BunsenLabs" (mixed-case), so the whole implementation just fails. The capitalization of "ID" is strictly incorrect, because you can't guess the correct casing, as the ID is mandated by the spec to be lower-case (=loss of information, unless you have extra information, or ignore casing). Note that the incorrect method used by Debian here accidentally works for both Debian and Ubuntu. They tried half-assing a fix here https://salsa.debian.org/debian/lsb/-/c … c7ad072b5b to fix a special case for PureOS, but this is also wrong, because the NAME field in os-release, according to the spec, does not need to have anything to do with ID, and can't be substituted, so this "fix" also just fixes the special case when ID=NAME (case-insensitive).

I'm not impressed by this kind of maintainership (ignoring the spec).

The workaround for BL is to ship a .info file with the WRONG capitalization "Bunsenlabs.info".

Yay, Linux distro in the year 2020.


Per aspera ad astra.

Offline

#9 2020-08-23 09:58:57

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,942

Re: Skript add-apt-repository fails

Fix released in bunsen-os-release 10.5.1 and bunsen-python-apt-template 10.5.1


Per aspera ad astra.

Offline

#10 2020-08-23 10:17:48

cog
Developer
From: The Southwest
Registered: 2015-10-27
Posts: 495
Website

Re: Skript add-apt-repository fails

Wow, good job Jens.

After muddling through ../debian folders for packaging purposes through the years it’s no surprise t hear that software-properties-common is equally convoluted.

I will say the “alternatives” symlink framework is one of the debian shining successes as well as the way they do apache2.


The worst day of fishing is better than the best day at work.

Offline

#11 2020-08-23 15:42:14

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 661

Re: Skript add-apt-repository fails

twoion wrote:

Fix released in bunsen-os-release 10.5.1 and bunsen-python-apt-template 10.5.1

Hm... I gave the command:

add-apt-repository --yes "https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ stretch main"

The result in sources.list was:

deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ lithium stretch main
# deb-src https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ lithium stretch main

"lithium" should not be added... The same result with repo for Virtulbox and webmin. Same with single or double quotes.

I'm more convinced than ever: add-apt-repository, should not be used...


// Regards rbh

Offline

Board footer

Powered by FluxBB