Solved Slim - failed to execute login command

I have read some other threads here on the forums and it looks like it is easy to solve,
but sadly nothing worked for me.

I have tried a lot of different configurations and ended up with the following as of now:



exec mate-session

the Login command in /usr/local/etc/slim.conf is
login_cmd       exec /bin/sh - ~/.xinitrc %session

I can type startx and the mate session starts fine, but booting into
slim gives me "failed to execute Login command"
(there also Comes up a Little window with a dbus error which says:
"Could not connect to session bus" and "could not acquire name on session bus")

I usually use /bin/tcsh as my shell and had that changed earlier in the /usr/local/etc/slim.conf but to make the tcsh a login shell the syntax is different from sh and the tcsh(1) manpage says that the -l Option must be the only Option.
Since this is not the case because it is followed by ~/.xinitrc %session i dropped that i also tried to Change my Shell to /bin/sh and left the login_cmd as ist was. That made no difference.

I also tried to start slim from /etc/ttys like this
ttyv8 "/usr/local/bin/slim" xterm on secure

That makes the Little Windows with the dbus error dissapear but the
"failed to execute Login command" remains the same.

I'm on FreeBSD 10.2
Last edited by a moderator:
exec mate-session
Delete this entry from ~/.xinitrc,
x11/slim read session exec from
# Directory of session files.
# They should be xdg-style .desktop files.
# The "Name" entry in the session file would be used as session name.
# The "Exec" entry would replace %session in login_cmd.
sessiondir        /usr/local/share/xsessions
So your ~/.xinitrc can be even empty and you'll be able to start your mate-session.
Also you can easily switch between sessions which are located at /usr/local/share/xsessions with F1 hotkey.
Check this dir and you'll see /usr/local/share/xsessions/mate.desktop.
Снимок экрана от 2016-05-28 09-08-55.png

So you don't need to edit anything, x11/slim is ready to use "out of the box".

But if you want to start your session with ~/.xinitrc,
then comment this line in /usr/local/etc/slim.conf:
#sessiondir        /usr/local/share/xsessions
Thanks so much for clearing things up, I have now understood how the config-files work together and got it running!
Just removed
exec mate-session
from ~/.xinitrc
Hi I have the same problem but my ~/.xinitrc is empty.

What should I do? Would anyone be able to help me in this regard.

Thanks & Best Regards

Hi I have the same problem but my ~/.xinitrc is empty.
Not really much information… to get a start:

Post #2 tells me that SLiM starts the user session as defined in /usr/local/etc/slim.conf … so: What's in your "slim.conf" file? Does it also use /usr/local/share/xsessions as sessiondir? Does your sessiondir exist (and has valid content)?

And what happens if you just write f.e. "xterm" in your ~/.xinitrc?
For SLiM to work properly you need at least this in ~/.xinitrc:
[ -n "$1" ] && [ -x "$1" ] && exec "$1"
SLiM passes the chosen window manager to ~/.xinitrc as an argument.
Or, it's possible to change login_cmd line in /usr/local/etc/slim.conf:
login_cmd           exec /bin/sh - ~/.xinitrc %session
login_cmd           exec fvwm
"fvwm" may be replaced with your favorite WM. And to disable F1 session switch, comment "sessiondir" line.
Last edited by a moderator:
  • Thanks
Reactions: a6h