You are not logged in.

#1 2025-05-25 15:28:41

gabx
Member
From: Geneva, Switzerland
Registered: 2011-11-20
Posts: 203
Website

[SOLVED] remove systemd-homed users

I recently tried to migrate my user to a systemd-homed managed one. The migration went wrong and had some issues. Hopefully, everything was backup and I am back with a fully working system.
I would like to get rid of the systemd-homed users I have created, as they don't have any more reason to exist.

gabx@magnolia ➤➤ ~ % homectl list
NAME UID   GID   STATE    REALNAME           HOME       SHELL
gab  60060 60060 inactive gab                /home/gab  /usr/bin/zsh
gabx 1000  1000  inactive /home/gabx.homedir /home/gabx /usr/bin/zsh

2 home areas listed.
[root@magnolia gabxnew]# homectl remove gab
Failed to remove home: Home gab is currently being used, or an operation on home gab is currently being executed.
[root@magnolia gabxnew]# lsof /home/gab
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc
      Output information may be incomplete.
[root@magnolia gabxnew]# systemctl status systemd-homed
● systemd-homed.service - Home Area Manager
     Loaded: loaded (/usr/lib/systemd/system/systemd-homed.service; disabled; preset: enabled)
     Active: active (running) since Sun 2025-05-25 17:22:10 CEST; 6min ago
 Invocation: 8b724c8ecb814dd2bc0ff090396bf250
       Docs: man:systemd-homed.service(8)
             man:org.freedesktop.home1(5)
   Main PID: 102728 (systemd-homed)
     Status: "Processing requests..."
      Tasks: 1 (limit: 37978)
     Memory: 2.1M (peak: 20M)
        CPU: 95ms
     CGroup: /system.slice/systemd-homed.service
             └─102728 /usr/lib/systemd/systemd-homed

May 25 17:23:27 magnolia systemd-homed[102728]: Got notification that all sessions of user gabx ended, deactivating automatically.
May 25 17:23:27 magnolia systemd-homed[102728]: Home gabx already deactivated, no automatic deactivation needed.
May 25 17:23:27 magnolia systemd-homed[102728]: Unable to determine state of home directory, ignoring: Device or resource busy
May 25 17:23:30 magnolia systemd-homed[102728]: Got notification that all sessions of user gabx ended, deactivating automatically.
May 25 17:23:30 magnolia systemd-homed[102728]: Home gabx already deactivated, no automatic deactivation needed.
May 25 17:24:30 magnolia systemd-homed[102728]: gab: changing state inactive → removing
May 25 17:24:30 magnolia systemd-homework[102795]: Home directory /home/gab exists, is not mounted but populated, refusing.
May 25 17:24:30 magnolia systemd-homed[102728]: Removing gab failed: Device or resource busy
May 25 17:24:30 magnolia systemd-homed[102728]: gab: changing state removing → inactive
May 25 17:24:30 magnolia systemd-homed[102728]: Unable to determine state of home directory, ignoring: Device or resource busy

Why can't I remove user gab? AsI am logged as gabx, so it could be OK to remove user gab, no?
Same when I am logged as gab and want to remove user gabx.

Which process is keeping the home folder busy? What is the correct way to remove systemd-homed users?

Last edited by gabx (2025-05-25 18:32:55)

Offline

#2 2025-05-25 17:46:57

cryptearth
Member
Registered: 2024-02-03
Posts: 1,512

Re: [SOLVED] remove systemd-homed users

gabx wrote:
May 25 17:24:30 magnolia systemd-homework[102795]: Home directory /home/gab exists, is not mounted but populated, refusing.

although I don't get what you try to do (and in regard to your other topic: as it seems related please keep it within one topic) that line somewhat sounds to me that /home/gab should be an empty mountpoint but it's not empty - so whatever was supposed to be mounted there was not mounted because the mountpoint is not empty - and hence you likely now try to unmount root as that's where the random files in <root partition>/home/gab/* are instead of <partition meant to be mounted at /home/gab>
whatever you did - you messed up quite severely - maybe try to work from multi-user.target or via chroot from install media

Offline

#3 2025-05-25 18:05:04

gabx
Member
From: Geneva, Switzerland
Registered: 2011-11-20
Posts: 203
Website

Re: [SOLVED] remove systemd-homed users

I am trying to clean my home directory and delete everything not needed as I don't use systemd-homed.

gabx@magnolia ➤➤ ~ % ls -al /home
total 50G
drwxr-xr-x 1 root   root     94 May 22 23:07 ./
drwxr-xr-x 1 root   root    208 May 21 23:56 ../
drwxr-xr-x 1  60060  60060  534 May 22 21:27 gab/
drwx------ 1 nobody nobody  308 May 22 20:42 gab.homedir/
drwx------ 1 root   root    300 May 22 21:02 gab.saved/
drwx------ 1 gabx   gabx    536 May 21 12:10 gabx/
drwx------ 1 gabx   gabx   1.1K May 23 10:18 gabxnew/
drwx------ 1 toto   toto    262 May 25 17:11 toto/
-rw------- 1 root   root    50G May 22 23:08 gabx.home

user toto is OK. Now, the only user I want to keep is gabx. Its home folder is gabxnew. Everything else is not needed and I would like to get rid of them. What I don't understand is why I can't remove the users listed with homectl list command? If I don't want any user home directory being managed by systemd-homed, shouldn't this list be empty? Or shall I keep listed users as inactive?

I made two topics as the /backup read-only directory does not look to me directly tighted to systemd-homed issues.

Last edited by gabx (2025-05-25 18:07:13)

Offline

#4 2025-05-25 18:22:47

gabx
Member
From: Geneva, Switzerland
Registered: 2011-11-20
Posts: 203
Website

Re: [SOLVED] remove systemd-homed users

cryptearth wrote:
gabx wrote:
May 25 17:24:30 magnolia systemd-homework[102795]: Home directory /home/gab exists, is not mounted but populated, refusing.

although I don't get what you try to do (and in regard to your other topic: as it seems related please keep it within one topic) that line somewhat sounds to me that /home/gab should be an empty mountpoint but it's not empty - so whatever was supposed to be mounted there was not mounted because the mountpoint is not empty - and hence you likely now try to unmount root as that's where the random files in <root partition>/home/gab/* are instead of <partition meant to be mounted at /home/gab>
whatever you did - you messed up quite severely - maybe try to work from multi-user.target or via chroot from install media

So, what am I supposed to do and what to fix? I don't understand what is your point. I understand I messed up quite severly but please can you be more precised and how to fix? Thank you for your help

Offline

#5 2025-05-25 18:32:38

gabx
Member
From: Geneva, Switzerland
Registered: 2011-11-20
Posts: 203
Website

Re: [SOLVED] remove systemd-homed users

I removed the unneeded home directories and kept only the needed one for user gabx (home dir is gabxnew) and user toto.

[root@magnolia home]# ls -al /home
total 0
drwxr-xr-x 1 root root   22 May 25 20:28 .
drwxr-xr-x 1 root root  208 May 21 23:56 ..
drwx------ 1 gabx gabx 1054 May 23 10:18 gabxnew
drwx------ 1 toto toto  262 May 25 17:11 toto

That's exactly what I wanted, so there is no issue at all. And the homectl list is now empty. So everything is fine. I just thought I had to first remove the users THEN delete their home directory. But in fact, the inverse just worked.

[root@magnolia home]# homectl list
No home areas.

So for me everything is fine and topic solved.

Offline

Board footer

Powered by FluxBB