Subject: Re: Bug#1431: Haltbt is useless...

From: Stefan Baur <[email-masked]>
Date: Mon, 27 Jan 2020 09:53:58 +0100

Am 25.01.20 um 18:02 schrieb Mihai Moldovan:
> This said, the amount of work required for this is huge, so I probably won't
> implement it. Essentially, we'd have to figure out whether we're running inside
> of a TCE or not (which is very difficult on its own, since we now have TCEs with
> full desktop environment like the MATE Minidesktop variant that are not easily
> distinguished from non-TCE environments) and actually initiating a system
> shutdown is crazy difficult. Since a normal user can't do that (for obvious
> reasons), each desktop environment pretty much has its own way of talking to a
> daemon running with higher privileges (usually via dbus) that checks whether the
> user is allowed to cause a system shutdown or not and executes the action if
> needed. I'm not even sure if there is a standard way of doing so.

Actually, we could create a new package and set it as "recommends" or
"suggests" on the x2goclient / x2gothinclient package.

The script we use to shutdown the system in the thinclient environment
is rather simple:
<https://code.x2go.org/gitweb?p=live-build-x2go.git;a=blob;f=config/includes.chroot/lib/live/config/2800-x2go-powerbuttonmonitor;h=cb8d29cf9e1c5cfbed00e8a842f0d1aff0c2fe24;hb=refs/heads/feature/openbox-magic-pixel-workaround-stretch>

The poweroff can be performed faster with the first sequence, but should
not be done that way when there are rw-mounted filesystems under /dev,
that's what the if/else is for.

In its current form, the script has a hardcoded user homedirectory of
/home/user/, but expanding that to check a list of users or all homedirs
under /home should not be hard.

However, on systems where /home/ is on a persistent storage device and
not a ramdisk (as in the thinclient environment), the .halt file needs
to be deleted before executing the shutdown.  That's currently missing.

-Stefan

-- 
BAUR-ITCS UG (haftungsbeschränkt)
Geschäftsführer: Stefan Baur
Eichenäckerweg 10, 89081 Ulm | Registergericht Ulm, HRB 724364
Fon/Fax 0731 40 34 66-36/-35 | USt-IdNr.: DE268653243