Autofs. Share your experience

D

Deleted member 48958

Guest
Automounting on FreeBSD was always like a black magic for me :D, I tried to make it work
on FreeBSD 10.* several times, but had no luck... sysutils/hal always used to work for me
(it is possible to mount using UTF-8 locale with HAL also), but now it is very outdated
and required by only few ports, and almost all of them may be rebuilt without HAL support,
so hal may be safely removed...

To configure autofs on FreeBSD 11 system, you need to uncomment
Code:
/media          -media          -nosuid
in /etc/auto_master.

Then you need to add
Code:
autofs_enable="YES"
to /etc/rc.conf
Then reboot :)

But, with these settings, from handbook, you won't be able to read file names with UTF-8 symbols, like unicode, arabic letters, etc.
(Even if your system locale is a *.UTF-8 locale.)
Also, it won't be possible to edit files on mounted with autofs file systems as a regular user, as root only…

To fix these issues, you need to edit /etc/auto_master again:
Code:
/media          -media          -nosuid,-m=770,-L=en_US.UTF-8
-m=770 — changes file permissions on auto mounted with autofs USB flash drives and adds
read-write-execute permissions to the wheel group. So your user should be in the wheel group
(execute # pw groupmod wheel -m yourusername and re-login).
-L=en_US.UTF-8 — adds UTF-8 support, so all file names are readable now.
Then you need to unmount all autofs devices and restart automount and automountd (or just reboot).

Also it is possible to configure automounting of your MTP device, like android phone, or some mp3 player.
Install sysutils/fusefs-simple-mtpfs, execute # mkdir /mtp and add
Code:
/mtp            -simple-mtpfs   -allow_other
to /etc/auto_master, also you need to add
Code:
fuse_load="YES"
to your /boot/loader.conf, no others configurations needed, all work fine. To load fuse.ko kernel module without reboot, execute # kldload fuse.


When your device will be connected, it will appear in /media or /mtp,
so add these dirs to your file manager bookmarks, when you'll try to open a directory with your device name,
your device will be mounted, `autofs_enable="YES"` loads autofs.ko kernel module and starts 3 services:
automount, automountd and autounmountd, so it will be also auto unmounted "after a period of inactivity".

To unmount all file systems mounted with autofs, execute
# automount -fu
For now I know the only one way how to enable unmounting of FS-es mounted with autofs when using your file manager, like pcmanfm, as a regular user, or via umount command without sudo, execute # chown root:operator /sbin/umount and then # chmod 4554 /sbin/umount, also your user should be in "operator" group (execute # pw groupmod operator -m yourusername and re-login), use at your own risk.
Z5JHGcK.png


After system start, your % mount output should be similar
sGm8TNs.png


My phone and mp3 player are auto mounted with autofs, after accessing its mount points.
TejUyaB.png


Do not forget to remove "hald_enable" from /etc/rc.conf.
This is how I use it. May be someone also has any suggestions?


UPDATE:
Thanks to tobik@, found that NTFS also can be mounted by autofs,
but sysutils/fusefs-ntfs should be installed.

Also it is possible to mount ext2, ext3, ext4 file systems with autofs,
but ext2fs.ko kernel module should be loaded, so add ext2fs_load="YES"
to /boot/loader.conf, or add ext2fs to kld_list in /etc/rc.conf.

exFAT FS is also supported, just install sysutils/fusefs-exfat:
# cd /usr/ports/sysutils/fusefs-exfat/ && make install clean

No additional actions required. NTFS, ext2fs(5) and exFAT are supported by "media" map in /etc/auto_master,
that was described at the beginning of this post.


Note:
"-m=770,-L=en_US.UTF-8" flags are tested to work with msdosfs only, so it may or may not work with NTFS, ext2fs(5) and exFAT.
 
Last edited by a moderator:
Mine was not good. I will try it again with the extra changes you pointed out and report later. :)

Thanks!

EDIT: added in the extra tips you pointed out and I had a improvement. Now when the device is mounted I can use it properly. It appear automatically in x11-fm/pcmanfm-qt. :beer:

The mtp seem to not be working, but I still need to look if it is not a Android issue.
 
