You are not logged in.

#1 2020-08-25 19:39:07

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

Lithium bl-welcome error - 'This script should be run only on Buster'

Regression after the recent bugfix for bunsen-os-release?

https://forums.bunsenlabs.org/viewtopic.php?id=6931


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

Online

#2 2020-08-25 19:41:23

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

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

damo wrote:

Regression after the recent bugfix for bunsen-os-release?

https://forums.bunsenlabs.org/viewtopic.php?id=6931

Yes.


// Regards rbh

Offline

#3 2020-08-26 02:45:29

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,343
Website

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

bl-welcome does this test:

# Debian release that this BunsenLabs system is based on
debian_base=buster

### later ###

[[ $( lsb_release -cs ) = "$debian_base" ]] || {
    echo "Error: This script should be run only on Debian ${debian_base^}." >&2
    exit 1
}

'lsb_release -cs' now outputs 'lithium' instead of the previous 'buster'.
If that is in fact correct, then a different test for the Debian base will have to be found.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#4 2020-08-26 17:50:30

DeepDayze
Like sands through an hourglass...
From: In Linux Land
Registered: 2017-05-28
Posts: 996

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

johnraff wrote:

bl-welcome does this test:

# Debian release that this BunsenLabs system is based on
debian_base=buster

### later ###

[[ $( lsb_release -cs ) = "$debian_base" ]] || {
    echo "Error: This script should be run only on Debian ${debian_base^}." >&2
    exit 1
}

'lsb_release -cs' now outputs 'lithium' instead of the previous 'buster'.
If that is in fact correct, then a different test for the Debian base will have to be found.

What does the same command show on Stretch aka Helium BL release and has the script changed since then?


Real Men Use Linux

Offline

#5 2020-08-26 19:28:04

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

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

DeepDayze wrote:
johnraff wrote:

'lsb_release -cs' now outputs 'lithium' instead of the previous 'buster'.

What does the same command show on Stretch aka Helium BL

On Helium, the output is helium.


// Regards rbh

Offline

#6 2020-08-27 07:53:50

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,343
Website

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

So it looks (@twoion?) as if bunsen-os-release changed in the Lithium version, and till the recent upgrade was outputting 'buster', but now 'lithium'. (But the Helium version of bl-welcome was not doing this test anyway.)

Three possible ways to do the test occur to me:
1) Parse the apt sources looking for a debian release codename.
2) Check /etc/debian_version.
3) Continue looking at lsb_release -cs, but accept either the Debian or BunsenLabs codename.

I'm thinking 3) might be simplest, and good enough for a sanity check before running bl-welcome.

EDIT
This might be more reliable:
4) Query the output of 'apt-cache policy'

Last edited by johnraff (2020-08-27 23:29:31)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#7 2020-08-30 08:37:42

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

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

Until bugfix has been aplied, if you want to run bl-welcome, you can uninstall bunsen-os-release and reinstall after you run the bl-welcome script.


// Regards rbh

Offline

#8 2020-08-30 08:53:23

Uooops
Member
Registered: 2019-07-08
Posts: 17

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

I've changed this

# Debian release that this BunsenLabs system is based on
debian_base=buster

to this

# Debian release that this BunsenLabs system is based on
debian_base=lithium

and it works. Might be useful or you're looking for other solution?

Offline

#9 2020-08-30 10:38:39

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

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

Uooops wrote:

I've changed this

# Debian release that this BunsenLabs system is based on
debian_base=buster

to this

# Debian release that this BunsenLabs system is based on
debian_base=lithium

and it works. Might be useful or you're looking for other solution?

I still get the error:

/usr/bin/bl-welcome: This script is not meant to be run in a live session.

// Regards rbh

Offline

#10 2020-08-30 18:44:33

sleekmason
Member
Registered: 2018-05-22
Posts: 210

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

Changing the script to read "lithium" worked for me as well.

Offline

#11 2020-08-30 21:22:50

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

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

Apologies. After the inclusion of the hitherto missing VERSION_CODENAME in /etc/os-release, from which lsb_release derives its information, the output of lsb_release includes now the correct codename, which is lithium, instead of buster, which is based on the base distribution and output if the VERSION_CODENAME wasn't specified.

Outputting lithium in this place is technically correct, but apparently this breaks a) existing other BL code (which I didn't anticipate, this is the error here) and b) might possibly break other software too.

As a hot fix, I've removed VERSION_CODENAME in the next release of bunsen-os-release 10.5.2 which I just pushed to contain the breakage. We'll fix our BL code and figure things out later.

PS. Sorry for letting this lie the whole week.


Per aspera ad astra.

Offline

#12 2020-08-30 21:31:17

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

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

johnraff wrote:

EDIT
This might be more reliable:
4) Query the output of 'apt-cache policy'

No, because that can include only helium sources on a lithium system, and it can also include mixed sources, and then which is correct smile


Per aspera ad astra.

Offline

#13 2020-08-30 23:42:04

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,343
Website

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

In fact checking the debian base system is only a sanity check that was introduced with the Lithium version of bl-welcome. The "debian_base" is used when adding or checking for backports apt entries.

If BL is installed on a system with mixed sources - by mistake, or for user's personal reasons - then as long as Debian Buster is found among the apt sources, then bl-welcome ought to be able to do its work, I think. What would happen if those sources included Sid, for example, is not totally clear though. One option would be to error out if more than one Debian codename is found in the apt sources.

[slightly off-topic]
Actually, looking at apt-cache policy might also be a fairly robust way of checking whether any Debian sources had been enabled at all. (Missing sources can happen if a user goes ahead with installation without any network connection - a longstanding issue waiting for a fix.) In such cases, bl-welcome could offer to add the generic deb.debian.org sources.

But @twoion, wrt bunsen-os-release I think you should do whatever you consider to be the correct thing without worrying too much about the effect on other BL packages. As far as I know, the only package checking the output of 'lsb_release' at the moment is bunsen-welcome which can learn to live without it. smile

Of course I can't speak for other software. grub, for example, uses 'lsb_release -i -s' to set the menu entry name, but that was unaffected by the recent update of bunsen-os-release.

Last edited by johnraff (2020-08-30 23:49:46)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#14 2020-08-30 23:48:12

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,343
Website

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

Uooops wrote:

I've changed this

# Debian release that this BunsenLabs system is based on
debian_base=buster

to this

# Debian release that this BunsenLabs system is based on
debian_base=lithium

and it works. Might be useful or you're looking for other solution?

Unfortunately, while setting debian_base to lithium will allow the script to run, it will break some actions, like adding debian or BunsenLabs backports.

Please don't use that.

Instead, for a temporary fix, till an upgrade comes out, go to lines 270~273 of the same file and comment out that whole block, thus:

#[[ $( lsb_release -cs ) = "$debian_base" ]] || {
#    echo "Error: This script should be run only on Debian ${debian_base^}." >&2
#    exit 1
#}

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#15 2020-08-31 04:45:07

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,343
Website

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

johnraff wrote:

Unfortunately, while setting debian_base to lithium will allow the script to run, it will break some actions, like adding debian or BunsenLabs backports.

This helps focus the issue, in fact.

$debian_base replaced a lot of hard-coded "stretch" references in the later script segments, especially add-debian-backports and add-bunsen-backports, making upgrading the code between releases much simpler. So the purpose of that test for debian_base was simply to check that later code would work OK, rather than trying to pin down the more nebulous concept of what the current running "system" was.

Regardless of what other repos might be enabled, maybe the presence of the Debian Buster apt line would be enough to say it's OK to check for an existing buster-backports line, and to add one if desired?

Looking again at the output of 'apt-cache policy' it doesn't really look any simpler to parse than just using grep on the sources.list files directly. Maybe something (it's not too elegant) like:

shopt -s nullglob # in case there is nothing in sources.list.d/
if grep -Pq '^deb +(?!.*bunsenlabs\.org)(?=.*debian)'"$mirror_regex +${debian_base}"'(?=.*main)(?=.*contrib)(?=.*non-free)( +[a-z-]+){1,3} *$' /etc/apt/sources.list{,.d/*}
then
    # it's OK
else
    # error exit
fi
shopt -u nullglob

Might work?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#16 2020-08-31 07:53:07

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,343
Website

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

Obviously just thinking out loud here...

Back to 'apt-cache policy': I think grepping for the values set for n= c= (maybe a= l= too) might be an easier way of finding what we want to know. Should also make for simpler versions of eg haveDebianBackports() in add-debian-backports...


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#17 2020-08-31 07:55:11

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

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

I can not evaluate the code above. But, it must work also if only sources.list is used, or don't give false reaction for entrys preceeded with # (commented out).

Last edited by rbh (2020-08-31 07:55:47)


// Regards rbh

Offline

#18 2020-08-31 10:00:30

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,343
Website

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

^Yes it covers both those cases OK (based on very similar code already being used), but I'm now looking at things like:

apt-cache policy | grep -P '(?=.*l=Debian,)(?=.*n=buster,)(?=.*c=main,)' && echo YES

Using PCRE "lookahead" to allow items to appear in any order. But please don't ask me any more about grep's -P option. roll


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#19 2020-09-03 07:40:42

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,343
Website

Re: Lithium bl-welcome error - 'This script should be run only on Buster'

Proposing to use this code instead of querying lsb_release.
The checkSources() function can be reused later when checking for backports, and maybe the special regexes will no longer be needed.
There's a wrapper usingDebStable() test around that which could use some different test in the future without having to rewrite the code which follows.

# Debian release that this BunsenLabs system is based on
debian_base=buster

### later ###

# Returns 0 if a line in 'apt-cache policy' contains all the terms provided.
# Terms can be in any order, quote terms containing spaces.
# eg: checkSources c=main 'l=Debian Backports'
checkSources() {
    local re=
    for term in "$@"
    do
        re+="(?=.*$term(,|\s*$))"
    done
    apt-cache policy | grep -Pq "$re" && return 0
    return 1
}

# wrapper function in case future scripts want to do the test differently
usingDebStable() {
    checkSources "n=$debian_base" l=Debian c=main && return 0
    return 1
}

### and ###

usingDebStable || {
    echo "Error: This script should be run only on Debian ${debian_base^}." >&2
    exit 1
}

Next is to apply @twoion's suggested fix for the "live session" test, rebuild the package and check it all works...


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

Board footer

Powered by FluxBB