Unmounting drives hangs forever in Workstation

I’ve got a handful of different external drives I use with my laptop, and after a fresh boot, they’ll unmount successfully when told to do so through Files or Disks.

However, after my system has been running for a sleep cycles or two, attempting to unmount the drives just results in an eternal spinning wheel. It never resolves. It blocks the system from shutting down, and the only thing I can do is pray and yank the drive anyway.

This is a fresh install of F43 Workstation. Never had this problem on KDE.

Can someone guide me in where to look to diagnose this? I’m a noob but I can follow directions if I have a few pointers.

The unmount is likely being blocked by an open file. If a program has a file open on the drive, it will not unmount until the program closes the file. This is meant to give the program a chance to write its data to the file before the file becomes inaccessible and prevent data loss.

There is a program called lsof (list open files) that can help you figure out what files are open. You can install it with sudo dnf install lsof. Then run lsof /path/to/mountpoint to see a list of what files, if any, are open under that mountpoint. The name of the program that has the file(s) open should be listed in the first column.


P.S. The path has to be a mountpoint, not just a subdirectory. The command mountpoint /path/to/mountpoint should confirm whether a given path is a mountpoint or not.

2 Likes

If any of the external drives are actual network file systems (nfs or cifs), and if the external network drive is down, then umount would wait for ever.

1 Like

umount even has a special flag for handling NFS.

-l, --lazy
Lazy unmount. Detach the filesystem from the file hierarchy now, and clean up all references to this filesystem as soon as it is not busy anymore.

A system reboot would be expected in near future if you’re going to use this option for network filesystem or local filesystem with submounts. The recommended use-case for umount -l is to prevent hangs on shutdown due to an unreachable network share where a normal umount will hang due to a downed server or a network partition. Remounts of the share will not be possible.

No. GNOME is smart enough to tell you what processes are hogging the mountpoint. This is probably a dependency chain issue.

Are you using dm-crypt or any kind of dm at all? Is it just straight up formatted drives?

NEEDINFO, mate. We can’t help you unless we have more to work on. What does dmesg say? How about lsblk? lsscsi? What fs are you using(blkid, mount)? What does the kernel say when shutting down? The kernel is not that dumb. If a fs driver is hanging the process, it should tell you by issuing an oops.

That’s cool. I had problems getting my home directory to unmount when I signed out for a while, but I’m using Sway and the problem was being caused by a flatpak that wasn’t stopping quickly enough. I wonder of GNOME’s automatic detection works across all the namespace isolation (private mounts, etc.) that flatpaks do?

Appreciate the replies. Turns out Timeshift was the culprit, according to lsof.

1 Like