Closed blickers closed 11 months ago
Have you tried unmounting the partition from the terminal? Are you getting any output in dmesg?
The APFS partition on USB hard drive was actually mounted. I can use "sudo umount /dev/sdc2" to unmount it in terminal without any problem. No special dmesg message can be found. However, nautilus file manager always fail to unmount the APFS partition. Other partition types do not pose this issue. This bug is highly reproducible. Just try it.
Another concern is that Linux does not mount APFS partitions to the mount point specified by the volume label. Instead, it uses the partition UUID. However, for other types of partitions like NTFS, Exfat, Ext4, XFS, etc, they will be mounted to the mount point based on their partition label.
Perhaps the linux-apfs-rw kernel driver does not function like typical Linux filesystem drivers, or it may not be compatible with udev (the generic device manager daemon on Linux system).
I have no idea how Nautilus unmounts stuff. I would have expected it to just call libmount, so it should have been the same as using the terminal, but that's clearly not the case. I see the same issue on Thunar, so maybe the problem is in glib? It's hard to imagine how this could be the driver's fault, since the device gets listed correctly on /proc/self/mountinfo
, which is the only file that seems to get parsed to check for mounts. I'll keep digging though.
Another concern is that Linux does not mount APFS partitions to the mount point specified by the volume label. Instead, it uses the partition UUID.
The UUID in use here is the UUID for the container, not for the individual volume that gets mounted (which is the default volume 0). The container has no label itself. It would be better if Nautilus showed the uuid and label for the individual mounted volume, but I don't think there's anything I can do about that. I don't know how they get the labels, but it's probably userland stuff.
@blickers I just pushed a patch for this issue to the development branch if you want to try it out. It's not perfect though (a perfect solution would probably require plugins for the userland tools like btrfs has), but I think it should work at least for a single volume. Thank you for the report.
The patch is functioning as expected. We appreciate your excellent work!
System: Debian 12 Linux Kernel: 6.6 Desktop Environment: GNOME 43
One of the partitions on my USB hard disk was formated as APFS using macOS. When the device is plugged in, Linux will automatically mount it, similar to how it handles other partition types like NTFS or Exfat. But when attempting to unmount the APFS partition through the Nautilus file manager's left sidebar, clicking on the "Disconnect" button triggers a dialog displaying the message "Unable to unmount" (see screenshot). Nautilus will exhibit an error message on the dialog indicating that the partition is not mounted, even though it has indeed been mounted.
If the computer is awakened from suspend mode, the APFS partition on my USB hard drive will automatically be remounted to a new mounting point, resulting in the repeated mounting of the partition.
Except for linux-apfs-rw, other partition types do not pose this issue. So, I believe there might be a bug present in the current linux-apfs-rw kernel driver.