Obviously I donāt know the details of your use case, so this may or may not be even remotely workable, but just in the spirit of thinking outside the hollow cardboard receptacle⦠does it have to be a stock live USB, or can it be a pre-customized one? And backing up a bit, because it would inform the answer to that previous question: Are you talking about an individually (and/or interactively) customized environment each time, or is it the same customizations being applied each time itās used?
The latter, in particular, would probably be far easier to achieve as a pre-configured liveUSB distribution that already had the customizations pre-applied onto it, something those filesystems/installers are much more conducive to. Any customizations you please, really, could be (in Microsoftās terminology) āslipstreamedā atop the original live distribution and disseminated already ready already.
Yeah, the problem there is that automatic login is already enabled for the liveuser. But it would defeat the entire purpose of having a āLogoutā option if the user were immediately logged back in again, so even in an auto-login situation āLogoutā takes you to the greeter ā as it should, IMHO, even though it unfortunately makes things difficult for your particular needs.
I did some poking around at the possible options you might have, but unfortunately (though not unexpectedly) came up pretty much empty. loginctl
contains plenty of commands for ending sessions, as well as for activating and deactivating them, but (predictably) nothing for creating sessions. And while the org.freedesktop.login1(5)
man page does list some DBus interfaces for initiating sessions, it accompanies them with this rather dire admonishment about even considering using them:
CreateSession() and ReleaseSession() may be used to open or close login
sessions. These calls should never be invoked directly by clients.
Creating/closing sessions is exclusively the job of PAM and its
pam_systemd(8) module.
I was even going to suggest that you might be better off triggering a reboot, rather than a logout / login cycle, since after reboot the existing auto-login would again be triggered⦠but then I remembered, right, liveUSB. Rebooting would wipe out your customizations and youād be right back where you started. Another point in favor of pre-applying them to the base filesystem itself, instead. (If at all feasible.) Then you donāt have to re-do the customization each time the live image boots up.