You are not logged in.

#1 2020-08-26 02:37:29

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

bl-welcome exits if live-build is installed

@rbh reported this error message here:
https://forums.bunsenlabs.org/viewtopic … 44#p105644

bl-welcome wrote:

This script is not meant to be run in a live session.

The test in the script is:

[[ -d /lib/live ]] && { echo "$0: This script is not meant to be run in a live session." >&2; exit 0;}

He suggested the package live-tools might be responsible, but /usr/lib/live (/usr/lib is now symlinked from /lib) is not installed by that package. However live-build puts plenty of files in /usr/lib/live. I have live-build on my system and also get that error trying to run bl-welcome.

Obviously checking for /lib/live will not work as a test for a live system.

Does anybody have a suggestion for something more robust?

Last edited by johnraff (2020-08-27 07:14:28)


...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

Online

#2 2020-08-26 19:57:05

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

Re: bl-welcome exits if live-build is installed

You mean an alternative way of detecting a live session?

I think you could check that /proc/cmdline contains the parameter:

boot=live

It says on https://manpages.debian.org/jessie/live … .7.en.html

live-boot is only activated if 'boot=live' was used as a kernel parameter.

so it's both specific to live-boot (on Debian anyway).

An alternative way would be to probe file systems (on a live CD, / is an overlay file system, and the cdrom and loop devices are mounted at specific locations), but boot=live in the kernel command line sounds like a nice and simple solution.

So

grep -q '\<boot=live\>' /proc/cmdline

?


Per aspera ad astra.

Offline

#3 2020-08-27 07:26:22

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

Re: bl-welcome exits if live-build is installed

^Thanks, that looks like the way to go.
I've just confirmed the absence/presence of boot=live in /proc/cmdline on a couple of (non-)live systems.

In fact it wouldn't be a disaster if we got a false negative and allowed bl-welcome to run on a live session - just confusing - but we definitely want to avoid false positives on installed systems that would prevent the welcome script from running.

I'll move the test to looking at /proc/cmdline in the next upgrade of bunsen-welcome.

An alternative way would be to probe file systems

Yes, if some snag turns up with the kernel command line method, then for example a live system has a lot of content under /run/live which shouldn't ever be found otherwise.


...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

Online

Board footer

Powered by FluxBB