Tweaks to udev rules, logind race, fallback to seat0 (#2011991) (#2016310)

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
epel9
Jeremy Linton 3 years ago committed by Adam Williamson
parent b0951104fb
commit 32eb4e85b6

@ -0,0 +1,138 @@
From 77a1f3148f515ae7c9b65f45dafe85bc58348ff9 Mon Sep 17 00:00:00 2001
From: Jeremy Linton <jeremy.linton@arm.com>
Date: Fri, 22 Oct 2021 14:51:54 -0500
Subject: [PATCH] Delay for logind, and fallback to seat0
There is systemd/logind race with when restarting
sddm that causes logind1 not to be available. Previously
this meant the seat0 was immediately created regardless
of the state of CanGraphical.
Fixing this, though we still want seat0 to be started
if none of the seats appear to be graphical. Presumably
there are some graphics on the machine ,otherwise
why run sddm? Wait a bit, and create seat0 anyway. If
this fails the output from Xorg should tell us why. This
is generally a better strategy than what happens a goodly
amount of time now, where sddm is started and silent about
why the screen is blank.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
src/daemon/LogindDBusTypes.cpp | 31 +++++++++++++++++++++----------
src/daemon/SeatManager.cpp | 22 ++++++++++++++++++++++
src/daemon/SeatManager.h | 1 +
3 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/src/daemon/LogindDBusTypes.cpp b/src/daemon/LogindDBusTypes.cpp
index 011bb7f..e19f1db 100644
--- a/src/daemon/LogindDBusTypes.cpp
+++ b/src/daemon/LogindDBusTypes.cpp
@@ -8,6 +8,8 @@
#include <QDebug>
+#include <unistd.h>
+
class LogindPathInternal {
public:
LogindPathInternal();
@@ -46,17 +48,26 @@ LogindPathInternal::LogindPathInternal()
qRegisterMetaType<UserInfoList>("UserInfoList");
qDBusRegisterMetaType<UserInfoList>();
- if (QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.login1"))) {
- qDebug() << "Logind interface found";
- available = true;
- serviceName = QStringLiteral("org.freedesktop.login1");
- managerPath = QStringLiteral("/org/freedesktop/login1");
- managerIfaceName = QStringLiteral("org.freedesktop.login1.Manager");
- seatIfaceName = QStringLiteral("org.freedesktop.login1.Seat");
- sessionIfaceName = QStringLiteral("org.freedesktop.login1.Session");
- userIfaceName = QStringLiteral("org.freedesktop.login1.User");
- return;
+ // Fedora _should_ have a systemd-logind running, although because it takes a few moments to restart after
+ // systemctl isolate calls, it may not yet be running. Wait a few seconds for it, while blocking everything else.
+#ifdef HAVE_SYSTEMD
+ int logind_wait_seconds = 50;
+ while (logind_wait_seconds--) {
+ if (QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.login1"))) {
+ qDebug() << "Logind interface found";
+ available = true;
+ serviceName = QStringLiteral("org.freedesktop.login1");
+ managerPath = QStringLiteral("/org/freedesktop/login1");
+ managerIfaceName = QStringLiteral("org.freedesktop.login1.Manager");
+ seatIfaceName = QStringLiteral("org.freedesktop.login1.Seat");
+ sessionIfaceName = QStringLiteral("org.freedesktop.login1.Session");
+ userIfaceName = QStringLiteral("org.freedesktop.login1.User");
+ return;
+ }
+ qDebug() << "Sleeping for systemd-logind";
+ usleep(100000);
}
+#endif
if (QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.ConsoleKit"))) {
qDebug() << "Console kit interface found";
diff --git a/src/daemon/SeatManager.cpp b/src/daemon/SeatManager.cpp
index 60d22ea..96d2b82 100644
--- a/src/daemon/SeatManager.cpp
+++ b/src/daemon/SeatManager.cpp
@@ -26,6 +26,9 @@
#include <QDBusMessage>
#include <QDBusPendingReply>
#include <QDBusContext>
+#include <QDebug>
+#include <QFileInfo>
+#include <QTimer>
#include "LogindDBusTypes.h"
@@ -115,6 +118,8 @@ namespace SDDM {
QDBusConnection::systemBus().connect(Logind::serviceName(), Logind::managerPath(), Logind::managerIfaceName(), QStringLiteral("SeatNew"), this, SLOT(logindSeatAdded(QString,QDBusObjectPath)));
QDBusConnection::systemBus().connect(Logind::serviceName(), Logind::managerPath(), Logind::managerIfaceName(), QStringLiteral("SeatRemoved"), this, SLOT(logindSeatRemoved(QString,QDBusObjectPath)));
+
+ QTimer::singleShot(5000, this, &SeatManager::checkSeat);
}
void SeatManager::createSeat(const QString &name) {
@@ -152,6 +157,23 @@ namespace SDDM {
m_seats.value(name)->createDisplay();
}
+ // this is a bit hacky, but linux DRM drivers
+ // won't initially be available so there is a race
+ // between determing if a efifb/etc graphical object
+ // is the only graphics on the machine, or a DRM driver
+ // will take over the display. So we will hang out for a few
+ // seconds and if none of the seats are declared cangraphical
+ // its possible the only graphics on the machine don't have
+ // a drm driver.
+ void SeatManager::checkSeat(void) {
+ if (m_seats.isEmpty()) {
+ //if (QFileInfo::exists(QStringLiteral("/dev/fb0"))) {
+ qWarning() << "No graphical seats found, attempt to start one on the main console anyway...";
+ createSeat(QStringLiteral("seat0"));
+ //}
+ }
+ }
+
void SDDM::SeatManager::logindSeatAdded(const QString& name, const QDBusObjectPath& objectPath)
{
auto logindSeat = new LogindSeat(name, objectPath, this);
diff --git a/src/daemon/SeatManager.h b/src/daemon/SeatManager.h
index b2f9796..aa43047 100644
--- a/src/daemon/SeatManager.h
+++ b/src/daemon/SeatManager.h
@@ -49,6 +49,7 @@ namespace SDDM {
private:
QHash<QString, Seat *> m_seats; //these will exist only for graphical seats
QHash<QString, LogindSeat*> m_systemSeats; //these will exist for all seats
+ void checkSeat(void);
};
}
--
2.32.0

@ -1,3 +1,3 @@
# disable Wayland if modesetting is disabled
RUN+="/usr/bin/rm -f /etc/sddm/hide-wayland-sessions"
IMPORT{cmdline}="nomodeset", RUN+="/usr/bin/touch /etc/sddm/hide-wayland-sessions"
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="zero", RUN+="/usr/bin/touch /etc/sddm/hide-wayland-sessions"
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card[0-9]", RUN+="/usr/bin/rm -f /etc/sddm/hide-wayland-sessions"

@ -24,6 +24,8 @@
# Reboot command
#RebootCommand=/usr/bin/systemctl reboot
# Control x11/wayland startup
# DisplayServer=x11
[Theme]
# Current theme name

@ -50,6 +50,11 @@ Patch103: sddm-0.18.0-environment_file.patch
# https://bugzilla.redhat.com/1952431
Patch104: sddm-0.19.0-allow-hiding-wayland-sessions.patch
# Fix race with logind restart, and start seat0 if !CanGraphical on timer
# https://bugzilla.redhat.com/show_bug.cgi?id=2011991
# https://bugzilla.redhat.com/show_bug.cgi?id=2016310
Patch105: 0001-Delay-for-logind-and-fallback-to-seat0.patch
# Shamelessly stolen from gdm
Source11: sddm.pam
# Shamelessly stolen from gdm

@ -1,3 +1,5 @@
# workaround https://bugzilla.redhat.com/1686675
# see also https://bugreports.qt.io/browse/QTBUG-58508
QML_DISABLE_DISK_CACHE=1
# enable qDebug messages for debug build
# QT_LOGGING_RULES="*.debug=true"

Loading…
Cancel
Save