devd based AUTOMOUNTER

Is there a possibility to ignore certain devices? I am testing booting from USB stick (only /boot partition) with rest of the system on geli-encrypted disk. Since I installed automount (which works perfectly besides this, and thank you for providing it), it tries to mount already mounted da0p2 (which holds unencrypted /boot), and fscks it. It doesn't cause much trouble besides annoying warning in dmesg, but it would be nice to have certain device ignore option.
 
pacija said:
Is there a possibility to ignore certain devices? I am testing booting from USB stick (only /boot partition) with rest of the system on geli-encrypted disk. Since I installed automount (which works perfectly besides this, and thank you for providing it), it tries to mount already mounted da0p2 (which holds unencrypted /boot), and fscks it. It doesn't cause much trouble besides annoying warning in dmesg, but it would be nice to have certain device ignore option.
Interesting, I will check how to add simple IGNORE list to the config list.
 
@pacija

I had to refresh my 'knowledge' on what exactly automount does ;)

The automount checks if the device is already mounted, but I extended it to also check if something else is mounted in the 'to mount' generated directory.

So automount (even before this update) checks if /dev/da0p2 is already mounted and exits (of course there may be a BUG that makes that behavior different, to the fsck(8) point).

Before You update to the newer version, please do for me some debugging by typing these and send me the output back:
Code:
# /usr/local/sbin/automount da0p2 attach
# sh -x /usr/local/sbin/automount da0p2 attach

The sh -x does more debugging output.

I have also updated automount to 1.4.1 here:
https://github.com/vermaden/automount/commit/2f2e95942eb6e1c05acc345bcaafd3175b636249

Its not yet in the Ports tree.
 
The sysutils/automount in the latest 1.4.1 version just hit the ports (thanks Bryan).

Changelog since the 1.3.1 version:
- Added extended 'already mounted' checking.
- Added logging of FSCK output to the /var/log/automount.log file.
- Added error logging of failed mounts with used mount(8) command.
- Added +s bit for /sbin/mount* when USERUMOUNT is set to YES.
- Properly display the already mounted directory with spaces.
- Wait shorter amount of time to mount device faster.
- Improved readability of the generated /var/log/automount.log file
 
vermaden said:
@pacija

Before You update to the newer version, please do for me some debugging by typing these and send me the output back:
Code:
# /usr/local/sbin/automount da0p2 attach
# sh -x /usr/local/sbin/automount da0p2 attach

The sh -x does more debugging output.

Here it is:
Code:
root@kaa:/ # /usr/local/sbin/automount da0p2 attach
** /dev/da0p2 (NO WRITE)

USE JOURNAL? no

** Skipping journal, falling through to full fsck

SETTING DIRTY FLAG IN READ_ONLY MODE

UNEXPECTED SOFT UPDATE INCONSISTENCY
** Last Mounted on /boot2
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
1362 files, 41923 used, 901235 free (171 frags, 112633 blocks, 0.0% fragmentation)
mount: /media/da0p2: unknown special file or file system

Code:
root@kaa:/ # sh -x /usr/local/sbin/automount da0p2 attach
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin: <cutting it here to preserve forum table>
+ [ da0p2 = -h -o da0p2 = --help -o 2 -eq 0 -o 2 -eq 1 ]
+ [ -f /usr/local/etc/automount.conf ]
+ . /usr/local/etc/automount.conf
+ USERUMOUNT=YES
+ USER=pacija
+ : /media
+ : /var/log/automount.log
+ : /var/run/automount.state
+ : en_US.ISO8859-1
+ : cp437
+ : %Y-%m-%d %H:%M:%S
+ : YES
+ : YES
+ : NO
+ : pacija
+ : 0
+ [ YES = YES ]
+ chmod u+s /sbin/umount
+ DEV=/dev/da0p2
+ ADD=0
+ MNT=/media/da0p2
+ __check_already_mounted /media/da0p2
+ mount
+ grep ' /media/da0p2 '
+ [ YES = NO ]
+ file -b -L -s /dev/da0p2
+ sed -E 's/label:\ \".*\"//g'
+ __create_mount_point /dev/da0p2
+ mkdir -p /media/da0p2
+ [ pacija = 0 ]
+ id -g -n pacija
+ chown pacija:pacija /media/da0p2
+ fsck_ufs -C -y /dev/da0p2
** /dev/da0p2 (NO WRITE)

USE JOURNAL? no

** Skipping journal, falling through to full fsck

SETTING DIRTY FLAG IN READ_ONLY MODE

UNEXPECTED SOFT UPDATE INCONSISTENCY
** Last Mounted on /boot2
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
1362 files, 41923 used, 901235 free (171 frags, 112633 blocks, 0.0% fragmentation)
+ mount -o /dev/da0p2 /media/da0p2
mount: /media/da0p2: unknown special file or file system
+ __log '/dev/da0p2:mount (ufs)'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-01-10 23:59:14 /dev/da0p2:mount '(ufs)'
+ [ 0 -eq 1 ]

I also have line in fstab:
Code:
/dev/da0p2		/boot2		ufs		rw	1 1

Perhaps it could be relevant?
 
pacija said:
Perhaps it could be relevant?
Yup, it is, the new version 1.4.1 has this fixed, use it and tell me how it works for You.

In the automount 1.3.1 there was a check for the mountpoint, not the device, check if its mounted of course:

Code:
+ chmod u+s /sbin/umount
+ DEV=/dev/da0p2
+ ADD=0
+ MNT=/media/da0p2
[color="Red"]+ __check_already_mounted /media/da0p2[/color]

... but as /dev/da0p2 is mounted to /boot2 and /media/da0p2 is not mounted ... it moved along with filesystem detection and then, the fsck.

The 1.4.1 automount check BOTH if the devd(8) appeared device is mounted and also the generated mountpoint.
 
After the upgrade to 1.4.1 two of my 3 PCs (one running 9.1-STABLE, the other one with 10.0-CURRENT) hang at boot during start of devd daemon. When I hit CTRL-C, it proceeds. On my 3rd PC (with 9.1-RELEASE) it starts as before. Any reason that would happen?
It seems that it interferes with webcamd. When webcamd isn't enabled or automount is uninstalled, it's ok.
 
pkubaj said:
After the upgrade to 1.4.1 two of my 3 PCs (one running 9.1-STABLE, the other one with 10.0-CURRENT) hang at boot during start of devd daemon. When I hit CTRL-C, it proceeds. On my 3rd PC (with 9.1-RELEASE) it starts as before. Any reason that would happen?
It seems that it interferes with webcamd. When webcamd isn't enabled or automount is uninstalled, it's ok.

Please use this as /usr/local/etc/devd/automount_devd.conf file and show me the contents of the generated /root/DEBUG.* logs after the crash.

Code:
% [color="Blue"][B]cat /usr/local/etc/devd/automount_devd.conf[/B][/color]
notify 200 {
  match "system" "DEVFS";
  match "type" "CREATE";
  match "cdev" "(da|mmcsd)[0-9]+";
  action "/bin/sh -xe /usr/local/sbin/automount $cdev attach >> /root/DEBUG.$cdev.attach 2>&1";
};

notify 200 {
  match "system" "DEVFS";
  match "type" "DESTROY";
  match "cdev" "(da|mmcsd)[0-9]+";
  action "/bin/sh -xe /usr/local/sbin/automount $cdev detach >> /root/DEBUG.$cdev.detach 2>&1";
};
 
@pkubaj

I do not see anything bad with automount, it just probes device, submit a BUG to the FreeBSD team please.
 
It seems that the issue is caused by embedded card reader. The slots from it are in /dev/ as /dev/da*, even though no card is in. automount is trying to mount these, which obviously fails. The option to ignore some devices would help.
 
pacija said:
1.4.1 solved my problem. Thanks!
Good ;)

pkubaj said:
It seems that the issue is caused by embedded card reader. The slots from it are in /dev/ as /dev/da*, even though no card is in. automount is trying to mount these, which obviously fails. The option to ignore some devices would help.

This is not excuse for FreeBSD. No system should panic because something tries to access the devices placed in /dev, its still a BUG and placing a workaround here is not the best solution.

Also, as the card reader uses the same devices as USB disks (/dev/da*) how one can tell the difference?

Submit the FreeBSD Problem Report with as much possible data as You can.
 
automount "options"

I noticed the following message after typing "automount " or "automount --help":

Code:
It needs these ports to mount NTFS/exFAT/EXT4 respectively:
 o sysutils/fusefs-ntfs
 o sysutils/fusefs-exfat
 o sysutils/fusefs-ext4fuse

Are you going to make these "options" available when you install the sysutils/automount port or is the user always going to be responsible for installing these ports?

I don't need to install the sysutils/fusefs-ntfs port if I only need to "read" an NTFS partition, correct?

How do you find out what version of sysutils/automount you have installed (other than pkg_info)? Is there a hidden switch (ex: --version")?
 
Niatross said:
I noticed the following message after typing "automount " or "automount --help":

Code:
It needs these ports to mount NTFS/exFAT/EXT4 respectively:
 o sysutils/fusefs-ntfs
 o sysutils/fusefs-exfat
 o sysutils/fusefs-ext4fuse

Are you going to make these "options" available when you install the sysutils/automount port or is the user always going to be responsible for installing these ports?

I should, I will look into other ports and check how to do that.

Niatross said:
I don't need to install the sysutils/fusefs-ntfs port if I only need to "read" an NTFS partition, correct?
Correct.

The automount checks if You have ntfs-3g, and if You have it, then it mounts R/W, if not, then uses mount_ntfs and mounts R/O.

Niatross said:
How do you find out what version of sysutils/automount you have installed (other than pkg_info)? Is there a hidden switch (ex: --version")?
I did not see a point in adding that, but I can add --version, should be easy to implement ;)
 
I just installed the sysutils/fusefs-ntfs port and now automount does not automatically mount my NTFS partition on my USB flash drive.

Before I installed the sysutils/fusefs-ntfs port, automount was mounting my NTFS partition (as read-only) just fine.

What has changed?

I did put the following line in my /etc/rc.conf file and rebooted but the NTFS partition on my USB flash drive is not automatically mounting:

Code:
fusefs_enable="YES"

If I run the following command, I have no problem mounting my NTFS partition (as read/write) on my USB flash drive:

Code:
ntfs-3g /dev/da1s1 /media/da1s1
 
Niatross said:
What has changed?
Nothing. I use the same setup (have ntfs-3g installed) and it works without any problem.

Put this content as /usr/local/etc/devd/automount_devd.conf file and do /etc/rc.d/devd restart:

Code:
notify 200 {
  match "system" "DEVFS";
  match "type" "CREATE";
  match "cdev" "(da|mmcsd)[0-9]+";
  action "/bin/sh -xe /usr/local/sbin/automount $cdev attach >> /root/DEBUG.$cdev.attach 2>&1";
};

notify 200 {
  match "system" "DEVFS";
  match "type" "DESTROY";
  match "cdev" "(da|mmcsd)[0-9]+";
  action "/bin/sh -xe /usr/local/sbin/automount $cdev detach >> /root/DEBUG.$cdev.detach 2>&1";
};

This will create debug output as /root/DEBUG.* files, which You can send me to debug the problem.
 
Vermaden,

Let's cut to the chase here. I could be doing this all wrong. Please give me the exact steps to make this work. I want to use the sysutils/fusefs-ntfs with your automount utilty. Please tell me the files that I need to configure. I don't even know if I need to add the following setting to the /etc/rc.conf file:

Code:
fusefs_enable="YES"

I'm just guessing I need to add this (otherwise I'll get a device error). Anyway, do I need to add the setting (above) to the /etc/rc.conf file?

What other settings do I need to add to /etc/rc.conf to make this work? Also, do I need to create any symbolic links or changes to other configuration files?

Treat me like I am an idiot.

There is absolutely no instructions on how to make this work. Can you give me step-by-step instructions?

Obviously I made "automount" work with the built-in read-only NTFS driver, but I can't get it to work with NTFS-3G. It's probably one setting that I'm missing in one configuration file in order to get it to work. Can you please just verify the steps, before I even try DEBUG troubleshooting.

I shouldn't have to add anything into the /etc/fstab file, right? I didn't have to add anything to the /etc/fstab file when I made automount work with the built-in read-only NTFS driver.
 
@rohitewebtech
@Niatross

Well gentlemen, this is my setup:

Nothing about fuse/automount in /boot/loader.conf or /etc/fstab file.

Option fusefs_enable=YES in /etc/rc.conf file.

These are my fuse-related packages:
Code:
% pkg info | grep fuse
fusefs-exfat-1.0.0             Full-featured exFAT FS implementation as a FUSE module
fusefs-ext4fuse-0.1.3,1        EXT4 implementation for FUSE
fusefs-kmod-0.3.9.p1.20080208_11 Kernel module for fuse
fusefs-libs-2.9.2              FUSE allows filesystem implementation in userspace
fusefs-ntfs-2012.1.15          Mount NTFS partitions (read/write) and disk images

Also various fsck.ext* from sysutils/e2fsprogs port:
Code:
% pkg info | grep e2fs
e2fsprogs-1.42.7               Utilities & library to manipulate ext2/3/4 filesystems
e2fsprogs-libuuid-1.42.7       UUID library from e2fsprogs package

The instructions to setup automount are:
Code:
# make -C /usr/ports/sysutils/automount distclean install clean
 
pkubaj said:
The option to ignore some devices would help.

Indeed, I have similar / same problem on a HP Compaq dx 7400 Minitower which comes with card reader that creates da0 - da4 even when there is no card inserted.

I installed automount and newly inserted USB stick got mounted fine as da5s1. Few days later when I rebooted, the boot process stopped after mounting local disks. No hang, no panic, just stood there as it was waiting. It took input from keyboard, but wouldn't continue all the way to the prompt. I had to reboot into single user mode, uninstall automount, and after that system booted fine.
 
pacija said:
Indeed, I have similar / same problem on a HP Compaq dx 7400 Minitower which comes with card reader that creates da0 - da4 even when there is no card inserted.

I installed automount and newly inserted USB stick got mounted fine as da5s1. Few days later when I rebooted, the boot process stopped after mounting local disks. No hang, no panic, just stood there as it was waiting. It took input from keyboard, but wouldn't continue all the way to the prompt. I had to reboot into single user mode, uninstall automount, and after that system booted fine.

Is there a way to check which da* nodes were created by the smart card reader?

A question to FreeBSD developers, why create device nodes (da*) when there is no medium in the reader?
 
Maybe it is hardware related. My laptop Asus N53JQ also comes with integrated card reader, but it does not create device nodes until card is inserted. Mentioned HP minitower behaves the same on Windows - it shows volumes ( E: F: G: H: ) even when cards are not inserted.
 
pacija said:
Maybe it is hardware related. My laptop Asus N53JQ also comes with integrated card reader, but it does not create device nodes until card is inserted. Mentioned HP minitower behaves the same on Windows - it shows volumes ( E: F: G: H: ) even when cards are not inserted.

I will look into the blacklisting and update the automount with that option, I will post update here when ready.
 
@pacija

I have implemented BLACKLIST option, use it like that in the default config /usr/local/etc/automount.conf file:
BLACKLIST="da0 da3 da1"

... other valid syntax examples:
BLACKLIST="da0"
BLACKLIST="da0 ada0"
BLACKLIST="da0 ada0 da2 da3a da4s1a"

The latest automount is available here:
https://raw.github.com/vermaden/automount/master/automount

If You have automount-1.4.1 installed from Ports, then do that:
# fetch -o /usr/local/sbin/automount [url]https://raw.github.com/vermaden/automount/master/automount[/url]
# chmod +x /usr/local/sbin/automount

To test if the update succeed, do that:
# /usr/local/sbin/automount --version

If You see this string below, then its ok:
Code:
automount 1.4.2 2013/02/13



Tell me how that works for You please.
 
Back
Top