devd based AUTOMOUNTER

vermaden,

Automount won't mount a FAT32 partition on my USB flash disk. The automount.log file displays the following error:

Code:
/dev/da1: mount failed (fat) 'mount_msdosfs -o large -o longnames -D cp437 -L en_US.ISO8859-1 -m 644 -M 755 /dev/da1 /media/da1

It looks similar to the NTFS bug that was fixed (above).
 
Last edited by a moderator:
Please provide output of the file -s /dev/da1 command.

Can you mount that drive manually from the command line?

If yes, then what mount command works for you?

About the /var/log/automount.log file, I need the WHOLE file (not only single line).
 
Here are the details:

The FAT32 flash disk was formatted using a Windows 7 operating system. The flash disk is 8GB in size and contains a 8GB FAT32 partition on it.

I have tried to use automount to mount the FAT32 partition, but it will not mount during boot.

The FAT32 partition mounts perfectly fine using the following command: mount_msdosfs /dev/da1 /media/da1

I have the following line in my /etc/rc.conf file:

Code:
fusefs_enable="YES"

I have the following lines in my /boot/loader.conf file:

Code:
libiconv_load=YES
cd9660_iconv_load=YES
msdosfs_iconv_load=YES
ntfs_iconv_load=YES
udf_iconv_load=YES

PS: I've even tried
Code:
fuse_load=YES
in the file (above).

The kldstat command displays the following:

Code:
Id Refs Address            Size     Name
 1   48 0xffffffff80200000 11cdab0  kernel
 2    1 0xffffffff813ce000 8900     vesa.ko
 3    1 0xffffffff813d7000 1190     ntfs_iconv.ko
 4    2 0xffffffff813d9000 efe8     ntfs.ko
 5    5 0xffffffff813e8000 6f40     libiconv.ko
 6    3 0xffffffff813ef000 45058    linux.ko
 7    1 0xffffffff81435000 4bb8     vmxnet.ko
 8    1 0xffffffff8143a000 9aa8     vmxnet3.ko
 9    1 0xffffffff81444000 11c8     cd9660_iconv.ko
10    1 0xffffffff81446000 11d8     msdosfs_iconv.ko
11    1 0xffffffff81448000 1178     udf_iconv.ko
12    2 0xffffffff8144a000 9b18     udf.ko
13    1 0xffffffff81612000 1582     fdescfs.ko
14    1 0xffffffff81614000 429d     linprocfs.ko
15    1 0xffffffff81619000 a058     fuse.ko
16    1 0xffffffff81624000 1e7      linux_adobe.ko
17    1 0xffffffff81625000 1464     vmmemctl.ko
18    1 0xffffffff81627000 2d50     vmblock.ko

The file -s /dev/da1 command displays the following:

Code:
/dev/da1: x86 boot sector, code offset 0x58, OEM-ID "MSDOS5.0", sectors/cluster 8, reserved sectors 2270, Media descriptor 0xf8, heads 255, sectors 15646720 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 15249, reserved3 0x800000, serial number 0x2a6aee05, unlabeled

The DEBUG.da.attach.log file displays the following error:

Code:
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
+ [ da1 = --version ]
+ [ da1 = -h -o da1 = --help -o 2 -eq 0 -o 2 -eq 1 ]
+ [ -f /usr/local/etc/automount.conf ]
+ . /usr/local/etc/automount.conf
+ : /media
+ : /var/log/automount.log
+ : /var/run/automount.state
+ : en_US.ISO8859-1
+ : cp437
+ : %Y-%m-%d %H:%M:%S
+ : NO
+ : YES
+ : NO
+ : 0
+ : 0
+ : 8
+ : 0.3
+ [ NO = YES ]
+ DEV=/dev/da1
+ __log '/dev/da1: attach'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-03-19 17:41:23 '/dev/da1: attach'
+ [ '' != '' ]
+ ADD=0
+ MNT=/media/da1
+ __check_already_mounted -d /dev/da1
+ mount
+ local 'MOUNT=/dev/da0s1a on / (ufs, local)
devfs on /dev (devfs, local, multilabel)
/dev/da0s1d on /tmp (ufs, local, soft-updates)
/dev/da0s1f on /usr (ufs, local, soft-updates)
/dev/da0s1e on /var (ufs, local, soft-updates)
procfs on /proc (procfs, local)
fdescfs on /dev/fd (fdescfs)
linprocfs on /usr/compat/linux/proc (linprocfs, local)'
+ echo '/dev/da0s1a on / (ufs, local)
devfs on /dev (devfs, local, multilabel)
/dev/da0s1d on /tmp (ufs, local, soft-updates)
/dev/da0s1f on /usr (ufs, local, soft-updates)
/dev/da0s1e on /var (ufs, local, soft-updates)
procfs on /proc (procfs, local)
fdescfs on /dev/fd (fdescfs)
linprocfs on /usr/compat/linux/proc (linprocfs, local)'
+ grep -q '^/dev/da1 on '
+ __check_already_mounted -m /media/da1
+ mount
+ local 'MOUNT=/dev/da0s1a on / (ufs, local)
devfs on /dev (devfs, local, multilabel)
/dev/da0s1d on /tmp (ufs, local, soft-updates)
/dev/da0s1f on /usr (ufs, local, soft-updates)
/dev/da0s1e on /var (ufs, local, soft-updates)
procfs on /proc (procfs, local)
fdescfs on /dev/fd (fdescfs)
linprocfs on /usr/compat/linux/proc (linprocfs, local)'
+ echo '/dev/da0s1a on / (ufs, local)
devfs on /dev (devfs, local, multilabel)
/dev/da0s1d on /tmp (ufs, local, soft-updates)
/dev/da0s1f on /usr (ufs, local, soft-updates)
/dev/da0s1e on /var (ufs, local, soft-updates)
procfs on /proc (procfs, local)
fdescfs on /dev/fd (fdescfs)
linprocfs on /usr/compat/linux/proc (linprocfs, local)'
+ grep -q ' on /media/da1 '
+ [ YES = NO ]
+ __wait_for_device /dev/da1
+ local COUNT=0
+ head -c 1 /dev/da1
+ file -b -L -s /dev/da1
+ sed -E 's/label:\ \".*\"//g'
+ __create_mount_point /dev/da1
+ mkdir -p /media/da1
+ [ 0 != 0 ]
+ __wait_for_device /dev/da1
+ local COUNT=0
+ head -c 1 /dev/da1
+ fsck_msdosfs -y /dev/da1
+ read LINE
+ __log '/dev/da1: fsck_msdosfs ** /dev/da1'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-03-19 17:41:24 '/dev/da1: fsck_msdosfs ** /dev/da1'
+ read LINE
+ __log '/dev/da1: fsck_msdosfs ** Phase 1 - Read and Compare FATs'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-03-19 17:41:24 '/dev/da1: fsck_msdosfs ** Phase 1 - Read and Compare FATs'
+ read LINE
+ __log '/dev/da1: fsck_msdosfs ** Phase 2 - Check Cluster Chains'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-03-19 17:41:24 '/dev/da1: fsck_msdosfs ** Phase 2 - Check Cluster Chains'
+ read LINE
+ __log '/dev/da1: fsck_msdosfs ** Phase 3 - Checking Directories'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-03-19 17:41:24 '/dev/da1: fsck_msdosfs ** Phase 3 - Checking Directories'
+ read LINE
+ __log '/dev/da1: fsck_msdosfs ** Phase 4 - Checking for Lost Files'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-03-19 17:41:24 '/dev/da1: fsck_msdosfs ** Phase 4 - Checking for Lost Files'
+ read LINE
+ __log '/dev/da1: fsck_msdosfs 63 files, 3611852 free (1951539 clusters)'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-03-19 17:41:24 '/dev/da1: fsck_msdosfs 63 files, 3611852 free (1951539 clusters)'
+ read LINE
+ __wait_for_device /dev/da1
+ local COUNT=0
+ head -c 1 /dev/da1
+ mount_msdosfs -o large -o longnames -m 644 -M 755 -D cp437 -L en_US.ISO8859-1 /dev/da1 /media/da1
mount_msdosfs: Unable to load iconv library: Shared object "libiconv.so" not found, required by "mount_msdosfs"
: No such file or directory
mount_msdosfs: msdosfs_iconv: No such file or directory
+ __log '/dev/da1: mount failed (fat) '\''mount_msdosfs  -o large -o longnames -D cp437 -L en_US.ISO8859-1 -m 644 -M 755 /dev/da1 /media/da1'\'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-03-19 17:41:24 '/dev/da1: mount failed (fat) '\''mount_msdosfs  -o large -o longnames -D cp437 -L en_US.ISO8859-1 -m 644 -M 755 /dev/da1 /media/da1'\'
+ exit 1

