@@ -0,0 +1,212 @@
|
||||
From adfaa222fdfa6115ea2b320b0bbc2126db9270a5 Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Date: Thu, 12 Nov 2020 20:30:55 +0100
|
||||
Subject: [PATCH 1/3] Retry starting the display server
|
||||
|
||||
Even if the CanGraphical property of a Seat is true, it's possible that it's
|
||||
still too early for X to start, as it might need some driver or device which
|
||||
isn't present yet.
|
||||
|
||||
Fixes #1316
|
||||
---
|
||||
src/daemon/Seat.cpp | 23 ++++++++++++++++++-----
|
||||
src/daemon/Seat.h | 4 +++-
|
||||
src/daemon/XorgDisplayServer.cpp | 10 ++++++----
|
||||
3 files changed, 27 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/Seat.cpp b/src/daemon/Seat.cpp
|
||||
index eef26da45..838c2221d 100644
|
||||
--- a/src/daemon/Seat.cpp
|
||||
+++ b/src/daemon/Seat.cpp
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
+#include <QTimer>
|
||||
|
||||
#include <functional>
|
||||
|
||||
@@ -52,7 +53,7 @@ namespace SDDM {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
- bool Seat::createDisplay(int terminalId) {
|
||||
+ void Seat::createDisplay(int terminalId) {
|
||||
//reload config if needed
|
||||
mainConfig.load();
|
||||
|
||||
@@ -84,12 +85,24 @@ namespace SDDM {
|
||||
m_displays << display;
|
||||
|
||||
// start the display
|
||||
- if (!display->start()) {
|
||||
- qCritical() << "Could not start Display server on vt" << terminalId;
|
||||
- return false;
|
||||
+ startDisplay(display);
|
||||
+ }
|
||||
+
|
||||
+ void Seat::startDisplay(Display *display, int tryNr) {
|
||||
+ if (display->start())
|
||||
+ return;
|
||||
+
|
||||
+ // It's possible that the system isn't ready yet (driver not loaded,
|
||||
+ // device not enumerated, ...). It's not possible to tell when that changes,
|
||||
+ // so try a few times with a delay in between.
|
||||
+ qWarning() << "Attempt" << tryNr << "starting the Display server on vt" << display->terminalId() << "failed";
|
||||
+
|
||||
+ if(tryNr >= 3) {
|
||||
+ qCritical() << "Could not start Display server on vt" << display->terminalId();
|
||||
+ return;
|
||||
}
|
||||
|
||||
- return true;
|
||||
+ QTimer::singleShot(2000, display, [=] { startDisplay(display, tryNr + 1); });
|
||||
}
|
||||
|
||||
void Seat::removeDisplay(Display* display) {
|
||||
diff --git a/src/daemon/Seat.h b/src/daemon/Seat.h
|
||||
index bf22566b7..f9fe7331f 100644
|
||||
--- a/src/daemon/Seat.h
|
||||
+++ b/src/daemon/Seat.h
|
||||
@@ -35,13 +35,15 @@ namespace SDDM {
|
||||
const QString &name() const;
|
||||
|
||||
public slots:
|
||||
- bool createDisplay(int terminalId = -1);
|
||||
+ void createDisplay(int terminalId = -1);
|
||||
void removeDisplay(SDDM::Display* display);
|
||||
|
||||
private slots:
|
||||
void displayStopped();
|
||||
|
||||
private:
|
||||
+ void startDisplay(SDDM::Display *display, int tryNr = 1);
|
||||
+
|
||||
QString m_name;
|
||||
|
||||
QVector<Display *> m_displays;
|
||||
diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp
|
||||
index e60c02210..5f40fe8c3 100644
|
||||
--- a/src/daemon/XorgDisplayServer.cpp
|
||||
+++ b/src/daemon/XorgDisplayServer.cpp
|
||||
@@ -248,6 +248,12 @@ namespace SDDM {
|
||||
}
|
||||
|
||||
void XorgDisplayServer::finished() {
|
||||
+ // clean up
|
||||
+ if (process) {
|
||||
+ process->deleteLater();
|
||||
+ process = nullptr;
|
||||
+ }
|
||||
+
|
||||
// check flag
|
||||
if (!m_started)
|
||||
return;
|
||||
@@ -283,10 +289,6 @@ namespace SDDM {
|
||||
displayStopScript->deleteLater();
|
||||
displayStopScript = nullptr;
|
||||
|
||||
- // clean up
|
||||
- process->deleteLater();
|
||||
- process = nullptr;
|
||||
-
|
||||
// remove authority file
|
||||
QFile::remove(m_authPath);
|
||||
|
||||
|
||||
From d11e1e987b440fa1aaa741719b92472eeee79b17 Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Date: Wed, 9 Dec 2020 19:28:41 +0100
|
||||
Subject: [PATCH 2/3] Explicitly stop Xorg when starting fails
|
||||
|
||||
When Xorg starts but there is an error, stop it explicitly instead of assuming
|
||||
that X exits itself. This avoids a possibly lingering Xorg process in the
|
||||
XorgDisplayServer instance. Add a check and warning message if Xorg is
|
||||
restarted too early (shouldn't happen).
|
||||
---
|
||||
src/daemon/XorgDisplayServer.cpp | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp
|
||||
index 5f40fe8c3..3a7bee0d8 100644
|
||||
--- a/src/daemon/XorgDisplayServer.cpp
|
||||
+++ b/src/daemon/XorgDisplayServer.cpp
|
||||
@@ -118,6 +118,11 @@ namespace SDDM {
|
||||
if (m_started)
|
||||
return false;
|
||||
|
||||
+ if (process) {
|
||||
+ qCritical() << "Tried to start Xorg before previous instance exited";
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
// create process
|
||||
process = new QProcess(this);
|
||||
|
||||
@@ -195,6 +200,7 @@ namespace SDDM {
|
||||
qCritical("Failed to open pipe to start X Server");
|
||||
|
||||
close(pipeFds[0]);
|
||||
+ stop();
|
||||
return false;
|
||||
}
|
||||
QByteArray displayNumber = readPipe.readLine();
|
||||
@@ -203,6 +209,7 @@ namespace SDDM {
|
||||
qCritical("Failed to read display number from pipe");
|
||||
|
||||
close(pipeFds[0]);
|
||||
+ stop();
|
||||
return false;
|
||||
}
|
||||
displayNumber.prepend(QByteArray(":"));
|
||||
@@ -219,6 +226,7 @@ namespace SDDM {
|
||||
if(m_display != QStringLiteral(":0")) {
|
||||
if(!addCookie(m_authPath)) {
|
||||
qCritical() << "Failed to write xauth file";
|
||||
+ stop();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -232,8 +240,7 @@ namespace SDDM {
|
||||
}
|
||||
|
||||
void XorgDisplayServer::stop() {
|
||||
- // check flag
|
||||
- if (!m_started)
|
||||
+ if (!process)
|
||||
return;
|
||||
|
||||
// log message
|
||||
|
||||
From 78048b22e3988d3daec9c271883fa114abc114dc Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Date: Wed, 9 Dec 2020 19:33:08 +0100
|
||||
Subject: [PATCH 3/3] Emit XorgDisplayServer::started only when the auth file
|
||||
is ready
|
||||
|
||||
---
|
||||
src/daemon/XorgDisplayServer.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp
|
||||
index 3a7bee0d8..331adcda7 100644
|
||||
--- a/src/daemon/XorgDisplayServer.cpp
|
||||
+++ b/src/daemon/XorgDisplayServer.cpp
|
||||
@@ -219,8 +219,6 @@ namespace SDDM {
|
||||
// close our pipe
|
||||
close(pipeFds[0]);
|
||||
|
||||
- emit started();
|
||||
-
|
||||
// The file is also used by the greeter, which does care about the
|
||||
// display number. Write the proper entry, if it's different.
|
||||
if(m_display != QStringLiteral(":0")) {
|
||||
@@ -232,6 +230,8 @@ namespace SDDM {
|
||||
}
|
||||
changeOwner(m_authPath);
|
||||
|
||||
+ emit started();
|
||||
+
|
||||
// set flag
|
||||
m_started = true;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From 5fd5ed271a0e5b8c8857cc4f5f2084d43fd228f1 Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Date: Mon, 9 Nov 2020 11:22:15 +0100
|
||||
Subject: [PATCH] Only use the base name for $DESKTOP_SESSION
|
||||
|
||||
Other DMs don't use the path.
|
||||
|
||||
Fixes #852
|
||||
---
|
||||
src/common/Session.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/common/Session.cpp b/src/common/Session.cpp
|
||||
index 2d7b04f19..3de28ef13 100644
|
||||
--- a/src/common/Session.cpp
|
||||
+++ b/src/common/Session.cpp
|
||||
@@ -89,7 +89,7 @@ namespace SDDM {
|
||||
|
||||
QString Session::desktopSession() const
|
||||
{
|
||||
- return fileName().replace(s_entryExtention, QString());
|
||||
+ return QFileInfo(m_fileName).completeBaseName();
|
||||
}
|
||||
|
||||
QString Session::desktopNames() const
|
||||
@@ -0,0 +1,171 @@
|
||||
From 68cc9e31d1a4c4609f42114782fc485cb07353a4 Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||||
Date: Fri, 9 Oct 2020 21:06:01 +0200
|
||||
Subject: [PATCH] Merge normal and testing paths in XorgDisplayServer::start
|
||||
|
||||
They have much in common and this means that Xephyr can also make use use
|
||||
of -displayfd now.
|
||||
---
|
||||
src/daemon/XorgDisplayServer.cpp | 132 ++++++++++++++-----------------
|
||||
1 file changed, 60 insertions(+), 72 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp
|
||||
index d5f29a94a..e60c02210 100644
|
||||
--- a/src/daemon/XorgDisplayServer.cpp
|
||||
+++ b/src/daemon/XorgDisplayServer.cpp
|
||||
@@ -136,95 +136,83 @@ namespace SDDM {
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (daemonApp->testing()) {
|
||||
- QStringList args;
|
||||
- QDir x11socketDir(QStringLiteral("/tmp/.X11-unix"));
|
||||
- int display = 100;
|
||||
- while (x11socketDir.exists(QStringLiteral("X%1").arg(display))) {
|
||||
- ++display;
|
||||
- }
|
||||
- m_display = QStringLiteral(":%1").arg(display);
|
||||
- args << m_display << QStringLiteral("-auth") << m_authPath << QStringLiteral("-br") << QStringLiteral("-noreset") << QStringLiteral("-screen") << QStringLiteral("800x600");
|
||||
- process->start(mainConfig.X11.XephyrPath.get(), args);
|
||||
-
|
||||
-
|
||||
- // wait for display server to start
|
||||
- if (!process->waitForStarted()) {
|
||||
- // log message
|
||||
- qCritical() << "Failed to start display server process.";
|
||||
+ // set process environment
|
||||
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
+ env.insert(QStringLiteral("XCURSOR_THEME"), mainConfig.Theme.CursorTheme.get());
|
||||
+ process->setProcessEnvironment(env);
|
||||
|
||||
- // return fail
|
||||
- return false;
|
||||
- }
|
||||
- emit started();
|
||||
- } else {
|
||||
- // set process environment
|
||||
- QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
- env.insert(QStringLiteral("XCURSOR_THEME"), mainConfig.Theme.CursorTheme.get());
|
||||
- process->setProcessEnvironment(env);
|
||||
-
|
||||
- //create pipe for communicating with X server
|
||||
- //0 == read from X, 1== write to from X
|
||||
- int pipeFds[2];
|
||||
- if (pipe(pipeFds) != 0) {
|
||||
- qCritical("Could not create pipe to start X server");
|
||||
- }
|
||||
+ //create pipe for communicating with X server
|
||||
+ //0 == read from X, 1== write to from X
|
||||
+ int pipeFds[2];
|
||||
+ if (pipe(pipeFds) != 0) {
|
||||
+ qCritical("Could not create pipe to start X server");
|
||||
+ }
|
||||
|
||||
- // start display server
|
||||
- QStringList args = mainConfig.X11.ServerArguments.get().split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
- args << QStringLiteral("-auth") << m_authPath
|
||||
+ // start display server
|
||||
+ QStringList args;
|
||||
+ if (!daemonApp->testing()) {
|
||||
+ process->setProgram(mainConfig.X11.ServerPath.get());
|
||||
+ args << mainConfig.X11.ServerArguments.get().split(QLatin1Char(' '), QString::SkipEmptyParts)
|
||||
<< QStringLiteral("-background") << QStringLiteral("none")
|
||||
- << QStringLiteral("-noreset")
|
||||
- << QStringLiteral("-displayfd") << QString::number(pipeFds[1])
|
||||
<< QStringLiteral("-seat") << displayPtr()->seat()->name();
|
||||
|
||||
if (displayPtr()->seat()->name() == QLatin1String("seat0")) {
|
||||
args << QStringLiteral("vt%1").arg(displayPtr()->terminalId());
|
||||
}
|
||||
- qDebug() << "Running:"
|
||||
- << qPrintable(mainConfig.X11.ServerPath.get())
|
||||
- << qPrintable(args.join(QLatin1Char(' ')));
|
||||
- process->start(mainConfig.X11.ServerPath.get(), args);
|
||||
-
|
||||
- // wait for display server to start
|
||||
- if (!process->waitForStarted()) {
|
||||
- // log message
|
||||
- qCritical() << "Failed to start display server process.";
|
||||
-
|
||||
- // return fail
|
||||
- close(pipeFds[0]);
|
||||
- return false;
|
||||
- }
|
||||
+ } else {
|
||||
+ process->setProgram(mainConfig.X11.XephyrPath.get());
|
||||
+ args << QStringLiteral("-br")
|
||||
+ << QStringLiteral("-screen") << QStringLiteral("800x600");
|
||||
+ }
|
||||
|
||||
- // close the other side of pipe in our process, otherwise reading
|
||||
- // from it may stuck even X server exit.
|
||||
- close(pipeFds[1]);
|
||||
+ args << QStringLiteral("-auth") << m_authPath
|
||||
+ << QStringLiteral("-noreset")
|
||||
+ << QStringLiteral("-displayfd") << QString::number(pipeFds[1]);
|
||||
|
||||
- QFile readPipe;
|
||||
+ process->setArguments(args);
|
||||
+ qDebug() << "Running:"
|
||||
+ << qPrintable(process->program())
|
||||
+ << qPrintable(process->arguments().join(QLatin1Char(' ')));
|
||||
+ process->start();
|
||||
|
||||
- if (!readPipe.open(pipeFds[0], QIODevice::ReadOnly)) {
|
||||
- qCritical("Failed to open pipe to start X Server");
|
||||
+ // wait for display server to start
|
||||
+ if (!process->waitForStarted()) {
|
||||
+ // log message
|
||||
+ qCritical() << "Failed to start display server process.";
|
||||
|
||||
- close(pipeFds[0]);
|
||||
- return false;
|
||||
- }
|
||||
- QByteArray displayNumber = readPipe.readLine();
|
||||
- if (displayNumber.size() < 2) {
|
||||
- // X server gave nothing (or a whitespace).
|
||||
- qCritical("Failed to read display number from pipe");
|
||||
+ // return fail
|
||||
+ close(pipeFds[0]);
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
- close(pipeFds[0]);
|
||||
- return false;
|
||||
- }
|
||||
- displayNumber.prepend(QByteArray(":"));
|
||||
- displayNumber.remove(displayNumber.size() -1, 1); // trim trailing whitespace
|
||||
- m_display = QString::fromLocal8Bit(displayNumber);
|
||||
+ // close the other side of pipe in our process, otherwise reading
|
||||
+ // from it may stuck even X server exit.
|
||||
+ close(pipeFds[1]);
|
||||
+
|
||||
+ QFile readPipe;
|
||||
+
|
||||
+ if (!readPipe.open(pipeFds[0], QIODevice::ReadOnly)) {
|
||||
+ qCritical("Failed to open pipe to start X Server");
|
||||
|
||||
- // close our pipe
|
||||
close(pipeFds[0]);
|
||||
+ return false;
|
||||
+ }
|
||||
+ QByteArray displayNumber = readPipe.readLine();
|
||||
+ if (displayNumber.size() < 2) {
|
||||
+ // X server gave nothing (or a whitespace).
|
||||
+ qCritical("Failed to read display number from pipe");
|
||||
|
||||
- emit started();
|
||||
+ close(pipeFds[0]);
|
||||
+ return false;
|
||||
}
|
||||
+ displayNumber.prepend(QByteArray(":"));
|
||||
+ displayNumber.remove(displayNumber.size() -1, 1); // trim trailing whitespace
|
||||
+ m_display = QString::fromLocal8Bit(displayNumber);
|
||||
+
|
||||
+ // close our pipe
|
||||
+ close(pipeFds[0]);
|
||||
+
|
||||
+ emit started();
|
||||
|
||||
// The file is also used by the greeter, which does care about the
|
||||
// display number. Write the proper entry, if it's different.
|
||||
@@ -25,7 +25,7 @@
|
||||
<Dependency>dejavu-fonts</Dependency>
|
||||
<Dependency>elogind-devel</Dependency>
|
||||
<Dependency>qt5-base-devel</Dependency>
|
||||
<Dependency>python-docutils</Dependency>
|
||||
<Dependency>python3-docutils</Dependency>
|
||||
<Dependency>fontconfig-devel</Dependency>
|
||||
<Dependency>libxkbfile-devel</Dependency>
|
||||
<Dependency>extra-cmake-modules</Dependency>
|
||||
@@ -40,8 +40,11 @@
|
||||
<Patch>pam-faillock.patch</Patch>
|
||||
<Patch>sddm-fix-race-pre.patch</Patch>
|
||||
<Patch>sddm-fix-race.patch</Patch-->
|
||||
<Patch>sddm-0.19.0-consolidate-1.patch</Patch>
|
||||
<!-- <Patch>sddm-0.19.0-consolidate-1.patch</Patch> -->
|
||||
<Patch>0002-sddm-fix-build.patch</Patch>
|
||||
<Patch level="1">68cc9e31.patch</Patch>
|
||||
<Patch>1324.patch</Patch>
|
||||
<Patch>5fd5ed27.patch</Patch>
|
||||
</Patches>
|
||||
</Source>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user