Yes, I'm a Plasma fanboy. I prefer to install my things from ground up though and that's why I usually don't use the Plasma ISO.
I install everything with minimal and install what I need, like xorg and plasma-desktop groups.
I've had trouble in the past to get Plasma to work because of the infamous "Could not sync environment to dbus" error after starting X.
Today I stumbled upon the actual error message (xinit.log):
startkde: Starting up...
dbus-update-activation-environment: error: unable to connect to D-Bus: Server address of type unix was missing argument path or abstract
startkde: Could not sync environment to dbus.
Warning: Missing charsets in String to FontSet conversion
So I checked what this actually is and found in the official dbus documentation:
dbus-update-activation-environment updates the list of environment variables used by dbus-daemon --session when it activates session services without using systemd.
To be honest that didn't tell me much and I also read up on dbus-launch which neither enlightened my poor soul. I did more investigation though and came about a solution:
marian@ obarun ~ % export $(dbus-launch)
marian@ obarun ~ % startx
Et voilà! C'est ça.
To make this permanent (for now) I added that one liner to my .xinitrc right before executing the session and that works.

BUT
  • Why is this needed to begin with?
  • How do I add this to X itself rather than xinit?! Because I want to use a DM and not startx.
  • [deleted]

Hi marianarlt

I can help you. I'm using plasma too. I suppose you want to use SDDM as display manager.

Login to your user

1) Create a 'gui' tree like that
 66-tree -v3 -nEc gui 
# # You are free to choose another tree name. But you will have to adapt the .zprofile file.

1b) Add dbus-user service in this current 'gui' tree
 66-enable -v3 dbus-user 
Optional > you can also add xdg-user-dirs service in this current 'gui' tree
 66-enable -v3 xdg-user-dirs 
1c) Check your new created tree. You should see something like that
 66-info -T gui 
gui
Initialized: no | Current: yes
Contains: | Enabled: no
├─(....) xdg-user-dirs
├─(....) dbus-user-log
└─(....) dbus-user
2) Create a $HOME/.scandir file and add these lines
# !/usr/bin/execlineb -P
# emptyenv -p
s6-setsid -qb --
umask 022

66-scandir -v3 -cu
and make this file executable like that
chmod 750 $HOME/.scandir
4) Create a $HOME/.zprofile file and add these lines
(.scandir &) &
66-all -v3 -t gui down
sleep 01
66-all -v3 -t gui up
With this user configuration you will be able to use SDDM or startx command line

5) Optionnal > Create a $HOME/.xinitrc file and add these lines
# # Uncomment if you use startx command line to launch plasma DE
# exec ck-launch-session startkde
NOTE in your .xinitrc file

You can comment out these two lines
# exec 1>$HOME/xinit.log
# exec 2>&1
and you have to comment out or remove these lines
# (.scandir &) &
# sleep 01
# 66-all -v3 up
Now, from your user root:

1) Check if you have enabled dbus and sddm service in a tree of your choice
 sudo 66-info -T 
REBOOT
Hey Jean,

I was kind of hoping you would leave a word on this ;D
Look I'm up to something here. It's all about $(dbus-launch)!
The only bit of info I needed was that .zprofile file is used by SDDM instead.

Absolutely no user tree is required to get inside of a basic Plasma desktop environment from SDDM. I will have to see how much KDE proprietary functionality is provided.

Feel free to try this out yourself:
  1. Install minimal Obarun
  2. Install the most minimal X (xorg-server), Plasma (plasma-desktop) and SDDM (also sddm-66serv and enable it)
  3. Do not bother to install or enable dbus-66serv, not for root, not for any user, or even create a scandir for your user!
  4. Only write this into users directory .zprofile file:
    export $(dbus-launch)
    
  5. Reboot, wait for SDDM to pop up and log in...
I am writing right now from within Plasma on Obarun. My user has no scandir and therefore not a single service enabled. Root has not enabled dbus (root dbus service would be needed for shutdown/reboot to work from within the DE though). Absolutely no additional service is needed to get into the desktop (Let's not yet talk about proprietary functionality). You only need to export that environment variable before being able to launch Plasma like any other DE...

Edit/Follow Up
Oh my, one just has to read the arch wiki on ConsoleKit really...
To launch an X session with ConsoleKit, append the following to the exec statement in ~/.xinitrc e.g.:
exec ck-launch-session dbus-launch --sh-syntax --exit-with-session openbox-session
This starts Openbox with proper environment variables so it and its children are able to use ConsoleKit
SDDM is capable of detecting ConsoleKit and launching ck-launch-session automatically. This is coded in /usr/share/sddm/scripts/Xsession which is the default script called by SDDM after passing valid user credentials.
So for my own convenience I cloned this script, renamed it to /usr/share/sddm/scripts/ConsoleKit and just edited the last part where it calls ck-launch-session to add the mentioned arguments from the wiki, including dbus-launch.
For even more convenience I then copied the default /usr/lib/sddm/sddm.conf.d/sddm.conf to /etc/sddm.conf.d/sddm.conf and in the [X11] section edited this line:
# Path to a script to execute when starting the desktop session
SessionCommand=/usr/share/sddm/scripts/ConsoleKit
Now I don't even need a .zprofile file anymore, or any line in any profile file for that matter. No scandir. No services. Just a working desktop.

Edit2
Since this is between X and ConsoleKit wouldn't it be a wise thing to do to implement this correctly in the Obarun images? Rewrite "exec ck-launch-session sessionname" to include the above arguments?
  • [deleted]

Well, first I want to be honest but xorg must die now as quickly as possible with all of this session 80's mess. This should not take too long now. I just tested plasma under wayland and it works pretty well.

Now, I have some difficulty understanding your idea. I don't see anything about ck-lauch-session from /usr/share/sddm/scripts/Xsession.
Are you talking about the xsessionddir="/etc/X11/Xsession.d" value and you put a file in this directory with the user session script ?
I definitely second Wayland. Last time I tested it it was still pretty alpha though :s
Are you talking about the xsessionddir="/etc/X11/Xsession.d" value and you put a file in this directory with the user session script ?
Nope.

Last if block in Xsession:
/usr/share/sddm/scripts/Xsession
Line 98-106

if [ -z "$*" ]; then
    exec xmessage -center -buttons OK:0 -default OK "Sorry, $DESKTOP_SESSION is no valid session."
else
	if [ -x /usr/bin/ck-launch-session ]; then
		exec ck-launch-session $@
	else
		exec $@
	fi
fi

Can be changed to:
	if [ -x /usr/bin/ck-launch-session ]; then
		exec ck-launch-session dbus-launch --sh-syntax --exit-with-session $@
	else
		exec $@
	fi
I just talked about making it a separate script and reference it from the sddm.conf because updates may change the default templates at any given moment.
  • [deleted]

Ok, I see. I do not have these lines but now I understand why ... Well, I will try your hack on a new plasma installation inside a VM.

Powered by Obarun