I ran into an interesting issue recently when I wanted to set up autofs with an NTFS filesystem on an external USB drive (this drive, unfortunately, could not be btrfs like everything else).
The version of autofs shipped with Debian Jessie (and many other varieties of Linux, including Ubuntu), has a bug where it passes an invalid mount option (-s) to ntfs-3g, and as a result NTFS filesystems can’t be mounted. This bug has been fixed in a newer version of autofs, but instead of building it from source (it’s not available in jessie-backports), I just did a silly hack instead.
The relevant portion of my autofs map looks like:
somedrive -fstype=ntfs,rw :/dev/disk/by-uuid/EA59283A9207245F1
Without enabling debugging, you don’t get much useful output:
$ ls /media/somedrive ls: cannot access /media/somedrive: No such file or directory
However, after enabling automount debugging (I just hacked up the init script), the problem becomes clear:
do_mount: /dev/disk/by-uuid/EA59283A9207245F1 /media/somedrive type ntfs options rw using module generic mount_mount: mount(generic): calling mkdir_path /media/somedrive mount_mount: mount(generic): calling mount -t ntfs -s -o rw /dev/disk/by-uuid/EA59283A9207245F1 /media/somedrive spawn_mount: mtab link detected, passing -n to mount >> ntfs-3g: Unknown option '-s'. >> ntfs-3g 2014.2.15AR.2 integrated FUSE 28 - Third Generation NTFS Driver >> #011#011Configuration type 7, XATTRS are on, POSIX ACLS are on >> Copyright (C) 2005-2007 Yura Pakhuchiy >> Copyright (C) 2006-2009 Szabolcs Szakacsits >> Copyright (C) 2007-2014 Jean-Pierre Andre >> Copyright (C) 2009 Erik Larsson >> Usage: ntfs-3g [-o option[,...]] <device|image_file> <mount_point> >> Options: ro (read-only mount), windows_names, uid=, gid=, >> umask=, fmask=, dmask=, streams_interface=. >> Please see the details in the manual (type: man ntfs-3g). >> Example: ntfs-3g /dev/sda1 /mnt/windows >> News, support and information: http://tuxera.com mount(generic): failed to mount /dev/disk/by-uuid/EA59283A9207245F1 (type ntfs) on /media/somedrive
My hack to fix this is pretty simple: I created a wrapper around the real ntfs-3g binary that strips the -s option out of the command line. Very brute force.
I dropped my script into /bin/ntfs-3g_wrapper, renamed /bin/ntfs-3g to /bin/ntfs-3g_real, and made a symbolic link from /bin/ntfs-3g to the wrapper.
Here’s the script, placed in /bin/ntfs-3g_wrapper:
#!/bin/bash OPTS=$(echo $@ | sed "s/ -s / /") exec /bin/ntfs-3g_real $OPTS
And now let’s move things around and create the symlink:
$ sudo mv /bin/ntfs-3g /bin/ntfs-3g_real $ sudo ln -s /bin/ntfs-3g_wrapper /bin/ntfs-3g
BE CAREFUL IF YOU DECIDE TO TO DO THIS - I take no responsibility if you break your system. And remember: any update to the ntfs-3g package will require at a minimum moving the binary again and recreating the symlink, or maybe even more work depending…
This is, in general, the wrong way to solve these sorts of problems - you have to remember what you did for when it breaks again, and you never know what other issues it may cause.
In my case this was a quick and dirty solution, and if a newer version of autofs ends up in jessie-backports, I can easily undo it. Hopefully this helps others, as this is apparently a pretty common problem with autofs.