Do not forget to load fuse.ko kernel module, to make simple-mtpfs work,
add
Code:
fuse_load="YES"
to /boot/loader.conf, or
Code:
kld_list="fuse"
to /etc/rc.conf, to load it immediately, execute # kldload fuse.
(Also do not forget to install sysutils/fusefs-simple-mtpfs port!)
Also check your phone connection settings, it should be in mtp mode.

And be sure to add
Code:
/mtp            -simple-mtpfs   -allow_other
to /etc/auto_master and reboot.
 
Last edited by a moderator:
ILUXA

I have

Code:
kld_list="fuse"
in /etc/rc.conf, I will try to load fuse directly from /boot/loader.conf instead.

sysutils/fusefs-simple-mtpfs is installed and the phone is correct configured, however I use a custom ROM and so I am willing to test using another phone to be certain of the result.

Thanks!
 
Hum. Just now I found this error:

Code:
Jul  3 21:32:22 workstation automountd[33906]: failed to execute /etc/autofs/special_simple-mtpfs: No such file or directory
Jul  3 21:32:22 workstation kernel: WARNING: autofs_trigger_one: request for /mtp/ completed with error 5
Jul  3 21:32:22 workstation automountd[33905]: "/etc/autofs/special_simple-mtpfs", pid 33906, terminated with exit status 1
Jul  3 21:32:22 workstation automountd[33905]: failed to handle special map "-simple-mtpfs"
Jul  3 21:32:22 workstation automountd[33905]: AUTOFSDONE: No such process

pkg info | grep mtp
Code:
fusefs-simple-mtpfs-0.3.0_1    Simple MTP fuse filesystem driver
libmtp-1.1.13                  Media Transfer Protocol (MTP) library

Thanks!
 
Jul 3 21:32:22 workstation automountd[33906]: failed to execute /etc/autofs/special_simple-mtpfs: No such file or directory
Hmm, It seems "/etc/autofs/special_simple-mtpfs" isn't exist in your system...
What version of FreeBSD you're using? I am 100% sure that special_simple-mtpfs is present in FreeBSD 11 Stable,
and, as I remember, it is also present in 11 Release too.
 
That is weird. I am using 11.0-RELEASE-p1, and I have sysutils/fusefs-simple-mtpfs installed. I see the patch-src__simple-mtpfs-fuse.cpp and special_simple-mtpfs.in inside the port file folder, however it is not being installed. :(

I will look in the build log to see if there is something.

Thanks!

EDIT: nothing interesting from logs but the Makefile point to PR 193596, but if installing from packages the file appear in there.:confused:

EDIT2: Thread 54690/page-37#post-354122
 
ILUXA Thank you for your detailed information!

Unfortunately automount doesn't work very good for me when it comes to MTP devices (all different Android devices). Unfortunately I've had to switch to Debian for my daily OS for now because there doesn't appear to be a reliable way to access my various Android devices on FreeBSD. I've tried sysutils/automount and I've tried audio/gmtp and both have failed in one degree or another, even after much experimentation.

It grieves me that I cannot just plug in an Android phone or tablet on FreeBSD and have it automatically appear in the file manager (caja, pcmanfm, etc) as it (usually) does in Linux...and then not even Linux gets it right sometimes. I've actually had to forward some of my Android device connections to Windows running in a virtual machine to get the files copied -- not fun, or cool.
 
ILUXA

Is there a reason to mounting mtpfs at /mtp instead of /media?

I am asking because if it is not mounted at /media, x11-fm/pcmanfm-qt do not show it in the device section. I changed it to there and it is working quite fine here. :)
 
Is there a reason to mounting mtpfs at /mtp instead of /media?
ppH3vzV.png

It is not a best idea if you plan to mount msdosfs devices also (USB flash drives, etc). If you'll use mtpfs only (without
Code:
/media          -media          -nosuid
line in /etc/auto_master) then it can work. But also /mtp dir may be mentioned somewhere in autofs scripts...
Also I am not a some kind of pro/developer or something :D, I'm a regular user like you, so just test.


Also /etc/autofs/special_simple-mtpfs says:
Code:
# Intended for use with /etc/auto_master containing
# /mtp          -simple-mtpfs   -allow_other
So maybe there is some reason for this...

So my advice to you, just create a bookmark to /mtp with your file manager.
 
I have some question concerning autofs.
1. How can I prevent EFI partition available in /media
2. How to unmount ? I have permission denied when I try to click unmount in thunar. Set suid bit to umount is a little bit messy.
3. I'm not wheel. Can I set username in auto_master ?
 
1. ?
2. Use # automount -fu
3. You can try to use "-m=777" flag instead of "-m=770".
 
Unfortunately I end up moving to sysutils/dsbmd & sysutils/dsbmc. AutoFS does not play well with x11-fm/pcmanfm-qt, it sometimes unmount but immediately mount again...

I am waiting to Lumina split to several ports so I can install its tools separated. It is already possible but no one did it yet, and they do not know when they will have time for.

The Lumina fm should deal well with AutoFS. I give a try to it yesterday, did not test the AufoFS, but it have a nice integration with ZFS - how ever it seem still a bit buggy. :)

So, I am looking forward...
 
I've used sysutils/automount and sysutils/automounter in conjunction with success.

However, I found automount more of a hindrance than a boon as I prefer a USB stick not be mounted automagically in case I want to use the dd command.
 
You can find all dsb project here.

Thanks for the link. I've never used it but it looks nice.

I have some question concerning autofs.
2. How to unmount ? I have permission denied when I try to click unmount in thunar. Set suid bit to umount is a little bit messy.
3. I'm not wheel. Can I set username in auto_master ?

I always make my usr account a member of wheel during the build process and use the mount and unmount commands:

# mount -v -t msdosfs /dev/da0s1 /media/da0s1

# umount -v -t msdosfs /dev/da0s1 /media/da0s1
 
I ended using sysutils/dsbmd :) I don't like the idea to have separate folders for sticks, mtp and ptp devices as autofs needs. Also, it mounts my EFI partition.

Lumina looks promising, but it's dependency on x11/xscreensaver is disaster. Just give me blank screen without 50 perl deps.
 
Also, it mounts my EFI partition.
It won't mount it until you'll open its mount point (/media/EFI/),
if this dir won't be opened, EFI won't be mounted, so you can use /media/ content safely,
without mounting /media/EFI/. But even if this directory will be accidentally opened and mounted,
it will be automatically unmounted after some time with autounmountd daemon, which is started by autofs_enable="YES".
 
sysutils/dsbmd pauses computer shutdown for 1 min. (Stopping dsbmd .... waiting for PIDS on tty0).

/var/log/messages
Code:
Jul 24 22:05:22 sphinx shutdown: reboot by root:
Jul 24 22:05:22 sphinx console-kit-daemon[933]: WARNING: Error waiting for native console 9 activation: Inappropriate ioctl for device
Jul 24 22:05:22 sphinx devd: notify_clients: send() failed; dropping unresponsive client
Jul 24 22:05:23 sphinx kernel: , 789.
Jul 24 22:06:22 sphinx kernel: .
Jul 24 22:06:22 sphinx kernel: .
Jul 24 22:06:22 sphinx ntpd[774]: dispatch_imsg in main: pipe closed
Jul 24 22:06:22 sphinx devd: notify_clients: send() failed; dropping unresponsive client
789 is daemon pid, but other errors are not related, I saw them before.
 
abishai

I do not have this problem, but your messages show a consolekit ioctl(2) error. Try disabling consolekit to see if it will still hang for a minute.

I do not use consolekit, but as you already are using consolekit maybe sysutils/hal would be a better option for you.
 
abishai

I do not have this problem, but your messages show a consolekit ioctl(2) error. Try disabling consolekit to see if it will still hang for a minute.

I do not use consolekit, but as you already are using consolekit maybe sysutils/hal would be a better option for you.
hal is dead for a decade :) And consolekit is not related to hal.
I think, consolekit error is unrelated and harmless, 'unresponsive client' is dhcp client, it becomes upset when ipsec goes down. Relevant messages are from kernel (1 minute). Probably, I should look in sources :( Very strange that only dsbmd is slow to stop.
 
sysutils/dsbmd pauses computer shutdown for 1 min.

Hi abishai ,

I've never seen this problem before. I don't want to hijack the thread, but what version of dsbmd are you using? Maybe there is an unresponsive device which is polled by dsbmd. If you're using dsbmd >= 0.3, you can disable polling by setting poll_interval = 0 in /usr/local/etc/dsbmd.conf, and see if the problem persists.
 
Back
Top