Bug 814690 - User can't be deleted after he logs in and logs out
Summary: User can't be deleted after he logs in and logs out
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 818935 819357 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-20 12:30 UTC by Petr Schindler
Modified: 2018-04-11 08:39 UTC (History)
23 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 818935 (view as bug list)
Environment:
Last Closed: 2014-01-06 13:41:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Screenshot of message after unsuccessful deletion (11.90 KB, image/png)
2012-04-20 12:30 UTC, Petr Schindler
no flags Details
logs (310.14 KB, application/x-gzip)
2012-05-02 11:32 UTC, Kamil Páral
no flags Details
fix up missing new lines (3.92 KB, patch)
2012-05-07 18:09 UTC, Ray Strode [halfline]
no flags Details | Diff
this seems to fix it for me (4.41 KB, patch)
2012-05-07 20:27 UTC, Ray Strode [halfline]
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 804361 0 unspecified CLOSED after run updater gui cant logout/reboot without entering administrator password 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 818935 0 unspecified CLOSED Occasionally can't reboot/power off because "other users are logged in", even though they are not 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 823485 0 unspecified CLOSED When I try to log in, login fails and I get switched to a different VT 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 870208 0 unspecified CLOSED Logoff does not close session so if Restart or Shutdown performed from Logon screen after logoff Authentication dialog p... 2021-02-22 00:41:40 UTC

Internal Links: 804361 818935 823485 870208

Description Petr Schindler 2012-04-20 12:30:17 UTC
Created attachment 578989 [details]
Screenshot of message after unsuccessful deletion

Description of problem:
I have two users - admin and another one. I log in as admin and then I switch user to the second user (from user menu > switch user). Then I log out and go back to admin user. When I try to remove second user (in system settings > user accoungs) it fails and it says that this user is still logged in (see attached screenshot).

When I go to consol (tty2) and log in as the second user and log out again - everything is OK, I can remove this user.

It seems like when I use gnome log out it "forgot" to do some stuff.

Version-Release number of selected component (if applicable):
gnome-session-3.4.1-1.fc17.x86_64
systemd-44-4.fc17.x86_64
gnome-shell-3.4.1-2.fc17.x86_64


How reproducible:
always

Steps to Reproduce:
1. Log in as admin user
2. From user menu choose 'Switch user'
3. Log in as another user
4. Log out
5. Go back to admin user's session
6. In User accounts administration, try to remove user you switched to
  
Actual results:
User can't be deleted because he is still logged in

Expected results:
User should be logged out correctly

Additional info:

Comment 1 Kamil Páral 2012-04-20 12:51:48 UTC
Please note that I hit this issue not just when deleting accounts, but also when trying to poweroff computer - it said some other users are still logged in and required administrative password. But Petr wasn't able to reproduce it. I'll try to reproduce it soon.

Comment 2 Kamil Páral 2012-04-23 14:12:17 UTC
I can reproduce the problem when deleting account in 100%. But I hit the restart/poweroff problem just occasionally. It seems there is no clear reproducer, it depends on some external factors. If you repeat this procedure:

1. Log in as user1 (admin account)
2. Switch to user2 (standard account)
3. Log out from user2, switch back to user1
4. Try to restart/poweroff computer (with or without logging out first)

there is a non-zero change that you'll see a warning "system policy prevents restarting computer while other users are logged in" or similar. If you see this message, it won't go away on subsequent attempts. You have no option but to provide password for the admin account.

The funny thing is that you won't be able to restart/poweroff computer if you are just a standard user and don't know administrative password.

Due to this happening with a non-zero probability (although small), proposing as F17 blocker.

Comment 3 Kamil Páral 2012-04-23 14:15:34 UTC
Also worth noting as that if you run terminal and see 'w' or 'who' output, the user that can't be removed from control-center (because he's supposedly still logged in) is not listed there.

Comment 4 Tim Flink 2012-04-26 20:14:09 UTC
I'm having trouble seeing how this is a blocker - it doesn't seem to violate any of the release criteria and it could be fixed with an update in almost all of the situations I can think of where you'd hit this.

Unless there is something that I'm missing, I'm -1 blocker, -1 NTH on this.

Comment 5 Kamil Páral 2012-04-27 07:55:00 UTC
The offending criterion is:
"All release-blocking desktops' offered mechanisms (if any) for shutting down, logging out and rebooting must work"

Sometimes, just sometimes, you are unable to shut down/reboot computer if you don't have admin privileges. If we fix the underlying issue (that can be 100% reproduced when trying to delete the user), I believe this 'shut down' issue will be fixed as well.

Comment 6 Matthias Clasen 2012-04-27 21:19:54 UTC
Here is what I see in /var/log/gdm/:1-greeter.log after the shell crashed on the switch-user login screen:


   JS ERROR: !!!   Exception was: Error: Error invoking Gio.init: Error calling StartServiceByName for net.reactivated.Fprint: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 157
    JS ERROR: !!!     lineNumber = '0'
    JS ERROR: !!!     fileName = '"gjs_throw"'
    JS ERROR: !!!     stack = '"("Error invoking Gio.init: Error calling StartServiceByName for net.reactivated.Fprint: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 157")@gjs_throw:0
(null)@/usr/share/gjs-1.0/overrides/Gio.js:242
([object _private_Gio_DBusConnection],"net.reactivated.Fprint","/net/reactivated/Fprint/Manager")@/usr/share/gjs-1.0/overrides/Gio.js:201
FprintManager()@/usr/share/gnome-shell/js/gdm/fingerprint.js:19
()@/usr/share/gnome-shell/js/gdm/loginDialog.js:776
wrapper()@/usr/share/gjs-1.0/lang.js:204
()@/usr/share/gjs-1.0/lang.js:145
()@/usr/share/gjs-1.0/lang.js:239
_createGDMSession()@/usr/share/gnome-shell/js/ui/main.js:96
start()@/usr/share/gnome-shell/js/ui/main.js:221

Comment 7 Matthias Clasen 2012-04-28 01:44:21 UTC
Filed a patch upstream: https://bugzilla.redhat.com//show_bug.cgi?id=814690

Comment 8 Matthias Clasen 2012-04-30 12:31:19 UTC
http://bugzilla.gnome.org/show_bug.cgi?id=675006

Comment 9 Kamil Páral 2012-05-02 11:21:47 UTC
Matthias, are you sure this is the same bug? It happened for me right now on a machine with just a single user created. I can't reboot until I provide admin password. When I log as root into tty3 and run 'who', I see just root on tty3 and '(unknown)' on ':0'. I don't see any shell crashes in gdm logs.

Comment 10 Kamil Páral 2012-05-02 11:32:32 UTC
Created attachment 581585 [details]
logs

$ who
(unknown) :0           2012-05-09 12:07 (:0)
root     tty3         2012-05-09 12:08

Attaching logs as a compressed archive, there's quite lot of them. Unfortunately my system date was a bit messed up (set a week in advance), that might be confusing.

Comment 11 Matthias Clasen 2012-05-02 13:51:36 UTC
No, quite likely that there is a different issue in play here.
I may have also simply confused this bug with a different one that talked about shell crashes on logout...

Comment 12 collura 2012-05-03 05:37:54 UTC
this at least seems related or maybe duplicate even 
where for me seems to have something to do with updater:

  https://bugzilla.redhat.com/show_bug.cgi?id=804361
  "after run updater gui cant logout/reboot without 
   entering administrator password"

Comment 13 Kamil Páral 2012-05-03 17:18:48 UTC
I can't reproduce bug 804361. Don't know whether it is related.

Comment 14 Matthias Clasen 2012-05-03 17:22:24 UTC
c'ing Richard, then.

One useful piece of data would be the output of systemd-loginctl list-sessions

Comment 15 Adam Williamson 2012-05-03 17:38:07 UTC
Discussed at 2012-05-03 blocker review meeting. Agreed that this seems a bit corner case-y, but we will punt at least a week for more data. Obviously inability to shutdown without root password is bad, but unless it can be reproduced more reliably, probably not bad enough to constitute criteria breakage.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 16 Matthias Clasen 2012-05-03 17:42:07 UTC
Looks like a deja-dup bug - it leaves a process behind running as the user,
which causes userdel to refuse to delete it. The process is deja-dup-monitor

Comment 17 Matthias Clasen 2012-05-03 17:56:17 UTC
intentionally:

http://bazaar.launchpad.net/~deja-dup-hackers/deja-dup/24/view/head:/monitor/README 

accountsservice has been changed to delete users with prejudice now:

http://cgit.freedesktop.org/accountsservice/commit/?id=c5905497733bebf9936a7b028a11ca87caf2d71f

Comment 18 Kamil Páral 2012-05-03 18:06:44 UTC
OK, that will fix user deletion, but won't fix reboot issues. Once I hit that one again, I'll have a look at the process list and hopefully I can find out whether deja-dup-monitor is also responsible for that or not. I'll also gather 'systemd-loginctl list-sessions' output.

Feel free to close this bug with that accountsservice fix and I'll create a new one if needed for the reboot issue.

Comment 19 Fedora Update System 2012-05-03 20:47:25 UTC
accountsservice-0.6.19-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/accountsservice-0.6.19-1.fc17

