Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session= autodetection broken / auto detect desktop environment #1564

Open
adrelanos opened this issue Jun 24, 2022 · 2 comments
Open

Session= autodetection broken / auto detect desktop environment #1564

adrelanos opened this issue Jun 24, 2022 · 2 comments

Comments

@adrelanos
Copy link

adrelanos commented Jun 24, 2022

sddm when using [Autologin] currently requires the desktop environment to be hardcoded in the Session=xfce.

broken:

[Autologin]
User=user

functional:

[Autologin]
User=user
Session=xfce

environment:

  • Debian bullseye
  • sddm 0.19.0
  • File /usr/share/xsessions/xfce.desktop exits.
  • No other desktop environment besides Xfce installed.

bug report:
Even if Session=xfce is not set, sddm should autologin into Xfce.
Seems like auto detection of the desktop environment is failing.

By comparison, gdm3 display manager does not require a hardcoded Session=xfce setting. But of course sddm is nicer because it has much leaner dependencies.

@adrelanos
Copy link
Author

Seems like there is currently no attempt to auto detect which desktop environment is installed.

In https://github.com/sddm/sddm/blob/develop/src/daemon/Display.cpp#L156

    bool Display::attemptAutologin() {
        Session::Type sessionType = Session::X11Session;

        // determine session type
        QString autologinSession = mainConfig.Autologin.Session.get();
        // not configured: try last successful logged in
        if (autologinSession.isEmpty()) {
            autologinSession = stateConfig.Last.Session.get();
        }
        if (findSessionEntry(mainConfig.Wayland.SessionDir.get(), autologinSession)) {
            sessionType = Session::WaylandSession;
        } else if (findSessionEntry(mainConfig.X11.SessionDir.get(), autologinSession)) {
            sessionType = Session::X11Session;
        } else {
            qCritical() << "Unable to find autologin session entry" << autologinSession;
            return false;
        }

The closest thing to auto detection is findSessionEntry but it requires two variables:

  • A) dir (mainConfig.Wayland.SessionDir.get() or mainConfig.X11.SessionDir.get()) and
  • B) name (autologinSession) (the name of the desktop environment such as xfce)

The dirs are already built-in (/usr/share/wayland-sessions / /usr/share/xsessions/xfce.desktop).

As for name it's currently not auto detected. Let's say there is just a single file in folder /usr/share/wayland-sessions (preferably) or folder /usr/share/xsessions (such as for example /usr/share/xsessions/xfce.desktop) then it's not auto detected.

@arvidjaar
Copy link

I think this is the same issue as in #1607

If autlogin session is not specified explicitly, sddm tries to use the last session from /var/lib/sddm/state.conf. sddm stores full pathname in this file, so findSessionEntry always returns TRUE when checking file existence (for absolute filename this QDir method ignores actual directory). Because sddm first checks Wayland directory, it always assumes session type is wayland and attempts to start X11 session using Wayland script that fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants