Skip to content

systemd umounts manual mounts when it has a failed unit for that mount point #1741

@archenemies

Description

@archenemies

I guess I eventually found out by using Google that when mount seems to succeed but the mountpoint is not mounted, under Systemd, then one should run systemd daemon-reload and that will fix it. However, I think that an ideal Systemd would (1) have 'mount' report an error and exit with non-zero status, (2) perhaps try harder to get the mount to succeed - or rather try to desist from unmounting the filesystem once mounted, (3) as a last resort, hint to the user to run systemd daemon-reload, somewhere where the user is likely to look, e.g in the journal. I'll refrain from speculating upon the implementation details of these three components.

$ sudo mount /mnt/attorney/
$ ls /mnt/attorney/
$ journalctl -b
...
Oct 31 20:28:20 thutmose kernel: EXT4-fs (sdc1): mounting ext3 file system using the ext4 subsystem
Oct 31 20:28:20 thutmose kernel: EXT4-fs (sdc1): warning: maximal mount count reached, running e2fsck is recommended
Oct 31 20:28:20 thutmose kernel: EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
Oct 31 20:28:20 thutmose sudo[18994]: pam_unix(sudo:session): session closed for user root
Oct 31 20:28:20 thutmose systemd[1]: mnt-attorney.mount: Unit is bound to inactive unit dev-disk-by\x2dlabel-attorney.device. Stopping, too.
Oct 31 20:28:20 thutmose systemd[1]: Unmounting /mnt/attorney...
Oct 31 20:28:21 thutmose systemd[1]: Unmounted /mnt/attorney.
...
$ grep /mnt/attorney /etc/fstab
LABEL=attorney /mnt/attorney            auto            defaults,nofail,x-systemd.device-timeout=1         0 0
$ sudo systemctl daemon-reload
$ sudo mount /mnt/attorney/
$ ls /mnt/attorney/
curtius-backup       list               shared          thutmose-backup
...

For background, I hibernated my laptop, which is also attached to a docking station, and the filesystem in question is on a USB 2.0 hard drive. So between waking up from hibernation, and having the laptop undocked and docked, maybe something got confused. Happy Halloween!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions