devd based AUTOMOUNTER

Personally, I'd rather have a list of devices that the automounter checks, rather than blacklist a bunch of others. The combination of the two would be useful:

Code:
DEVICES="da*"
IGNORE="da2 da5"

So that would automount all da devices except da2 and da5.
 
vermaden,

Attached are the log files...

Please see post #66 for details on the problem.
 

Attachments

  • DEBUG.da1.attach.txt
    3 KB · Views: 267
  • DEBUG.da1s1.attach.txt
    4.2 KB · Views: 254
  • DEBUG.da1s1.detach.txt
    833 bytes · Views: 237
Lets start with the good news, thanks to Bryan the automount1.4.2 just hit the Ports: http://freshports.org/sysutils/automount

Changelog:
- Added BLACKLIST option to ignore problematic devices.
- Implement sleep/wait with TIMEOUT for devices that not appear.
- Add more useful information to /var/log/automount.log file.


wblock@ said:
Personally, I'd rather have a list of devices that the automounter checks, rather than blacklist a bunch of others. The combination of the two would be useful:

Code:
DEVICES="da*"
IGNORE="da2 da5"

So that would automount all da devices except da2 and da5.

The list of devices, that are passed to automount are [font="Courier New"]configured[/font] in devd(8) configuration, not in automount:

Code:
[font="Courier New"]% [color="Blue"][B]cat /usr/local/etc/devd/automount_devd.conf [/B][/color]
notify 100 {
  match "system" "DEVFS";
  match "type" "CREATE";
[B][color="Magenta"]  match "cdev" "(da|mmcsd)[0-9]+";[/color][/B]
  action "/usr/local/sbin/automount $cdev attach";
};

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

About IGNORE, it works the way You want it to ;)

Niatross said:
Attached are the log files...

Please see post #66 for details on the problem.

These two:
Code:
mount_msdosfs: Unable to load iconv library: Shared object "libiconv.so" not found, required by "mount_msdosfs"
mount_msdosfs: msdosfs_iconv: No such file or directory

can be solved by adding these to /boot/loader.conf file:
Code:
libiconv_load=YES
cd9660_iconv_load=YES
msdosfs_iconv_load=YES
ntfs_iconv_load=YES
udf_iconv_load=YES

I am not able to detect NTFS problem (the other attached log).

About that one:
Code:
+ grep -E '/media/da1s1$' /var/run/automount.state
+ read DEV PROVIDER MNT
grep: /var/run/automount.state: No such file or directory

I have added additional check if /var/run/automount.state file exists, now it should be fine.

These changes will be available in automount 1.4.3 (not yet in Ports as 1.4.2 just hit the Ports).type
 
vermaden said:
These two:
Code:
mount_msdosfs: Unable to load iconv library: Shared object "libiconv.so" not found, required by "mount_msdosfs"
mount_msdosfs: msdosfs_iconv: No such file or directory

can be solved by adding these to /boot/loader.conf file:
Code:
libiconv_load=YES
cd9660_iconv_load=YES
msdosfs_iconv_load=YES
ntfs_iconv_load=YES
udf_iconv_load=YES
Same" msdosfs" error messages show up after I load the "iconv" lines (above) in my /boot/loader.conf. BTW: I rebooted to make sure they loaded. The kldstat utility shows that they are loaded.

About that one:
Code:
+ grep -E '/media/da1s1$' /var/run/automount.state
+ read DEV PROVIDER MNT
grep: /var/run/automount.state: No such file or directory

I have added additional check if /var/run/automount.state file exists, now it should be fine.

These changes will be available in automount 1.4.3 (not yet in ports as 1.4.2 just hit the ports)

There is no automount.state file in the "/var/run" directory. There never has been. I've uninstalled your software and re-installed it. Same old thing. Doesn't work. Receiving the same errors. Maybe I need to re-install the operating system. Obviously something is wrong. I am using 9.0-RELEASE-p4.
 
Niatross said:
Same" msdosfs" error messages show up after I load the "iconv" lines (above) in my /boot/loader.conf. BTW: I rebooted to make sure they loaded. The kldstat utility shows that they are loaded.
It helped me to solve the problem, worked ever since, I dunno what to track next about that issue, submit a PR?

Do these errors also occur on command line when You try to do the same mount_msdosfs command?

Niatross said:
There is no automount.state file in the "/var/run" directory. There never has been.

After reboot there is no /var/run/automount.state file. The file is created when You got a successful mount with automount, later it will exist, can be empty (no mounted external drives) or not. It is definitely not a permissions problem, because automount is run as root (same as devd).

Niatross said:
I've uninstalled your software and re-installed it. Same old thing. Doesn't work. Receiving the same errors.

Maybe I need to re-install the operating system. Obviously...something is wrong. I am using 9.0-RELEASE-p4

Put that into the /usr/local/etc/devd/automount_devd.conf file and restart devd(8):
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";
};

%


Then remove /root/DEBUG.*.attach and /root/DEBUG.*.detach files and also /var/log/automount.log file.

Then plug in the problematic pendrive/disk, remove it and then send me those logs, both /root/DEBUG* and automount.log (can be PASTEBIN or whatever else).
 
vermaden,

A question:

I currently have the following in the /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";
}; does it stay there all the time

I thought the following notify 200 lines was a temporary thing that was placed in the /usr/local/etc/devd/automount_devd.conf file to generate some debug files for troubleshooting:

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";
};

Once the person is done generating debug files, does that person go back and remove the notify 200 lines and place the original notify 100 lines back into the /usr/local/etc/devd/automount_devd.conf file?
 
vermaden,

Does webcamd interfere with your software?

I have the following error:

Code:
Cannot 'start' webcamd. Set webcamd_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'.

Why is webcamd even coming up during boot? I didn't load this software. I notice that there is a webcamd.conf file sitting in my /usr/local/etc/devd directory. How did that get there?

How do I get rid of webcamd? I don't even want it. Did some other software that I installed install webcamd?
 
Here are some messages I receive during boot:

Code:
Cannot 'start' webcamd. Set webcamd_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'.
mount_msdosfs: Unable to load iconv library: Shared object "libiconv.so" not found, required by "mount_msdosfs"
mount_msdosfs: msdosfs_iconv: No such file or directory
ntfs-3g: No mountpoint is specified.
grep: /var/run/automount.stste: No such file or directory
ntfs-3g: No mountpoint is specified.

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

Code:
ntfs-3g /dev/da1s1 /media/da1s1

Something is stopping your software from automounting my NTFS flash drive at boot.
 
vermaden,

Here are my attached log files...
 

Attachments

  • DEBUG.da1s1.detach.txt
    1.8 KB · Views: 258
  • DEBUG.da1s1.attach.txt
    10.9 KB · Views: 253
  • DEBUG.da1.attach.txt
    3.5 KB · Views: 251
  • automount.log.txt
    895 bytes · Views: 257
TL;DR
There were 2 bugs, one innocent (just error message), second one prevented automount from working if You do not use ATIME=ON. The latest fixed version is available at GITHUB: https://raw.github.com/vermaden/automount/master/automount

Fastest fix:
Code:
# fetch -o /usr/local/sbin/automount https://raw.github.com/vermaden/automount/master/automount

DIFF(s):
Code:
https://github.com/vermaden/automount/commit/6475a583f395926b4584a1941d2f30e4a2c37948


Now to replies ... ;)

segfault said:
In Ports?!?! Whoohoo!
Love your work here, thanks a lot V.

Thanks mate.



Niatross said:
Once the person is done generating debug files, does that person go back and remove the notify 200 lines and place the original notify 100 lines back into the /usr/local/etc/devd/automount_devd.conf file?
I mislooked that, it does not matter, You can use 100 for both or 200 for both, its just different 'event number'.

From man devd.conf page
Code:
     The “notify” variable is available inside this statement and contains, a
     value, depending on which system and subsystem that delivered the event.

Niatross said:
Does webcamd interfere with your software?
Dunno, I never user webcamd, but in theory, it should not interfere.


Niatross said:
How do I get rid of webcamd? I don't even want it. Did some other software that I installed install webcamd?
Remove webcamd package? ;)

Niatross said:
mount_msdosfs: Unable to load iconv library: Shared object "libiconv.so" not found, required by "mount_msdosfs"

Interesting, mount_msdosfs does not require libiconv.so library:
Code:
% ldd $( which mount_msdosfs )
/sbin/mount_msdosfs:
        libkiconv.so.4 => /lib/libkiconv.so.4 (0x80081c000)
        libc.so.7 => /lib/libc.so.7 (0x800a1f000)

Maybe You need libiconv package installed? (I have it installed, but dunno if that is needed for automount):
Code:
% find /usr/local/lib -name libiconv.so
/usr/local/lib/libiconv.so

% pkg which /usr/local/lib/libiconv.so
/usr/local/lib/libiconv.so was installed by package libiconv-1.14

Niatross said:
Code:
ntfs-3g: No mountpoint is specified.
grep: /var/run/automount.stste: No such file or directory
ntfs-3g: No mountpoint is specified.
Something is stopping your software from automounting my NTFS flash drive at boot.
This is fixed, check TL;DR at the beginning of this post..

Niatross said:
Here are my attached log files...

Code:
2013-03-05 13:48:08 /dev/da1: fsck_msdosfs ** /dev/da1
2013-03-05 13:48:08 /dev/da1: [color="Red"][B]fsck_msdosfs Invalid sector size: 190[/B][/color]
2013-03-05 13:48:08 /dev/da1: mount failed (fat) 'mount_msdosfs -o large -D cp437 -L en_US.ISO8859-1 -m 644 -M 755 /dev/da1 /media/da1'

Seems like broken filesystem:
http://lists.freebsd.org/pipermail/freebsd-questions/2010-August/220488.html

I would move the data from this drive, create new filesystem with newfs_msdos and try again.


Niatross said:
+ ntfs-3g -o /dev/da1s1 /media/da1s1
ntfs-3g: No mountpoint is specified.
You just nailed a BUG (check TL;DR) :)

The -o option is empty, because ATIME is not disabled, and the code was ntfs-3g -o ${OPTS} so with empty OPTS it failed. Now it is OPTS="-o noatime" and ntfs-3g ${OPTS}.



Niatross said:
Why is msdosfs even being used when this flash drive only has one NTFS partition on it?



Could You also provide me output of these commands:
Code:
# file -b -L -s /dev/da1s1
# file -b -L -s /dev/da1
 
The [cmd=]file -b -L -s /dev/da1s1[/FILE][/cmd] command displays the following results:

Code:
x86 boot sector, code offset 0x52, OEM-ID "NTFS    ", reserved sectors 0, Media descriptor 0xf8, heads 255, hidden sectors 2048, dos < 4.0 BootSector (0x0)

The [cmd=]file -b -L -s /dev/da1[/cmd] command displays the following results:

Code:
x86 boot sector; partition 1: ID=0x7, starthead 32, startsector 2048, 8388608 sectors, code offset 0xc0, OEM-ID "      \320\274", Bytes/sector 190, sectors/cluster 124, reserved sectors 191, FATs 6, root entries 185, sectors 64514 (volumes <=32 MB) , Media descriptor 0xf3, sectors/FAT 20644, heads 6, hidden sectors 309755, sectors 2147991229 (volumes > 32 MB) , physical drive 0x7e, dos < 4.0 BootSector (0x0)
 
@Niatross

Thanks.

Just to be sure, this da0s1 partition containt NTFS filesystem?

Does the latest automount (from previous post) fixes problems Your problems?
 
vermaden,

Yes. Your latest automount fixes the bug listed above (TL;DR).

I also cleared up the following error by creating a new file system:

Code:
fsck_msdosfs Invalid sector size: 190

The only problem left is:

Code:
+ mkdir -p /media/da1
+ [ 0 != 0 ]
+ __wait_for_device /dev/da1
+ local COUNT=0
+ head -c 1 /dev/da1
+ which ntfs-3g
+ __wait_for_device /dev/da1
+ local COUNT=0
+ head -c 1 /dev/da1
+ ntfs-3g /dev/da1 /media/da1
fuse: failed to open fuse device: No such file or directory
+ __log '/dev/da1: mount failed (ntfs) '\''ntfs-3g  /dev/da1 /media/da1'\'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-03-06 19:24:14 '/dev/da1: mount failed (ntfs) '\''ntfs-3g  /dev/da1
/media/da1'\'
+ exit 1

The error (above) was taken from "DEBUG.da1.attach". This error only occurs during boot. If I stick the NTFS flash drive in after boot, automount mounts the NTFS flash drive and it works fine.

The /var/log/automount.log file displays the following:

Code:
2013-03-06 19:24:14 /dev/da1: attach
2013-03-06 19:24:14 /dev/da1: mount failed (ntfs) 'ntfs-3g  /dev/da1 /media/da1'

Code:
%kldstat
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
 
Niatross said:
Code:
+ ntfs-3g /dev/da1 /media/da1
fuse: failed to open fuse device: No such file or directory

The error (above) was taken from "DEBUG.da1.attach". This error only occurs during boot. If I stick the NTFS flash drive in after boot, automount mounts the NTFS flash drive and it works fine.

Startup scripts from RCng are started in particular order, this ca be check by rcorder:

Code:
% [color="RoyalBlue"]rcorder /etc/rc.d/* /usr/local/etc/rc.d/* 2> /dev/null | wc -l[/color]
     183

% [color="royalblue"]rcorder /etc/rc.d/* /usr/local/etc/rc.d/* 2> /dev/null | grep -n fusefs[/color]
116:/usr/local/etc/rc.d/fusefs

% [color="royalblue"]rcorder /etc/rc.d/* /usr/local/etc/rc.d/* 2> /dev/null | grep -n devd[/color]
36:/etc/rc.d/devd
... so in short words, there are 183 scripts to be started at boot (on my system), fusefs will be started as 116 but devd will be started earlier as 36 one. So when devd runs automount the FUSE kernel modules are not yet loaded because they are to be loaded later, and hence the error.

There is sollution for this, add fuse_load=YES to /boot/loader.conf so the FUSE subsystem kernel module will be loaded before devd starts its existenece at boot.
 
I ran the following command and received an "ambiguous output redirect" error:

Code:
rcorder /etc/rc.d/* /usr/local/etc/rc.d/* 2> /dev/null | wc -l

Anyway, I placed "fuse_load=YES" in the "/boot/loader.conf" file and rebooted the system and "automount" still does not mount my NTFS flash drive on startup.
 
Niatross said:
I ran the following command and received an "ambiguous output redirect" error
This is because You use CSH/TCSH shell, the CSH/TCSH shell is kinda retarded:
http://www.shlomifish.org/open-source/anti/csh/
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
http://www.grymoire.com/Unix/CshTop10.txt
http://www-uxsup.csx.cam.ac.uk/misc/csh.html

Niatross said:
Anyway, I placed "fuse_load=YES" in the "/boot/loader.conf" file and rebooted the system and "automount" still does not mount my NTFS flash drive on startup.
What does automount logs say now?
 
What does automount logs say now?

Code:
+ 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
+ which ntfs-3g
+ __wait_for_device /dev/da1
+ local COUNT=0
+ head -c 1 /dev/da1
+ ntfs-3g /dev/da1 /media/da1
Error opening '/dev/da1': Operation not permitted
Failed to mount '/dev/da1': Operation not permitted
The NTFS partition is hibernated. Please resume and shutdown Windows
properly, or mount the volume read-only with the 'ro' mount option, or
mount the volume read-write with the 'remove_hiberfile' mount option.
For example type on the command line:

            mount -t ntfs-3g -o remove_hiberfile /dev/da1 /media/da1

+ __log '/dev/da1: mount failed (ntfs) '\''ntfs-3g  /dev/da1 /media/da1'\'
+ date '+%Y-%m-%d %H:%M:%S'
+ echo 2013-03-07 02:24:36 '/dev/da1: mount failed (ntfs) '\''ntfs-3g  /dev/da1 /media/da1'\'
+ exit 1
 
Niatross said:
Code:
+ ntfs-3g /dev/da1 /media/da1
Error opening '/dev/da1': Operation not permitted
Failed to mount '/dev/da1': Operation not permitted
The NTFS partition is hibernated. Please resume and shutdown Windows
properly, or mount the volume read-only with the 'ro' mount option, or
mount the volume read-write with the 'remove_hiberfile' mount option.
For example type on the command line:

            mount -t ntfs-3g -o remove_hiberfile /dev/da1 /media/da1

I have added -o remove_hiberfile option to NTFS-3G mount, check the latest version from GITHUB:
Code:
https://raw.github.com/vermaden/automount/master/automount

Fastest fix:
Code:
# fetch -o /usr/local/sbin/automount https://raw.github.com/vermaden/automount/master/automount

If it still does not work, send me automount logs ;)
 
Niatross said:
That didn't help.

It looks like "automount" (and/or "ntfs-3g") is not creating "/dev/fuse0".

Any logs on that topic?

There is no possible way for automount to create /dev/fuse0, its not something that automount can do. After loading fuse.ko the /dev/fuse0 should be creted, have You tried to reuild fusefs-kmod package with portmaster?
 
Any logs on that topic?

Logs are attached...

After loading fuse.ko, the /dev/fuse0 should be created.

Well, the /dev/fuse0 is not getting created. The kldstat utility confirms fuse.ko is loaded, but the /dev/fuse0 is not getting created.

Have You tried to rebuild fusefs-kmod package with portmaster?

No I haven't.
 

Attachments

  • automount.log.txt
    1.7 KB · Views: 267
  • DEBUG.da1.attach.txt
    6 KB · Views: 242
  • DEBUG.da1.detach.txt
    578 bytes · Views: 228
Back
Top