slackware 12.0, udev rules for usb-dev works, but mounting does not work correct
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
slackware 12.0, udev rules for usb-dev works, but mounting does not work correct
Slackware 12.0 , kernel 2.6.21.5-smp
I have a system that is going to handle different usb sticks for different purposes. Files are to be copied to the usb stick managed by perl script inside a web interface, i.e apache is the executing user. Now I have 3 usb-sticks to handle, I label the usb_sticks : ak_install1, ak_install2. ak_install3. Each stick has its entry in /etc/fstab, and each usb-stick has its own rule in /etc/udev/rules.d/10-local.rules
If I start /etc/rc.d/udev with the rules active mounting fails:
mount: wrong fs type, bad option, bad superblock on /dev/ak_install3,
missing codepage or other error
dmesg shows :
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev sdc2.
I have made udev rules for making them mount with these entries in /etc/fstab:
/dev/ak_install1 / mnt/ak_install1 vfat rw,users,owner,noauto,uid=apache,gid=apache 0 0
/dev/ak_install2 /mnt/ak_install2 vfat rw,users,owner,noauto,uid=apache,gid=apache 0 0
/dev/ak_install3 /mnt/ak_install3 vfat rw,users,owner,noauto,uid=apache,gid=apache 0 0
I have tried out different ways to restart udev to get a clue of what is going on here:
If for instance 'mount /mnt/ak_install3' fails;
mount: wrong fs type, bad option, bad superblock on /dev/ak_install3,
missing codepage or other error
if I deactivate the udev-rules in /etc/udev/rules.d/10-local.rules with # in front of the lines, then '/etc/rc.d/rc.udev restart', then open /etc/udev/rules.d/10-local.rules again and activate the rules by uncommenting, then again /etc/rc.d/rc.udev restart , the 'mount /mnt/ak_install3 mounts fine. But then if I change stick and 'mount /mnt/ak_install2 it fails. If I repeat the procedure of twice restarting udev with deactivated and then activated rules in /etc/udev/rules.d/10-local.rules and mount /mnt/ak_install2 it works for that stick, but not for the others.
I have tried to also with hal-daemon turned off, does not help.
If I deactivate the rules in /etc/udev/rules.d/10-local.rules and mount with 'mount -t vfat /dev/sdc1 /mnt/ak_install<1,2 or 3>' , all the sticks mounts fine, no problem. So I guessed the problem had to be the udev rules I made. But if I put in the sticks and run ''udevinfo -a -p $(udevinfo -q path -n /dev/ak_install<1,2 or 3) I get the correct output for each stick. So the rules are working fine, concerning recognition.
The problem excist weather I mount as apache or root.
Could anyone please give me a clue of where I can go from here?
Paal Marker
Last edited by paalmarker; 03-29-2010 at 06:12 AM.
ls -lh /dev/ak_install*
brwxrwxrwx 1 apache plugdev 8, 34 2010-03-29 09:53 /dev/ak_install2
This shows the GROUP= is not effective
I have tried out different ways to restart udev to get a clue of what is going on here:
If for instance 'mount /mnt/ak_install3' fails;
mount: wrong fs type, bad option, bad superblock on /dev/ak_install3,
missing codepage or other error
if I deactivate the udev-rules in /etc/udev/rules.d/10-local.rules with # in front of the lines, then '/etc/rc.d/rc.udev restart', then open /etc/udev/rules.d/10-local.rules again and activate the rules by uncommenting, then again /etc/rc.d/rc.udev restart , the 'mount /mnt/ak_install3 mounts fine. But then if I change stick and 'mount /mnt/ak_install2 it fails. If I repeat the procedure of twice restarting udev with deactivated and then activated rules in /etc/udev/rules.d/10-local.rules and mount /mnt/ak_install2 it works for that stick, but not for the others.
I'm not clear at what points in that test the devices are plugged and unplugged. A list would be easier to understand.
I would try:
Moving the rules file to 90-local.rules (so it is processed last and its intended effect is not removed by later rules)
Simplify the rules to only set the name (that is the thing least likely to cause breakage).
Test. If the mount works OK, add the USER= and retest, if that works add the GROUP= and retest.
Seems that by putting the local rules to last, 90-local.rules I am overriding some rules in the file 50-udev.rules. I can not see anything in that file though, that should be overruled by the rules in 90-local.rules:
ATTRS{serial}=="0019E02CCA0EA910095A40FD", NAME="ak_install1"
ATTRS{serial}=="001372997D4BA91009629318", NAME="ak_install2"
ATTRS{serial}=="0013729B6F4BA9100961E067", NAME="ak_install3"
By mounting now I get constant output message "mount: /dev/ak_install3 is not a block device" . Overriding /etc/fstab entries by .mount -t vfat /dev/ak_install2 /mnt/ak_install2 gives the same result.
Last edited by paalmarker; 03-29-2010 at 08:02 AM.
Seems that by putting the local rules to last, 90-local.rules I am overriding some rules in the file 50-udev.rules. I can not see anything in that file though, that should be overruled by the rules in 90-local.rules:
ATTRS{serial}=="0019E02CCA0EA910095A40FD", NAME="ak_install1"
ATTRS{serial}=="001372997D4BA91009629318", NAME="ak_install2"
ATTRS{serial}=="0013729B6F4BA9100961E067", NAME="ak_install3"
By mounting now I get constant output message "mount: /dev/ak_install3 is not a block device" . Overriding /etc/fstab entries by .mount -t vfat /dev/ak_install2 /mnt/ak_install2 gives the same result.
At least the experiments are having some effect! Keep poking it in different ways and study the outcome in the hope of gaining understanding -- same as CERN but a lot cheaper!
Might be worth examining the rules in /lib/udev/rules.d for possible inter-action. Might be worth changing your rule to set only USER and see what happens.
What little knowledge I have about udev comes from tinkering with Slackware 13.0 so details may vary.
OK, plugging in and out usb sticks to test....editing the rules files....restarting /etc/rc.d/rc.udev sometimes.... and I find that there is something very strange here.
I put in a usb-stick, try to mount it and get failure message: mount: wrong fs type, bad option, bad superblock on /dev/ak_install1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Dmesg again:
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev sdc2.
But now I discover that if I unplug the usb-stick, and then put it in again, try to mount, if failed then try again, then at last it mount successfully. But this is not due to failing hardware, as this problem I have only when udev rules are active.
All experiments done in udev since I started to work with it, seems to have made a salad of whole the udev configuration. During a reboot of the server I got lots of messages from udev showing that configuration is not correct, and after reboot the udevinfo command does not work either. Anyway, this server is to be reinstalled anyway in a couple of weeks. So until then I let this problem rest.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.