Comment 20 Fedora Update System 2012-05-04 03:11:26 UTC
Package accountsservice-0.6.19-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing accountsservice-0.6.19-1.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-7276/accountsservice-0.6.19-1.fc17
then log in and leave karma (feedback).

Comment 21 Andre Robatino 2012-05-04 05:45:57 UTC
After applying accountsservice-0.6.19-1.fc17, my ordinary user name is no longer shown at the GDM prompt. I must use "Not listed?" to log in.

Comment 22 Matthias Clasen 2012-05-04 10:52:19 UTC
This is caused by the FALSE -> TRUE change in

http://cgit.freedesktop.org/accountsservice/commit/?id=046998a3a5305f381e6e39bc4bf7f69f260856f4

we explicitly call daemon_local_user_is_excluded with a NULL shell when dealing with wtmp entries...

Comment 23 Kamil Páral 2012-05-04 12:35:33 UTC
I have cloned this bug into bug 818935. This one will be used for user deletion issues. Bug 818935 will be used for reboot/poweroff issues.

Comment 24 Kamil Páral 2012-05-04 12:54:07 UTC
(In reply to comment #22)
> This is caused by the FALSE -> TRUE change in
> 
> http://cgit.freedesktop.org/accountsservice/commit/?id=046998a3a5305f381e6e39bc4bf7f69f260856f4
> 
> we explicitly call daemon_local_user_is_excluded with a NULL shell when dealing
> with wtmp entries...

Matthias, there must be a bug somewhere. See feedback on the Bodhi page. Definitely broken.

Comment 25 Adam Williamson 2012-05-04 12:56:58 UTC
Dropping the F17Blocker nomination from this bug, as it's the logout issue that is nominated as a blocker, and also making it not 'block' the clone (I _hate_ how clones are always considered to be blocked by the bug they're cloned from).



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 26 Kamil Páral 2012-05-04 13:30:02 UTC
(In reply to comment #16)
> Looks like a deja-dup bug - it leaves a process behind running as the user,
> which causes userdel to refuse to delete it. The process is deja-dup-monitor

One more thing. It is true that sometimes deja-dup-monitor keeps running even after logout. But usually it is not. However the user still can't be deleted. I have confirmed that no process is running under that user and it still can't be deleted. I believe the bug is somewhere else, not with deja-dup-monitor. Matthias, can you try a few more times to reproduce without deja-dup-monitor running?

Further question: Is there a reason not to kill all user process when he logs out? Being able to delete logged in users (userdel -f) might not be the best solution here.

Comment 27 Fedora Update System 2012-05-04 14:44:27 UTC
accountsservice-0.6.20-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/accountsservice-0.6.20-1.fc17

Comment 28 Kamil Páral 2012-05-04 15:08:12 UTC
accountsservice-0.6.20-1.fc17 does not fix bug 814690, the error dialog (see bz attachment) is still shown and user is not deleted. There is probably some other check before userdel is called. But I still wonder whether using using userdel --force is the right solution for this.

Comment 29 Ray Strode [halfline] 2012-05-04 15:59:54 UTC
well using --force isn't the right solution for this, it was just a potentially convenient work around until we figured out the right solution. but it's not even a good work around before of the error dialog.

Comment 30 Ray Strode [halfline] 2012-05-04 19:46:07 UTC
This seems to be a GDM problem.  GDM notices gnome-session exiting, and then starts to clean things up in its slave code.  when that finishes the slave code forcefully kills the session worker process before pam_close_session can finish.

Still investigating.

Comment 31 Fedora Update System 2012-05-04 22:16:05 UTC
Package accountsservice-0.6.20-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing accountsservice-0.6.20-1.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-7308/accountsservice-0.6.20-1.fc17
then log in and leave karma (feedback).

Comment 32 Ray Strode [halfline] 2012-05-06 05:59:56 UTC
disregard comment 31

Comment 33 Ray Strode [halfline] 2012-05-06 06:10:59 UTC
So the GDM problem is real, and I commited a fix here:

http://git.gnome.org/browse/gdm/commit/?id=09358813114e1c16b1ea02d80327e418a1809486

But it's not the only problem.  Actually pam_systemd just does 

close() on an fd to in pam_close_session() so that's very, very fast.  I wouldn't be surprised if under normal conditions the GDM bug doesn't manifest quickly enough to actually be a problem.

Now there are two other problems:

1) after logout pulseaudio sticks around for some seconds . This isn't a big deal, except it means that when systemd notices the session going away it sees pulseaudio still running and marks the session in a "lingering" state

2) when pulseaudio goes away, the cgroup logind setup notifies logind (via systemd-cgroups-agent) that the user session is finally done, and then logind looks for the state associated with the session to mop it up (using a function called manager_get_session_by_cgroup()).  It can't find it, though, because that cgroup got ripped out the cgroups hashtable when the user logged out (seconds before pulseaudio exited).  At least that what I think is happening. I haven't verified all my assumptions yet.

