Bug 425272

Summary: install-sessions.sh should set up dbus/polkit/kauth stuff for your built-from-source Plasma desktop
Product: [Plasma] plasmashell Reporter: Nate Graham <nate>
Component: generalAssignee: David Edmundson <kde>
Status: RESOLVED FIXED    
Severity: wishlist CC: aleixpol, alex765, butirsky, claudius.ellsel, codestruct, kde, kyle.devir, plasma-bugs, tumaix
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=425268
https://bugs.kde.org/show_bug.cgi?id=423953
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nate Graham 2020-08-12 20:05:23 UTC
Right now install-sessions.sh just makes your built-from-source plasma desktop session show up in SDDM, which is already amazing. However it could do more. Right now we have some ugly documentation about how to set up DBus/PolKit/Kauth stuff properly: https://community.kde.org/Get_Involved/development#Plasma

This documentation doesn't actually seem to be correct and anecdotally, many KDE developers (myself included) appear to to have trouble getting it to work.

install-sessions should also do whatever is needed to get DBus, PolKit, and Kauth stuff working too. Then that stuff is transformed from a pain point into an effortless non-issue, just like it did for making your built-from-source Plasma desktop to appear in SDDM.
Comment 1 Nate Graham 2020-08-12 20:07:29 UTC
CCing a few people:
- David who apparently knows how to make this stuff work
- Tomaz who recently wrestled with this and maybe came up with a solution that worked?
- Aleix who wrote install-sessions.sh
Comment 2 David Edmundson 2020-08-13 12:42:54 UTC
>install-sessions should also do whatever is needed to get DBus, PolKit, and Kauth stuff working too. Then that stuff is transformed from a pain point into an effortless non-issue, just like it did for making your built-from-source Plasma desktop to appear in SDDM.

DBus has two parts; user and system. IMHO the user setup isn't too hard - except for this new potential issue with /home. Personally I would solve that by installing into /opt/kde5 rather than /home especially as it's useful to test multiple users with your self-build setup.

One challenge to note is that if you set up DBus and Polkit correctly to use your dev ones you have to apply something systemwide, which means any distro session also will use any dev polkit things.
You can't make that change at runtime and you can't skip some root involvement.

-----

For the sake of brainstorming, here's some other ideas:

 - We have a script/cron job to symlink some parts from your install into /etc/. Effectively what I do for my polkit and system bus . It'll break setups for people who install alongside distro KDE. 

 - We could use a pam hook to set up the session instead of the .desktop file. At the time we run pam auth modules we know what session we will be loading. This would allow us to manipulate XDG_DATA_DIRS before the user dbus-daemon is started, which saves the session bus problem.

 - Some unionfs to mount a directory read-only on top of /usr at boot? Then all system stuff would just work. Would require it to be done very early in the boot before polkit. Probably a horrific idea.

 - We use something like checkinstall in kdesrc-build and then we can install into /usr as packages. Would work for the neon case and I'm sure there's some equivalent.
Comment 3 David Edmundson 2020-08-13 13:39:48 UTC
For polkit system actions the important folders are:

polkit-1/actions
dbus-1/system.d   (sometimes clients also use /etc/dbus-1/system.d )
dbus-1/system-services
Comment 4 Nate Graham 2020-10-09 13:07:53 UTC
I use a bash function that does the following now:

function install-dbus-stuff {
    echo "Let's install stuff!"
    sudo ls > /dev/null
    echo "Installing actions from ~/kde/usr/share/polkit-1/actions/ to /usr/share/polkit-1/actions/"
    sudo cp -r ~/kde/usr/share/polkit-1/actions/* /usr/share/polkit-1/actions/
    echo "Installing everything from ~/kde/usr/share/dbus-1/ to /usr/share/dbus-1/"
    sudo cp -r ~/kde/usr/share/dbus-1/ /usr/share/
}

Seems to work fine in the absence of an automated solution to this problem.
Comment 5 Claudius Ellsel 2020-10-11 14:40:34 UTC
Do you plan to include it in the install script?
Comment 6 Nate Graham 2020-10-11 17:58:00 UTC
No, because it's kind of a hack. It could overwrite system files and mess up your dist-provided session.
Comment 7 Claudius Ellsel 2020-10-12 16:54:12 UTC
Alright, then.
Comment 8 Andrey 2020-12-06 14:24:33 UTC
I wasn't aware about PolKit as it doesn't mentioned in the Wiki, only DBus does:
https://community.kde.org/Get_Involved/development#Plasma

Maybe that's the reason I don't have Spectacle working in Wayland session.

As a least measure, shall we update the Wiki to mention all the required parts?
Comment 9 David Edmundson 2021-02-21 21:34:17 UTC
This is relevant https://github.com/sddm/sddm/pull/1370  effectively the option 2 in my list above.


It would solve session bus issues.
It would not solve polkit, but it's still in the right direction
Comment 10 Nate Graham 2021-05-11 03:30:08 UTC
*** Bug 436776 has been marked as a duplicate of this bug. ***
Comment 11 Bug Janitor Service 2021-05-24 18:23:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/884
Comment 12 Nate Graham 2021-05-26 01:59:22 UTC
Git commit 02459d3e1c20fc0b9c503e84d182f1504bd26a74 by Nate Graham.
Committed on 26/05/2021 at 01:58.
Pushed by ngraham into branch 'master'.

Set up DBus stuff properly in install-sessions.sh script

This is an extremely fiddly procedure well-suited for being automated
rather than documented.

The approach taken here should work for all distros, even those that
freak out if system DBus files are modified or symlinked into a home
directory.

M  +20   -0    login-sessions/install-sessions.sh.cmake

https://invent.kde.org/plasma/plasma-workspace/commit/02459d3e1c20fc0b9c503e84d182f1504bd26a74