So i was watching tv; thinking about Plan9 and GNU/Hurd; when i decided to try ArchHurd as a live system from an usb device, and just then i remembered, that i haven’t taken time to setup automounting on my notebook yet. So i started up my trusty notebook, and was greeted with a fsck error, about not finding two devices. Because of the not working automounting, i had added my two usb hdds into /etc/fstab without setting nofail.
Yeah, pretty noobish. This was the first time i read the options for fstab…
Anyways, luckily the fsck message also said how to remount the root fs read/write… otherwise i might have had to get another pc to look that up aswell…
Sooo… finally i was in xfce and looked up the example rules on the arch wiki, as i found that i already had an automounting rule in my /etc/udev/rules.d/ and tried to get it to work.
As it seems the author mixed up %n with %k. %n is substituted with the device number, and %k with the kernelname. So if the kernel adds a device /dev/sdb1, %n would be 1 and %k would be sdb1. The mistake in the rule was, that the author used the following line to find out the label of the drive:
PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c"
blkid expects a device path instead. So if we want /dev/sdb1 to be mounted automagically, blkid needs /dev/sdb1 but gets 1.
The original rule:
KERNEL!="sd[a-z]*", GOTO="media_by_label_auto_mount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="media_by_label_auto_mount_end"
# Get label
PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c"
# use basename to correctly handle labels such as ../mnt/foo
PROGRAM=="/usr/bin/basename '%E{dir_name}'", ENV{dir_name}="%c"
ENV{dir_name}=="", ENV{dir_name}="usbhd-%k"
ACTION=="add", ENV{dir_name}!="", RUN+="/bin/su tomk -c '/usr/bin/pmount %N %E{dir_name}'"
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/su tomk -c '/usr/bin/pumount /media/%E{dir_name}'"
LABEL="media_by_label_auto_mount_end"
And the diff:
2c2
< ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="media_by_label_auto_mount_end"
---
> ACTION=="add", PROGRAM!="/sbin/blkid /dev/%k", GOTO="media_by_label_auto_mount_end"
5c5
< PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c"
---
> PROGRAM=="/sbin/blkid -o value -s LABEL /dev/%k", ENV{dir_name}="%c"
10c10
< ACTION=="add", ENV{dir_name}!="", RUN+="/bin/su tomk -c '/usr/bin/pmount %N %E{dir_name}'"
---
> ACTION=="add", ENV{dir_name}!="", RUN+="/bin/su tomk -c '/usr/bin/pmount /dev/%k %E{dir_name}'"
Also, don’t forget to change the username from tomk to your own in the last paragraph, and be sure you got pmount installed.
If that didn’t do the trick, try starting udev with its –debug parameter.