Note:
This procedure has been tried on brand new FreeBSD 9.0-RELEASE and FreeBSD 9.1-RELEASE operating systems with the same results. The FAT32 partition will not mount during boot. It will mount just fine using the "mount_msdosfs" command.

IMPORTANT:
Please use the exact same procedures (above) and format an 8GB partition (on a 8GB flash drive) with FAT32 using a Windows 7 operating system and tell me how you can possibly automount it during boot. Use FreeBSD 9.0-RELEASE or FreeBSD 9.1-RELEASE. Do not use STABLE or any other FreeBSD version when you try this experiment and get back with me on your results. Something is amiss with automount.

I'll tell you something else. Automount will not mount a NTFS partition during boot (using NTFS-3G) if "Subversion" is installed. Weird but true. Once you uninstall "Subversion", automount will mount NTFS partitions during boot (using NTFS-3G) with no issues whatsoever. Another thing: NTFS partitions can be mounted by hand (using the "ntfs-3g" executable) with or without "Subversion" installed. Don't know what's going on here, but automount has issues mounting partitions during the boot process. REMEMBER: I'm using automount on brand new operating systems.
 
Install converters/libiconv and try again.

Type this command on the command line and tell me if it works:
# mount_msdosfs -o large -o longnames -m 644 -M 755 -D cp437 -L en_US.ISO8859-1 /dev/da1 /media/da1
 
vermaden said:
Install converters/libiconv and try again.

converters/libiconv is already installed. When I try to re-install converters/libiconv, I receive the following error:

Code:
libiconv-1.14_1 is already installed

I did a "make deinstall" and a "make install clean" to reinstall it.

Type this command on the command line and tell me if it works:
# mount_msdosfs -o large -o longnames -m 644 -M 755 -D cp437 -L en_US.ISO8859-1 /dev/da1 /media/da1

I typed the command (above) and it mounts just fine.

What is automount colliding with (when its trying to mount a file system during boot)? How come I can mount manually, but automount won't mount a file system during boot? If I boot the system and then pull the flash drive out and plug it back in, automount will mount the file system with no problems. BTW: Are you testing automount with virtual machines (ex: "VMware")?
 
@vermaden

Thanks for your efforts, I find it good and easy to use.

But I found little problem with mounting flash cards with partitions, as the script seems to ignore device slices:
Code:
2013-04-02 16:36:19 /dev/da1: attach
2013-04-02 16:36:20 /dev/da1: filesystem not supported or no filesystem
As I found, default automount_devd.conf just checks for the main device, indeed:
Code:
  match "cdev" "(da|mmcsd)[0-9]+";
After replacing it with:
Code:
  match "cdev" "(da|mmcsd)[0-9].*";
all seem to work now:
Code:
2013-04-02 16:36:19 /dev/da1: attach
2013-04-02 16:36:20 /dev/da1: filesystem not supported or no filesystem
2013-04-02 16:36:20 /dev/da1s1: attach
2013-04-02 16:36:21 /dev/da1s1: mount (exfat)
Is it Ok to change?
 
Niatross said:
What is automount colliding with (when its trying to mount a file system during boot)? How come I can mount manually, but automount won't mount a file system during boot? If I boot the system and then pull the flash drive out and plug it back in, automount will mount the file system with no problems.
I implemented BOOTDELAY option (defaults to 45 seconds) to wait for boot process to complete and then mount the devices, check version from GITHUB: https://raw.github.com/vermaden/automount/master/automount

Niatross said:
BTW: Are you testing automount with virtual machines (ex: "VMware")?
Nope. Any issues with them?

larkind said:
@vermaden

Thanks for your efforts, I find it good and easy to use.
Welcome.

larkind said:
But I found little problem with mounting flash cards with partitions, as the script seems to ignore device slices:
Code:
2013-04-02 16:36:19 /dev/da1: attach
2013-04-02 16:36:20 /dev/da1: filesystem not supported or no filesystem
As I found, default automount_devd.conf just checks for the main device, indeed:
Code:
  match "cdev" "(da|mmcsd)[0-9]+";
After replacing it with:
Code:
  match "cdev" "(da|mmcsd)[0-9].*";
all seem to work now:
Code:
2013-04-02 16:36:19 /dev/da1: attach
2013-04-02 16:36:20 /dev/da1: filesystem not supported or no filesystem
2013-04-02 16:36:20 /dev/da1s1: attach
2013-04-02 16:36:21 /dev/da1s1: mount (exfat)
Is it Ok to change?
Yes. I also made that change 'upstream' (but with little difference "(da|mmcsd)[0-9]+.*" so da10could be used), so it wont be necessary in the future, if @Niatross will confirm that fix for boot is working, then I would start the 1.4.4 release process.
 
Last edited by a moderator:
vermaden said:
Yes. I also made that change 'upstream' (but with little difference "(da|mmcsd)[0-9]+.*" so da10could be used), so it wont be necessary in the future, if @Niatross will confirm that fix for boot is working, then I would start the 1.4.4 release process.

Thanks, @larkind and @vermaden!:)
I manually applied above fix (@vermaden's version) to my /usr/local/etc/devd/automount_devd.conf,
restart devd and then automount successfully mounts partitioned
MicroSD card and USB memstick.:)
But not tested with multi partitioned, multi filesystem medium. (Tested USB memstick is one created with FreeBSD-9.0-BETA3-i386-memstick.img, GPT partitioned and one of two partition is dedicated for gptboot, so having only one valid filesystem. All others are single partitioned)

Note that I'm using most recent version in ports tree.
 
Last edited by a moderator:
In 10-STABLE the file command was changed. Now the output is:

Code:
# file -b -L -s /dev/da0s1                                                  
DOS/MBR boot sector
In FreeBSD 9:
Code:
# file -b -L -s /dev/da0s1
x86 boot sector, code offset 0x0, OEM-ID "        ", sectors/cluster 64, reserved sectors 1294, Media descriptor 0xf8, heads 255, hidden sectors 8192, sectors 61822976 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 7545, reserved3 0x800000, serial number 0x90164ef8, unlabeled

Therefore under 10-STABLE automount writes to the log file:
Code:
2014-08-06 14:58:55 /dev/da0s1: attach
2014-08-06 14:58:55 /dev/da0s1: filesystem not supported or no filesystem
 
arachnid said:
In 10-STABLE the file command was changed.

This is output from 10-STABLE from 2014/06/10:
Code:
% file -b -L -s /dev/da0    
x86 boot sector; partition 1: ID=0xc, active, starthead 1, startsector 63, 15117102 sectors, code offset 0x31

% file -b -L -s /dev/da0s1
x86 boot sector, code offset 0x58, OEM-ID "BSD4.4  ", sectors/cluster 64, heads 255, sectors 15117102 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 1845, Backup boot sector 2, serial number 0xbe1d1b16, label: "STEEL      "

% uname -a
FreeBSD w530.domain.com 10.0-STABLE FreeBSD 10.0-STABLE #0 r267321: Tue Jun 10 13:53:21 CEST 2014     root@w530.domain.com:/usr/obj/usr/src/sys/GENERIC  amd64

Was that more recent change?
 
Yea, thanks from me, too, @vermaden :beergrin :beergrin . Updated to STABLE some time ago and just somehow only now noticed that auto mounting stopped working :q . But adding the '-k' fixed it. Why, life is always interesting!
 
Last edited by a moderator:
Hi vermaden I have a little problem with automount and I need your help. I installed it and I added the -k flag into the /usr/local/sbin/automount script. Also in my /etc/rc.conf file I added these lines:
Code:
devd_enable="YES"
fusefs_enable="YES"

In my /usr/local/etc/automount.conf I have this:
Code:
USERUMOUNT=YES
ATIME=YES
POPUP=YES
REMOVEDIRS=YES
FM="thunar"
USER=ember
ENCODING=pl_PL.ISO8859-2
CODEPAGE=cp852
MNTPREFIX=/media

My problem is that when I insert a USB, it doesn't mount automatically. I must run ember@FreeBSD / $ /usr/local/sbin/automount da0s1 attach to mount it on /media. It also returns me this:
Code:
/usr/local/sbin/automount: cannot create /var/log/automount.log: Permission denied
/usr/local/sbin/automount: cannot create /var/log/automount.log: Permission denied
/usr/local/sbin/automount: cannot create /var/log/automount.log: Permission denied

What did I miss?

I am running
Code:
FreeBSD FreeBSD 10.1-RC4 FreeBSD 10.1-RC4 #0 r273874: Fri Oct 31 08:49:44 UTC 2014  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
 
Hi vermaden I have a little problem with automount and I need your help. I installed it and I add -k flag into /usr/local/sbin/automount script.

Tha latest automount is always here:
https://github.com/vermaden/automount/

My problem is that when I instert a usb it doesn't mount automatically.

Show me your /usr/local/etc/devd/automount_devd.conf file.

I must run:
ember@FreeBSD / $ /usr/local/sbin/automount da0s1 attach
to be mounted on /media
Also return me this:
Code:
/usr/local/sbin/automount: cannot create /var/log/automount.log: Permission denied
/usr/local/sbin/automount: cannot create /var/log/automount.log: Permission denied
/usr/local/sbin/automount: cannot create /var/log/automount.log: Permission denied

What I miss?
The automount, when run by devd is run as 'root', user 'ember' does not have WRITE access to /var/log/automount.log file.
 
So remove
Code:
devd_enable="YES"
from /etc/rc.conf?

My /usr/local/etc/devd/automount_devd.conf file

Code:
notify 100 {
  match "system" "DEVFS";
  match "type" "CREATE";
  match "cdev" "(da|mmcsd)[0-9]+";
  action "/usr/local/sbin/automount $cdev attach";
};

notify 100 {
  match "system" "DEVFS";
  match "type" "DESTROY";
  match "cdev" "(da|mmcsd)[0-9]+";
  action "/usr/local/sbin/automount $cdev detach";
};
 
Last edited by a moderator:
So remove
Code:
devd_enable="YES"
from /etc/rc,conf?

The devd(8) daemon is enabled by default:
Code:
% grep devd /etc/defaults/rc.conf
devd_enable="YES"  # Run devd, to trigger programs on device tree changes.

My /usr/local/etc/devd/automount_devd.conf file

Code:
notify 100 {
  match "system" "DEVFS";
  match "type" "CREATE";
  match "cdev" "(da|mmcsd)[0-9]+";
  action "/usr/local/sbin/automount $cdev attach";
};

notify 100 {
  match "system" "DEVFS";
  match "type" "DESTROY";
  match "cdev" "(da|mmcsd)[0-9]+";
  action "/usr/local/sbin/automount $cdev detach";
};

Ok, the old one (worked because devd had a 'bug' ;)

