It was expected that ntfs3
would be the only thing in /etc/filesystems
since that file doesn't exist by default on most Linux systems.
Before I go on, maybe I should start my usual type of diatribe and explain how mounting of filesystems works on a modern desktop on Linux. If you'd rather not read three pages of diatribe, just skip to the TL;DR below and start reading from there.
In the beginning, when you tell Caja to mount a filesystem, Caja will contact a "daemon" (background process) called udisksd
to mount the filesystem.
You'd think, "Why can't Caja mount the filesystem by itself?", and the answer is that on most UNIX-like systems (including Linux), only the superuser or a specially-privileged program can mount filesystems.
In ye olden days, filesystems that other users could mount would be listed in the /etc/fstab
file with a special parameter, and then any ordinary user could mount the filesystem. The mount
command is specially privileged so that, theoretically, any user could mount any filesystem anywhere without first becoming root
; however, in practice, mount
is programmed to mount only filesystems that were specially marked by the superuser in /etc/fstab
ahead of time.
The fstab
mechanism used to work, but did not bode well for removable media: What if you inserted a USB stick that you've never used on the system before? There's no entry in /etc/fstab
for this USB stick, so ordinary users cannot mount the filesystem. Ultimately, the root
user would either have to carry out the mounting operation, or the root
user would have to add a line to /etc/fstab
so that ordinary users could then mount that filesystem. Either way, plugging in a USB stick means logging in as root
and running some arcane command sequence. Not exactly "plug-and-play", and not fun at all. And not really secure either, since you either have to tell everybody who uses removable media the root
password, or you have to do all mounting yourself and have everybody hound you whenever they get hold of a new USB stick!
So, among the other good things that came about in 2004-'05, Linux gained all kinds of "plug-and-play" programs and daemons that started with the letter 'U' -- Udev, Udisks, and a few others which I can't remember right now. Anyway, now Udev will know immediately when you plug in a device, be it a USB stick or something else, and will tell Udisks about the device and asks Udisks to mount the device. Similarly, Caja can instruct Udisks to mount a device when you "manually" click on that device in Caja. Either way, Udisks gets a request from some external source and proceeds to mount the filesystem on the behalf of the other party.
Now we're getting down to the meat of the problem. The first thing Udisks does is it uses a library called libblkid
(also known as just blkid
) to identify what filesystem is on the device in question. blkid
has a hard-coded list of known filesystems, and tests the device's contents against the list of properties which identify each known filesystem. Most filesystems contain "magic numbers" or "magic sequences", or at least unique data structures, which enable blkid
to identify the filesystem quickly just by looking at select parts of the filesystem data.
Anyway, blkid
deliberates and tries a bunch of obscure filesystem types as well as common ones, and eventually it figures out that the device has an NTFS filesystem. blkid
then reports the filesystem type as a string reading exactly as ntfs
. Udisks then takes this string and attempts to mount the device with a filesystem type of exactly the string returned by blkid
, e.g:
mount -t ntfs /dev/sdb10 /media/gordon/mountpoint
I was hoping that by removing the user-space filesystem driver called ntfs
(by moving /sbin/mount.ntfs
to some other location), that the first attempt at mounting would fail, and then Udisks would go on to plan B, which is to look through each line in the file /etc/filesystems
and try each filesystem type one at a time until something worked. Apparently, Udisks just errored out at the first attempt and pouted.
TL;DR: My first try didn't work since /etc/filesystems
is not checked unless blkid
turns up totally empty-handed, i.e. the filesystem is not recognized as a standard filesystem.
I was going to list off a hack of mine to help you, but I found this for Arch Linux -- it should also work for Ubuntu: AUR (en) - ntfs3-dkms. The link I gave you brings you right to the section you need to look at. There's apparently two files you need to modify. I formulated a procedure based on those instructions, so you don't have to go digging into the details of what needs to be done (see below).
@sgage, I think you're good to follow those directions, since you've got Ubuntu 21.10 and it supposedly has a new enough version of Udisks for the instructions listed above and below to work. But so that nobody else can accuse me of not warning anybody of this caveat, here's my warning:
WARNING: This hack apparently does not work by default on Ubuntu 20.04 or earlier since such versions have insufficiently new versions of Udisks for one part of the hack to work, though your mileage may vary.
My version of the procedure:
sudo dd status=none of=/etc/udev/rules.d/0000-Use-ntfs3-driver-for-NTFS-filesystems <<EOF
SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs3"
EOF
sudo dd status=none of=/etc/udisks2/mount_options.conf <<EOF
[defaults]
ntfs3_defaults=uid=$UID,gid=$GID,noatime,prealloc
ntfs3_allow=uid=$UID,gid=$GID,umask,dmask,fmask,iocharset,nohidden,sys_immutable,discard,force,sparse,showmeta,prealloc,noacsrules,acl
EOF
Supposedly, if you do that and reboot, then all will be well and you'll mount NTFS filesystems using ntfs3
.