Commit b0997076 authored by David Edmundson's avatar David Edmundson
Browse files

[startkde] Reset systemd failed units on login

If a service has recently failed multiple times, systemd will (quite
cleverly) not restart it. This includes DBus activation so is indepdent
of the systemd boot.

If a service gets into a broken state on a previous session where ithas
different environment variables and a different display server, we
shouldn't treat it as failed for a new session.

This shouldn't be needed with the other recent fixes, but it seems like
a good practice nevertheless.

Gnome are doing something similar:
https://gitlab.gnome.org/GNOME/gnome-session/-/blob/master/gnome-session/main.c#L565
parent 538ba58d
......@@ -447,6 +447,17 @@ QProcess *setupKSplash()
return p;
}
// If something went on an endless restart crash loop it will get blacklisted, as this is a clean login we will want to reset those counters
// This is independent of whether we use the Plasma systemd boot
void resetSystemdFailedUnits()
{
QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.systemd1"),
QStringLiteral("/org/freedesktop/systemd1"),
QStringLiteral("org.freedesktop.systemd1.Manager"),
QStringLiteral("ResetFailed"));
QDBusConnection::sessionBus().call(message);
}
bool hasSystemdService(const QString &serviceName)
{
auto msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.systemd1"),
......@@ -489,6 +500,7 @@ bool useSystemdBoot()
bool startPlasmaSession(bool wayland)
{
resetSystemdFailedUnits();
OrgKdeKSplashInterface iface(QStringLiteral("org.kde.KSplash"), QStringLiteral("/KSplash"), QDBusConnection::sessionBus());
iface.setStage(QStringLiteral("kinit"));
// finally, give the session control to the session manager
......
......@@ -51,6 +51,7 @@ bool startPlasmaSession(bool wayland);
void waitForKonqi();
static void resetSystemdFailedUnits();
static bool hasSystemdService(const QString &serviceName);
static bool useSystemdBoot();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment