[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: usermod and systemd



Am 2015-03-11 11:31, schrieb Martin Read:
On 11/03/15 02:49, Roberto De Oliveira wrote:
I have a weird behavior on my system, I'm trying to change a home
directory with "usermod -d newhome foo" but the system denies because
"usermod: user foo is currently used by process XXXX", when I look for
PID XXXX I see "/lib/systemd/systemd --user". Does anyone knows why this
is happening? How I fix it?

That process is a session instance of systemd, which (in general)
indicates that the user in question is logged in to the system.
usermod would appear to be (quite rightly, IMO!) refusing to change a
user's home directory while that user is logged in.

I would expect that you can resolve this by closing all of that user's
login sessions before changing their home directory.

Either the user is still logged in, or there is still a process running from a previous login session, which keeps the systemd --user instance active.

Please check with ps, if you have any such processes belonging to that user. If you stop them, the systemd --user instance should go away.

"loginctl lists-sessions" will tell you about active logind sessions.
"loginctl user-status <username>" will give you more information about active sessions (including processes) for a given user "systemd-cgls" can be used to inspect the process tree. If you look for a user-<uid>.slice, it show your systemd-user instance and the existing session scopes.


HTH,
Michael


Reply to: