LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 03-29-2010, 05:52 AM   #1
paalmarker
LQ Newbie
 
Registered: Jan 2007
Posts: 28

Rep: Reputation: 0
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



Udev rules:
/etc/udev/rules.d/10-local.rules:
ATTRS{serial}=="0019E02CCA0EA910095A40FD", NAME="ak_install1", OWNER="apache", GROUP="apache", MODE="0777"
ATTRS{serial}=="001372997D4BA91009629318", NAME="ak_install2", OWNER="apache", GROUP="apache", MODE="0777"
ATTRS{serial}=="0013729B6F4BA9100961E067", NAME="ak_install3", OWNER="apache", GROUP="apache", MODE="0777"

User permitions should absolutely be ok, for being sure that is not the problem I have set to wide open everywhere.

ls -lh /dev/ak_install*
brwxrwxrwx 1 apache plugdev 8, 34 2010-03-29 09:53 /dev/ak_install2

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.
 
Old 03-29-2010, 06:21 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by paalmarker View Post
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:
  1. Moving the rules file to 90-local.rules (so it is processed last and its intended effect is not removed by later rules)
  2. Simplify the rules to only set the name (that is the thing least likely to cause breakage).
  3. Test. If the mount works OK, add the USER= and retest, if that works add the GROUP= and retest.
  4. Update this thread

Last edited by catkin; 03-29-2010 at 06:22 AM.
 
Old 03-29-2010, 07:59 AM   #3
paalmarker
LQ Newbie
 
Registered: Jan 2007
Posts: 28

Original Poster
Rep: Reputation: 0
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.
 
Old 03-29-2010, 08:22 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by paalmarker View Post
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.

Last edited by catkin; 03-29-2010 at 08:23 AM.
 
Old 03-29-2010, 09:50 AM   #5
paalmarker
LQ Newbie
 
Registered: Jan 2007
Posts: 28

Original Poster
Rep: Reputation: 0
Thank you very much for your replies.

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.
 
Old 03-30-2010, 01:51 AM   #6
paalmarker
LQ Newbie
 
Registered: Jan 2007
Posts: 28

Original Poster
Rep: Reputation: 0
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] qemu group permission through udev rules for /dev/kqemu for slackware64 13.0 - how? btncix Slackware 1 09-28-2009 12:33 AM
Cannot get even the simplest of (self made) udev rules to work DiBosco Linux - General 10 11-30-2008 02:12 PM
udev rules Slackware 11 swampdog2002 Slackware 9 11-17-2006 07:06 PM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 03:43 AM
udev rules all_partitions doesn't work arubin Slackware 1 06-10-2006 05:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration