# Udev frustration

## iainvt

Hi, well I tried to make the move to udev, emerge udev, baselayout etc, put gentoo=nodevfs in the boot loader for kernel 2.6.8-r3, left the devfs and tarball options as yes, am I being a bit thick, I still dont know what I am supposed to do to get an icon appear on my desktop to say "I have recognised your mass storage usb device, click me and browse your files". 

Sorry long nights getting this box to work. What do mandrake do to make this happen? what am I missing. Am I going nuts??

----------

## G2k

Did you modify your kernel? Did you get rid of devfs support? Did you mount your device? Did you create the directory for the device? Say it's a usb stick, you would have to do something like

```
mkdir /mnt/usb
```

and then mount it either manually or by adding a line such as the following to your /etc/fstab

```
/dev/sda1               /mnt/usb        auto            noauto,users            0 0
```

once you did that, to mount it you would have to type in the terminal

```
mount /mnt/usb
```

then check and see if the stuff on your usb stick is in there. Good luck  :Wink: 

----------

## TNorthover

The desktop thing probably depends very much on which desktop you're using -- kde, gnome, or whatever. Do you know which it is?

----------

## iainvt

KDE 3.3

----------

## iainvt

here is my fstab 

# /etc/fstab: static file system information.

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.14 2003/10/13 20:03:38 azarah Exp $

#

# noatime turns off atimes for increased performance (atimes normally aren't

# needed; notail increases performance of ReiserFS (at the expense of storage

# efficiency).  It's safe to drop the noatime options if you want and to 

# switch between notail and tail freely.

# <fs>          	<mountpoint>    <type>  	<opts>      		<dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/sda1		/boot		ext3		noauto,noatime		1 1

/dev/sda3		/		ext3		noatime			0 0

/dev/sda2		none		swap		sw			0 0

/dev/cdroms/cdrom0	/mnt/cdrom	iso9660		noauto,ro		0 0

/dev/sdb               /mnt/usbstick   	auto	        noauto,umask=000,user  0 0

# NOTE: The next line is critical for boot!

none			/proc		proc		defaults		0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for

# POSIX shared memory (shm_open, shm_unlink). 

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

# Adding the following line to /etc/fstab should take care of this:

none			/dev/shm	tmpfs		defaults		0 0

then in console, i type as suggested but get error wrong fs type, I have vfat module loaded yet no joy, is sdb correct for usb stick, how do I find out what is assigned to the stick?

----------

## Pink

Your best bet is to read the Gentoo guide here.

This is a very basic intro but the important thing to see are the two links at the bottom of the guide: the Udev Primer and the writing udev rules links.

You need to read these carefully and slowly. They may seem long and fairly complicated but they are very intuitive and go through all the basics.

The way suggested by G2k is the 'old' devfs way of mounting things and you should try to get some of your own rules so when you plug in a usb device it is always in the same place in /dev, such as /dev/mp3 or /dev/usbstick, etc.

Here is one line from my own udev rules:

```
BUS="usb", KERNEL="sd*", SYSFS{product}="Flash Disk      ", NAME="%k", SYMLINK="storage"
```

As can be seen, whenever I plug in my usbstick it is called /dev/storage (it is recognised by the product name).

Then I can mount it via the 'devices' link in konqueror, I have this line in my fstab to correspond to it:

```
/dev/storage      /mnt/usb_watch   auto      noauto,users,rw         0 0

```

Thus, whenever my usbstick is plugged in, it is on /dev/storage and I simply click on the storage link in 'devices:/' (using konqueror) and it is always mounted in /mnt/usb_watch (it's a usb storage watch).

Or I can mount it by a simple 'mount /mnt/usb_storage' command if I want to use the command line.

Anyway, long reply, but it is all in the docs and is worth getting used to, I have my watch, mp3 player, digi camera and so on done in similar ways so I never have to worry about where in /dev/sd* it is.

HTH   :Very Happy: 

edit: Obviously, once you have set this up, you can then have a shortcut from devices:/ to your desktop so you can mount/unmount via an icon.

----------

## iainvt

ok nearly there, when I now type mount etc I get

cant read superblock?

----------

## Pink

 *iainvt wrote:*   

> ok nearly there, when I now type mount etc I get
> 
> cant read superblock?

 

Wow, you did all that in 10 minutes, lol (j/k).

After I had set up the udev rules, I had to reformat the usbstick again (don't know why, but until I did that I would get the superblock error and it only occured on the usbwatch, not the mp3 player or digi camera)) and I always had to put the filesytem type as auto as it wouldn't read it as vfat (very odd as it is a FAT fs).

Um, that's all I can recall of what I did to get it all to work.

----------

## TNorthover

There's a fairly similar thread going on over here that may help you get started, because you've got to get the stick working in the first place before you can worry about kde detecting it. It includes a link to the HOWTO here which you should probably consider following if you haven't already.

----------

## iainvt

how can I actually check in a booted system if I am using udev or not?

----------

## TNorthover

```
ps ax | grep dev
```

If udev is working you'll see udevd, if it's devfs you'll get devfsd.

----------

## iainvt

bash-2.05b$ ps ax | grep dev

  824 ?        S<s    0:00 udevd

 7501 ?        Ss     0:00 /sbin/devfsd /dev

 8267 pts/1    S+     0:00 grep dev

bash-2.05b$

would this mean udev then?

----------

## TNorthover

That would mean both are running. I've heard that gento=nodefvs doesn't work in 2.6.8 or something, so the way to get rid of it is to remove it from the kernel (keeping a menu option in grub for your old kernel just in case, of course).

If you do that, then devfs shouldn't appear at all in ps, and you'll be completely on udev.

I'd like to clarify what stage you're at. Have you got it mounting at all, and just trying to get kde to work, or does it still not get recognised.

If the latter, try the instructions I gave in the other thread to see what's working, briefly:

1. "cat /proc/bus/usb/devices" and everything's fine there as long as it's not empty.

2. check that the usb device and sda are mentioned in dmesg just after you've plugged the device in (hotplug and udev should take care of inserting modules).

3. If you see no mention in dmesg, try "modprobe usb-storage sd_mod" and check again. If they appear it indicates hotplug isn't working. You shouldn't get any error messages at this stage, definitely tell us if you do.

4. If all above works, try "mount -t vfat /dev/sda1 /mnt/whatever", and see if it works.

----------