Put this into that file:
Code:
notify 100 {
  match "system" "DEVFS";
  match "type" "CREATE";
  match "cdev" "(da|mmcsd)[0-9]+.*";
  action "/usr/local/sbin/automount $cdev attach";
};

notify 100 {
  match "system" "DEVFS";
  match "type" "DESTROY";
  match "cdev" "(da|mmcsd)[0-9]+.*";
  action "/usr/local/sbin/automount $cdev detach";
};

The difference is:
Code:
-  match "cdev" "(da|mmcsd)[0-9]+";
+  match "cdev" "(da|mmcsd)[0-9]+.*";

... and to be even more precise, this '.*' is missing at the end.
 
Worked perfect! My question is: Why the automount is on ports and not included into FreeBSD? Is just amazing. Uses devd, don't need X server to work and don't need any configuration to work. Is small, flexible and all this make it a wonderful solution!
 
Worked perfect! My question is: Why the automount is on ports and not included into FreeBSD? Is just amazing. Uses devd, don't need X server to work and don't need any configuration to work. Is small, flexible and all this make it a wonderful solution!
Ask FreeBSD Developers the same question, you know where the FreeBSD mailing lists are ;)

... and thanks by the way.
 
Hello,

I've been using automount 1.4.3 successfully for quite some time on FreeBSD 10.0-RELEASE, FreeBSD 9.3-RELEASE, and FreeBSD 9.2-RELEASE.

When FreeBSD 10.1-RELEASE was released this past week, I installed it on a second hard drive, and set[]up my standard desktop environment with Xfce to do some testing.

I installed automount using ports. I did not compile it with support for any of the special filesystems listed in the configuration options. I only use FAT (MSDOSFS) and UFS.

I made the appropriate changes to the /usr/local/etc/devd/automount_devd.conf file as shown in the thread above:

Code:
notify 100 {
  match "system" "DEVFS";
  match "type" "CREATE";
  match "cdev" "(da|mmcsd)[0-9]+.*";
  action "/usr/local/sbin/automount $cdev attach";
};

notify 100 {
  match "system" "DEVFS";
  match "type" "DESTROY";
  match "cdev" "(da|mmcsd)[0-9]+.*";
  action "/usr/local/sbin/automount $cdev detach";
};
I also have modified the /usr/local/etc/automount.config file as follows:
Code:
USERUMOUNT=YES
ATIME=NO
REMOVEDIRS=YES
FM="thunar"
USER=jda
ENCODING="en_US.ISO8859-1"
CODEPAGE="cp437"
I use this same configuration on my FreeBSD 10.0-RELEASE machine as well.

Using a USB memory stick that is formatted using the following commands (This works with my FreeBSD 10.0-RELEASE install with out any issue):

gpart destroy -F /dev/da0
gpart create -s mbr /dev/da0
gpart add -t \!12 /dev/da0
newfs_msdosfs -F32 /dev/da0s1

Gives me the following in the log file located in /var/log/automount.log when I insert the USB memory stick on my FreeBSD 10.1-RELEASE machine.

Code:
2014-11-16 15:31:22 /dev/da0: attach
2014-11-16 15:31:22 /dev/da0: filesystem not supported or no filesystem
2014-11-16 15:31:22 /dev/da0s1: attach
2014-11-16 15:31:22 /dev/da0s1: filesystem not supported or no filesystem
Any guesses as to what I may be doing wrong here?
 
I installed automount using ports. I did not compile it with support for any of the special filesystems listed in the configuration options. I only use FAT (MSDOSFS) and UFS.
Generally, the FreeBSD developers gave me very 'simple' choice: You have the automount package without exfat support or automount with exfat but without package.

Any guesses as to what I may be doing wrong here?
The distinction between FAT32 and NTFS is generally the hardest part of automount, sometimes it fails, because its not that simple.

Submit please the first 1024KB of this device, I will try do debug it.

But also try to use the latest automount version from here: https://github.com/vermaden/automount/
 
Back
Top