12
Unable to Start Plasma as Different User from TTY
(lemmy.kde.social)
KDE is an international technology team creating user-friendly free and open source software for desktop and portable computing. KDE’s software runs on GNU/Linux, BSD and other operating systems, including Windows.
If you encounter a bug, proceed to https://bugs.kde.org, check whether it has been reported.
If it hasn't, report it yourself.
PLEASE THINK CAREFULLY BEFORE POSTING HERE.
Developers do not look for reports on social media, so they will not see it and all it does is clutter up the feed.
Alright, so I found an absolute trainwreck of a solution. All the ways I have tested (
sudo
,login
,openvt
,machinectl
,systemd-run
) don't work because important variables likeXDG_SESSION_ID
are not created. So probably these methods don't open up a real session or something...?What I did is to automatically open up a session for the specified user - in this case using
getty
. Using these code lines, I created asystemd
-configuration and booted it up by runningsystemctl daemon-reload
:source: https://wiki.archlinux.org/title/Getty
After this, the user has a running session and proper environment variables set up. I use
pgrep
to wait for the expected process to show up:The environment variables of the process with the PID
$sessionPid
can then be borrowed to runstartplasma-wayland
properly as the desired user:The fact, that this command would always end up focussing on tty2 after exiting the plasma session, I kind of abused the
openvt
-command to force the focus to return to the previous tty:I also did some quirks like using
openvt
to find an unused tty. If you want to see the whole thing in action - script is here:https://git.nuth.ch/manuth/PortValhalla/src/commit/b6329693d6fd717c8ca6f7a278a864930b7f705d/scripts/Common/Software/rclone/main.fish#L10-L60