Switchuser Issue

Rainer Dorsch ml at bokomoko.de
Tue May 15 15:12:25 UTC 2018


Hi,

I digged a little further:

On Dienstag, 15. Mai 2018 09:02:52 CEST Rainer Dorsch wrote:
> Hi,
> 
> I have an issue with switch user in ksmserver on my newly installed Debian
> buster system (plama-workspaces 5.12.5):
> 
> When I try to swich user, I get the switchuser dialog displayed, but when I
> click on switch, I get to my own session's lockscreen. This doesn't seem to
> be a general issue, there is at least one person on #debian-kde who reports
> that switching users works for him.
> 
> I traced the code and ended up in
> 
> /usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/userswitcher
> / UserSwitcher.qml

That gets executed, modifying the text of a button took effect, nice that it 
is a scripting language... :-)

 
> Since I am not an qml writer (or reader ;-) I was so far not able to find
> out what
> 
> sessionsModel.switchUser(block.userListCurrentModelData.vtNumber,
> sessionsModel.shouldLock)
> 
> does. As a first test, can I add a log statement to test, if that line in
> the code is really reached (maybe just log to /tmp/switchuserdebug.log)?
> 
> Any idea is welcome.

..and I am back in sessionsmodel.cpp

it seems there are a few return statements which effectively (as I understand 
it) simply skip the switch user. That is what I actually see.

void SessionsModel::switchUser(int vt, bool shouldLock)
{
    if (vt < 0) {
        startNewSession(shouldLock);
        return;
    }

    if (!canSwitchUser()) {
        return;
    }

    if (!shouldLock) {
        m_displayManager.switchVT(vt);
        emit switchedUser(vt);
        return;
    }

    checkScreenLocked([this, vt](bool locked) {
        if (locked) {
            // already locked, switch right away
            m_displayManager.switchVT(vt);
            emit switchedUser(vt);
        } else {
            m_pendingReserve = false;
            m_pendingVt = vt;

            emit aboutToLockScreen();
            m_screensaverInterface->Lock();
        }
    });
}

In particular I suspect that the 

    if (!canSwitchUser()) {
        return;
    }

is executed:

bool SessionsModel::canSwitchUser() const
{
    return const_cast<SessionsModel *>(this)->m_displayManager.isSwitchable() 
&& KAuthorized::authorizeAction(QLatin1String("switch_user"));
}

Unfortunately, for me it is not clear, what could 
KAuthorized::authorizeAction(QLatin1String("switch_user") make false or how I 
can validate if SessionsModel *>(this)->m_displayManager.isSwitchable() is 
true.

Looking at isSwitchable:

bool
KDisplayManager::isSwitchable()
{
    if (DMType == NewGDM || DMType == LightDM) {
        QDBusObjectPath currentSeat;
        if (getCurrentSeat(0, &currentSeat)) {
            SystemdSeat SDseat(currentSeat);
            if (SDseat.isValid()) {
                QVariant prop = SDseat.property("CanMultiSession");
                if (prop.isValid())
                    return prop.toBool();
            }
            CKSeat CKseat(currentSeat);
            if (CKseat.isValid()) {
                QDBusReply<bool> r = 
CKseat.call(QStringLiteral("CanActivateSessions"));
                if (r.isValid())
                    return r.value();
            }
        }
        return false;
    }

    if (DMType == OldKDM)
        return dpy[0] == ':';

    if (DMType == OldGDM)
        return exec("QUERY_VT\n");

    QByteArray re;

    return exec("caps\n", re) && re.indexOf("\tlocal") >= 0;
}

Is sddm covered here?

Trying with lightDM as default display manager....and the problem goes away 
:-)

Is it true that sddm is not supported? I am surprised since switchuser worked 
with sddm for me in Debian Stretch (plasma-5.8.6)?

Also it would helped me tremendously, if a log entry (or even a pop-up 
message...) would have been produced instead of a silent failure.... It seems 
that would not add a lot of code...

Thanks
Rainer

-- 
Rainer Dorsch





More information about the Plasma-devel mailing list