It seems that if the logging-in user has no
then a User Session will (most likely) fail almost immediately:
* the SDDM greeter will reappear.
With /usr/local/share/sddm/scripts/xinit-session patched according to <https://invent.kde.org/-/snippets/1713>, it seems that User Session will (in the absence of an ~/.xinitrc file) succeed, reliably.
With /usr/local/share/sddm/scripts/xinit-session experimentally reduced to a single line:
– things were less successful. My test results were not entirely conclusive, but it's possible that _none_ of the tests led to a usable xterm window.
Instead, from <https://invent.kde.org/-/snippets/1713>
(fallback in xinit-session):
# Runs the user's .xinitrc (at this point, .xsession has already
# been sourced).
if [ ! -f "$RC" ] ; then
test -x "$RC" && exec "$RC"
test -f "$RC" && exec /bin/sh "$RC"
(In reply to Graham Perrin from comment #1)
What's the point of putting startx into /usr/local/share/sddm/scripts/xinit-session ? That's kind of recursive.
(In reply to Gleb Popov from comment #2)
yes, that was based on my idea^H misunderstanding :) "why should we figure out the proper xinitrc when startx already can do it".
But I think patching in the system xinitrc should be fine (or at least be less confusing).
(In reply to Tobias C. Berner from comment #3)
It might have sense to add
xmessage "You are running default X session. Put whatever you want into $HOME/.xinitrc file to start something else"
to /usr/local/etc/X11/xinit/xinitrc , maybe?
(In reply to Gleb Popov from comment #4)
I think getting to use twm is warning enough :P
Adding a message would force people who are happy with the default session (let's assume such a person exist) force to create their own xinitrc too.
So, I'm not sure whether that is a good thing.
But I think fixing sddm's session-script and adding a pkg-message to sddm might at least serve as enough documentation -- or while were looking at documentation: https://docs.freebsd.org/en/books/handbook/x11/#x11-wm should be updated to say "hey, if you want to use sddm's-xssesion, make sure to have an ~/.xinitrc"
+1 to a plainly worded package message.
More than that, I would like 'User Session' (the phrase presented by SDDM) to be foolproof – if possible.
Foolproof enough to work immediately for a new user – the product of adduser(8).
A User Session that's so reliable – without an absolute _requirement_ for ~/.xinitrc – will be very useful as a step in basic troubleshooting. In cases where, for example, a person claims that updating or upgrading something has "broken X" or whatever.
Ask the user to choose User Session at the SDDM login screen. Then if the result is a basic window (i.e. twm) it'll be enough for the person to understand that things are not entirely broken, next steps in troubleshooting can be more user-friendly, and so on.
(Whilst cases of misunderstood 'breakage' are rare, it's not uncommon for other readers to 'jump on the bandwagon' and reach a wrong conclusion …)
In order to enable using the default xinit, which runs xterm, we would need to add xinit and xterm to the dependencies of SDDM (because you could install SDDM, plus xorg-server, and skip xorg-apps entirely).
I can imagine a slightly different setup, which depends on xmessage only; it would check for .xinitrc in $HOME, the default xinit, and then fall back to just xmessage. And a pkg-message: someone who hasn't installed xinit (and xterm and twm) and still expects SDDM to magically do the right thing with undefined user sessions can be expected to handle an xmessage.
A commit in branch main references this bug:
Author: Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2021-07-17 22:12:57 +0000
Commit: Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2021-07-17 22:21:59 +0000
x11/sddm: make "user session" more resilient
It's possible to install SDDM with very little other X11 baggage,
like xterm. In such a minimal install situation, SDDM will still
come up and offer "User Session" -- and that session will fail,
because there's nothing to run.
Depend on xmessage, and then fall back to xinit's default script
and if **that** isn't there, show the user a message instead of
just sitting there with a black screen and an X cursor.
Reported by: Graham Perrin
x11/sddm/Makefile | 7 +++++--
x11/sddm/files/xinit-session | 22 ++++++++++++++++------
x11/sddm/pkg-message | 7 +++++++
3 files changed, 28 insertions(+), 8 deletions(-)