Comment 34 Lennart Poettering 2012-05-07 16:10:44 UTC
Hmm, if this happens, what is the contents of /run/systemd/users/$UID, where $UID is the numeric uid of the user in question?

In that file we store the ids of all open sessions of a user. It appears that this file might be invalid, if a process ends up staying around with the session officially dead?

Comment 35 Ray Strode [halfline] 2012-05-07 16:14:39 UTC
# This is private data. Do not parse.
NAME=johnny
STATE=online
CGROUP=/user/johnny
RUNTIME=/run/user/johnny
SESSIONS=36
SEATS=seat0
ACTIVE_SESSIONS=ACTIVE_SEATS=

Note the last two keys are munged together into one line

Comment 36 Ray Strode [halfline] 2012-05-07 18:09:25 UTC
Created attachment 582752 [details]
fix up missing new lines

This patch fixes up the obvious lack of newlines in the file.

It's not sufficient to fix the problem, though.

Comment 37 Matthias Clasen 2012-05-07 18:10:07 UTC
*** Bug 819357 has been marked as a duplicate of this bug. ***

Comment 38 Ray Strode [halfline] 2012-05-07 18:36:45 UTC
The problem, I guess, is  /run/systemd/users/$UID won't ever get updated when the cgroup finally empties.

Comment 39 Lennart Poettering 2012-05-07 18:39:54 UTC
Ray, normally the file should actually already be deleted at that point. I am sure there's something even more broken in logind.

Comment 40 Ray Strode [halfline] 2012-05-07 19:54:55 UTC
attachment 582752 [details] needs-work, the macro changes were wrong.

Comment 41 Ray Strode [halfline] 2012-05-07 20:27:59 UTC
Created attachment 582782 [details]
this seems to fix it for me

Comment 42 Ray Strode [halfline] 2012-05-08 15:20:01 UTC
*** Bug 818935 has been marked as a duplicate of this bug. ***

Comment 43 Ray Strode [halfline] 2012-05-22 14:47:57 UTC
See bug 823485 for a related issue.

Comment 44 Lennart Poettering 2012-05-22 14:49:27 UTC
I fixed the state file write out in git now, that stuff was seriously borked. But there's more to fix...

Comment 45 Ray Strode [halfline] 2012-05-25 20:40:05 UTC
(for reference that's http://cgit.freedesktop.org/systemd/systemd/commit/?id=9b958eff3fbcc345a72315a9167f6217dd841c40 )

Comment 46 Fedora Update System 2012-06-12 14:58:27 UTC
accountsservice-0.6.21-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/accountsservice-0.6.21-1.fc17

Comment 47 Fedora Update System 2012-06-15 00:29:37 UTC
Package accountsservice-0.6.21-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing accountsservice-0.6.21-1.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-9407/accountsservice-0.6.21-1.fc17
then log in and leave karma (feedback).

Comment 48 Mace Moneta 2012-06-18 01:57:28 UTC
accountsservice-0.6.21-1.fc17 doesn't fix the problem for me.  I still get prompted to authenticate for shutdown.

Comment 49 Fedora Update System 2012-06-28 16:11:29 UTC
accountsservice-0.6.21-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/accountsservice-0.6.21-2.fc17

Comment 50 Lennart Poettering 2012-09-14 14:42:39 UTC
I assume this is fixed now. Closing.

Comment 51 Kamil Páral 2012-09-16 19:28:13 UTC
It is almost fixed in F17. If I log in and log out as 'tester' user, one process survives:
/usr/bin/pulseaudio --start
But it quits after ~15 seconds, so the user can be deleted pretty soon.

The situation is much worse in F18. After I log in and log out as 'tester' user, I see following processes still running:
/usr/bin/pulseaudio --start
/usr/bin/spice-vdagent
/usr/libexec/deja-dup/deja-dup-monitor
/usr/libexec/tracker-store
/usr/libexec/tracker-miner-fs

The big problem is that those processes don't end (I waited ~10 minutes), so the user can't be deleted without reboot (or manually killing them).

Also, "loginctl list-sessions" lists 'tester' as active at seat0. Neither 'w' nor 'who' list 'tester'.

Reopening for F18.

systemd-188-3.fc18.i686
acountsservice-0.6.22-3.fc18.i686

Comment 52 Fedora End Of Life 2013-12-21 15:02:00 UTC
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 53 Kamil Páral 2014-01-06 13:41:07 UTC
I did a quick test and it seems to be fixed in Fedora 20.


Note You need to log in before you can comment on or make changes to this bug.