# UDEV Primer for 2.6 Kernel

## Decibels

Started a tutorial called  UDEV Primer for 2.6 Kernel.

Also have a thread at https://forums.gentoo.org/viewtopic.php?t=115096 Called 'Got udev working, now what'  

Trying to see how much we can learn about this baby.

----------

## Elm0

Useful, thanks. Think i'm going to stick with devfs for now though, as it seems to work perfectly. Maybe when udev is stable I will go over.

----------

## discomfitor

everything is working great!  thanks!

----------

## funkmankey

NB: there is also a very nice script called "snddevices" in the alsa-driver package, which will re-make all of the nodes in /dev for alsa.

test11-mm1+ udev-009 + sysfsutils-0.3.0 + snddevices, working just fine now. (udev-009 would not compile against sysfsutils-0.4.0...)

----------

## Decibels

Must depend on what kernel you install. Some say you shouldn't have to install alsa-driver because in kernel now. Mine refused to install it because 'alsa' was in there kernel.  

There is a script I ran before putting /dev in ramfs called 'alsaconf' that created the devices. After udev started mounting /dev in ramfs even it wouldn't create the devices anymore.

----------

## funkmankey

oh no, I didn't actually install alsa-driver. ^_^

I'd just fetched the tarball for it so I could swipe the snddevices script out of it.

snddevices was in fact able to create the devices after udev had put /dev into ramfs, I never tried alsaconf.

now I just need to figure out if the scsi_id patch to udev-009 is what's breaking it vs. sysfsutils 0.4.0, or what.

----------

## MathFreak

Thanks a lot.  I'm setting this up right now.  One very minor request, though, in your guide you say to change yourname to something else.  Could you put it in a color other than red for those folks (like me) who are red-green color blind?  I can still find it, but it might be a bit easier.  It's really not a big deal, though.

----------

## timmfin

Should those devices be mknoded -m 660 so that the group has read and write permisions on them?

Tim

----------

## danbond_98

couldn't get udev-009 to compile so got 008 instead which worked fine. thanx for the guide, nice and easy for even a fairly new user like me.

----------

## MathFreak

Unfortunately, I can't get my computer to boot using udev.  I followed the instructions precisely, but I get an error message saying that it can't open an initial console.  The only thing I changed from my current, working kernel is to remove devfs support.  Here is my kernel config udev stuff.  Even my line in grub.conf is the same, except for the kernel it points to.  I've also tried both with and without "gentoo=nodevfs", but I still can't get it to boot.

----------

## Decibels

 *MathFreak wrote:*   

> Could you put it in a color other than red for those folks (like me) who are red-green color blind? 

 

How bout Dark Blue? See if that is OK. If so:   :Cool: 

 *timmfin wrote:*   

> Should those devices be mknoded -m 660 so that the group has read and write permisions on them? 

 

I did miss a couple items, aloadC0 and aloadSEQ, which have put in now. As far as 660, instead of 600. You raise a valid point. Maybe it is just my system, but except for the ones listed and the ones I did wrong (amixer#) they are 600. Hmmm, I will go over the list from before udev I have and do a little more reading.  For now if you want just use edit and replace all the 600 with 660 if you want. Does anyone else have a system where they are 660? Or a thought on the subject. I can really say why they are for root only, but everything seems to be working.  See next post below!

MathFreak Looks like your using a different kernel than me. But did you put in /etc/fstab: none /dev/pts devpts defaults 0 0

and the most important: 

mkdir /sys

then add to /etc/fstab: none   /sys   sysfs  defaults 0 0

The way I gather is that you don't even get to the login screen? Correct? If so can you boot with the liveCD and see what /var/log/messages or syslog says on the root partition?

Just got back from LOTR so will look in a few hours on the 660 vs 600.

----------

## discomfitor

If it can't open an initial console, it's because either you don't have ptsfs support in your kernel, or you didn't add the line to your fstab.

----------

## Decibels

I looked at his config and remember seeing it in the kernel. That is why I suspect not adding to fstab (which is in the tutorial).

----------

## MathFreak

I have this line in my fstab

```
none            /dev/pts    devpts      defaults        0 0

```

 which works just fine with a devfs kernel.  Btw, I'm using the just released 2.6.0 kernel, but I was running into this same problem on one of the pre-release versions.  I'll check the logs in a little bit.

----------

## Decibels

On my system I am the owner of most of the devices for audio with udev mounted.

Am not sure where it decides though. It doesn't appear that udev.permissions is being used. For example:

/etc/udev/udev.permissions

sg*:root:disk:0660

ls -l /dev/sg*

crw-rw----    1 decibels    root      21,   0 Dec 13 22:53 /dev/sg0

On this one looks like the permissions is setup correctly via udev.permissions, but you would think that it would be think the group would be root:disk and not decibels:root

Another example:

/etc/udev/udev.permissions

mixer*:root:audio:0660

ls -l /dev/mixer*

crw-------    1 decibels    audio     14,   0 Dec 13 22:53 /dev/mixer

But on this one only for the group audio does it look like it comes from udev.permissions.

Then to further complicate things. Changed the script to chmod all the devices created to 660. Rebooted and back to 600. Though something wrong, so did it again. Watched /dev/snd it changed them all to 660. Rebooted and back to 600.

So, not sure who is setting the permissions at this time. Anyone?

But it doesn't appear that the script set to 600 is hurting anything so will leave as is unless someone can prove otherwise. Just like with the baselayout, some things don't appear to be in place for udev yet and it would appear that /etc/udev/files is one of them.

----------

## MathFreak

Okay, I checked my logs, but nothing gets put into them.  Oh, and Decibels, thanks for changing the color.  Sorry for whining.  It really is a great guide.

EDIT: Alright, I just looked at the bootup message more carefully and I don't get a message about mounting sysfs or mounting /dev.  Is this supposed to happen before the init process or during it?  When I use devfs I get message saying its mounting /dev right before init starts.Last edited by MathFreak on Sat Dec 20, 2003 11:47 am; edited 1 time in total

----------

## uglyman

hey guys great guide! thanks for the help.

got a little trick for you if you hit the same snag as me.

Some posts above talk about snddevices that comes with alsa-driver. I wanted to try this but didn't seem to have it anymore (or alsa-driver at all!) so I just did emerge alsa-driver. It complains about not being compatable with 2.6 and exits with an error. The good news is that it doesn't do this until the package has been downloaded and unpacked. I am sure there is an easier way to do that but I am no portage wizard. I tried emerge --fetchonly but couldn't figure out if/where to find the package. Anyway with my lazy method, you wait for the error (it doesn't take long). Then you go to /var/tmp/portage/alsa-driver1.0-rc2/work/alsa-driver-1.0.0rc2/ and look in that dir (your ver might be different if you are not ~arch (unlikely at this point   :Very Happy:  ) . 

the script snddevices is located there. The problem is I ran it 

```
./snddevices
```

 and I got a whole bunch of errors from chown that root.root is not a valid user.

I popped the script open in vi to take a look, at the top we see:

```
if [ "`grep -w -E "^audio" /etc/group`x" != x ]; then

  PERM=660

  OWNER=root.root

fi
```

change this so that

```
OWNER=:audio
```

and run the script. If all went well it should change the group of all the sound related /dev stuff to audio. This way if your user is in your audio group you shouldn't have any problem with alsamixer etc etc. Not sure yet if this holds after reboot. (I think it does) if not it could be placed in /etc/conf.d/local.start 

later and thanks for the info!

-uglyman

----------

## ikaro

i cant compile udev ....

```

make[1]: Entering directory `/var/tmp/portage/udev-009/work/udev-009/extras/scsi_id'

gcc -march=athlon-xp -O2 -pipe -fomit-frame-pointer -fstack-protector -pipe -Wall -Wshadow -Wstric                               t-prototypes -Wmissing-prototypes -Wmissing-declarations  -fomit-frame-pointer -D_GNU_SOURCE -I/us                               r/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include -I/var/tmp/portage/udev-009/work/udev-009/libsysfs -                               DSCSI_ID_VERSION=\"0.2\"  -Wall   -c -o scsi_id.o scsi_id.c

scsi_id.c: In function `get_major_minor':

scsi_id.c:161: too few arguments to function `sysfs_open_class_device'

scsi_id.c: In function `scsi_id':

scsi_id.c:711: too few arguments to function `sysfs_open_class_device'

make[1]: *** [scsi_id.o] Error 1

make[1]: Leaving directory `/var/tmp/portage/udev-009/work/udev-009/extras/scsi_id'

make: *** [all] Error 2

!!! ERROR: sys-fs/udev-009 failed.

!!! Function src_compile, Line 66, Exitcode 2

!!! (no error message)

```

anyone can make sense of this ?

----------

## aquadog

here's why :

https://bugs.gentoo.org/show_bug.cgi?id=36083

----------

## ikaro

alright, that worked.

thx.

----------

## ikaro

well first ive posted on the wrong palce becuse there are about 10 treads about udev so i got confused, sorry about that.

my question is here:

https://forums.gentoo.org/viewtopic.php?p=721498#721498

a snapshot from my bot log is here :

http://ikaro.homepage.dk/log.png

anyone knows whats missing ? 

thx

----------

## Decibels

Actually already answered on the other place. This "Documentation, Tips & Tricks" isn't really suppose to be a support forum. It mentions it at the beginning.   :Wink: 

----------

## Decibels

If anyone read the guide earlier there was a change made, it should really affect anyone though. It isn't necessary to add a line in fstab for devpts anymore. ikaro found that out and tested it myself. Didn't see any errors or problems with it in or out, so leaving it in shouldn't be a problem either.

Without the line in fstab:

```
bash-2.05b$ ls -l /dev/pts

total 0

crw-------    1 decibels    tty      136,   0 Dec 21 08:56 0

crw-------    1 decibels    tty      136,   1 Dec 21 08:56 1

crw-------    1 decibels    tty      136,   2 Dec 21 08:56 2

crw-------    1 decibels    tty      136,   3 Dec 21 08:56 3
```

This has been a public service announcement.   :Smile: 

----------

## charlieg

How accurate is this guide now that udev0015 is out and the latest nvidia drivers have some form of sysfs integration?

----------

## Decibels

Probably still relevent, coupled with the main post in Other Things Gentoo:

https://forums.gentoo.org/viewtopic.php?t=115096&highlight=

I have been doing other things and keeping a watch on the post above, but haven't really noticed anything yet that makes me feel the need to change it yet.

Have updated it a few times already. Mainly the only thing your seeing now is added capability of udev. I can run a complete udev system. Some things don't work though, like my scanner. When someone points out something not needed in the guide any longer I make a change. If you see something let me know.

Could probably take lot of items out of the script on there. That is probably the only thing so far. That just goes with what said earlier about added capability of udev as it's coming along.

----------

## charlieg

It might be worth noting that I had to do the following to get X to work:

```
# ln -sf /dev/psaux /dev/mouse
```

----------

## Clapper

I installed 2.6.1, and it worked with minimal fuss with, I am assuming devfs.

However, my scanner isn't working.  Is this udev setup necessary to use my scanner?  Or, is implementing this not really a part of my problem?

----------

## Clapper

 *Quote:*   

> 
> 
> However, my scanner isn't working. Is this udev setup necessary to use my scanner? Or, is implementing this not really a part of my problem?
> 
> 

 

Forgot to mention- usb scanner, epson 2450.  If I dmesg, after plugging it in, I see an entry, but Vuescan doesn't a scanner has been installed...

----------

## Decibels

 *charlieg wrote:*   

> It might be worth noting that I had to do the following to get X to work:
> 
> ```
> # ln -sf /dev/psaux /dev/mouse
> ```
> ...

 

Will look at tomorrow when have time, haven't used PS/2 mouse for awhile. Couldn't you have just changed XF86Config to /dev/psaux. I think that was what I had in mine before. 

Clapper: You will get more support here: https://forums.gentoo.org/viewtopic.php?t=115096 If you read that, you will see that my scanner isn't working either. At least not as of udev-14

----------

## Clapper

In the 2.6 kernel, there is an option for creating the scanner module- I didn't choose it, because the note said something like it had been "deprecated".  Anyway, checking this option made the scanner work for me, but I am still in the dark as to how the kernel developers feel this should work, if you don't include the module.  I'll check out the previous poster's link...

----------

## d3c3it

 *Clapper wrote:*   

> In the 2.6 kernel, there is an option for creating the scanner module- I didn't choose it, because the note said something like it had been "deprecated".  Anyway, checking this option made the scanner work for me, but I am still in the dark as to how the kernel developers feel this should work, if you don't include the module.  I'll check out the previous poster's link...

 

libusb and hotplug my friend, thats handling scanners and other stuff now. Redo the kernel without the scanner module *or just dont modprobe it* and then make sure hotplug is running. Run sane-find-scanner, or whatever it is *away from pc cant remember* and see if your scanner pops up. As root it works a treat but as a user im still getting problems, cant find it, permission problems still trying to fix.

Ive a question thou, ive got devfsd right now in my kernel, if i run

```
devfs=nomount
```

 in the kernel line in grub will this turn devfsd off, completly, ie will i have to recompile my kernel without devfsd? also do i need to unmerge devfsd? anything else?

----------

## Decibels

I've wondered about that myself, but haven't tested it. Don't believe that you have to add devfs=mount anymore to bootloader to make it load if in the kernel, but I still have it. 

Don't know about the nomount option though, haven't tested it. The most reasonable default would seem to be, load it if in kernel unless told not to.

Hmm, guess I need sleep. Was thinking for a moment that devfsd might be in 'rc-update show' but isn't. That is a good question. I would just try the 'nomount' option first.

----------

## d3c3it

well for future readers, that option does work, but more importantly i just recompiled completly without devfsd at all, udev mounted everything at boot and bingo everything works, no problems with dri permissions, alsa, everything works, bar printer, but thats my fault. Thanks for that fanastic guide it works a treat.

the last time i tried udev was in dec and it was completly broken for me now it worked first time, i have to give it to the devs on that project hats off to them  :Smile: 

----------

## charlieg

In the primer tutorial, shouldn't this:

```
chown yourname /dev/nvidia* #add whatever yours had here before, mine was my name.
```

...be:

```
chgrp video /dev/nvidia*
```

----------

## Decibels

Probably whatever works for you. Mine always gets set to user for some reason.

Right now nvidia devices are owned by me and grp root.  

Also, looks like Martin has patched the nvidia-kernel to work better with udev and sysfs:

```
*nvidia-kernel-1.0.5336-r1 (01 Feb 2004)

                                                                               

  01 Feb 2004; Martin Schlemmer <azarah@gentoo.org>

  nvidia-kernel-1.0.5336-r1.ebuild,

  files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch,

  files/1.0.5336/Makefile:

  Add basic sysfs support for 2.6 and udev.  Patch donated by myself
```

That part of the primer is just a guide to 'help' if you find some of your devices missing while testing out an experimental system. Like any experimental, some things are different on various systems.

Going to boot back to the system in a minute here, update to latest udev,.. and probably remove a few things from the primer. Maybe pretty soon, all of it will be gone.

----------

## ferret

As of kernel 2.6.3-rc1, and Martin's nvidia patches, udev now creates my /dev/nvidia, /dev/nvidiactl and /dev/fb/0 !  :Smile: 

Now just /dev/misc/svga left and I have absolutely everything  :Very Happy: 

----------

## tatesworld

I followed instructions to word, but on boot I get unable to open initial console, gone back to devfs

does /dev need to be empty first time?

 ps I use XFS filesystem

Do you need an initrd to load up at boot time?

----------

## Evil Dark Archon

i would boot the live cd, chroot to your root partition and the simplest method is to re-emerge baselayout and it will create a set of static nodes that will be used during the initial bootup and then udev will take over.

----------

## Decibels

I rewrote the UDEV Primer to update it and include suggestions. There is still some stuff would like to add. Like now I didn't have any luck with the nvidia drivers and will have to see why.

Depends on what time you checked the Primer. If you printed it out, reprint it. Cause around 12pm CST I put up new stuff. If you did from previous tutorial, you are probably using the devices.tar.bz2 file in the default Gentoo UDEV install. Which is even easier, cause they populate /dev from that file. The new stuff in the primer tells you how to edit the baselayout scripts to run a pure udev system and not use the devices.tar.bz2 file.

Another thing is that some people, including me, have at one time not been able to open an initial console during boot on a new system. What I did at that time was:

mknod -m 660 /dev/console c 5 1

mknod -m 660 /dev/null c 1 3

Give me a little more detail on above. Haven't installed a brand new system in quite awhile. Would like to know success or failure rate. Probably going to have to take time to install a new system and see what happens for udev on a new install.

Haven't figured out why yet, but then worked from then on.

Also, like mentioned about the baselayout. Did you make sure you etc-update and put the new scripts in place?

----------

## jimmybfan

When trying to acces Decibels udev primer i get timeout errors. wondering if anyone else is getting this or if it is just temporary.  I was hoping to get udev going today, looks like i might have to wait a little while though.

----------

## Decibels

I guess Charter is doing maintenance on the servers. Cause I have some updates to put up and can't, also can't access the webpage from browser.

Sorry, out of my hands. Hopefully will be up shortly.

I would have my own server, but that cost money. So have to rely on them.

----------

## jimmybfan

I figured as much, but wanted to check.  Thanks for the quick reply.

----------

## Decibels

Well, even tried to find it cached on google or yahoo, and they have lot of the pages, but not udev.    :Crying or Very sad: 

Hey, it's back up!! Give it a few minutes for me to get the updates there.

----------

## CaribbeanKnight

hmmmm, damn... hey Decibels, if you want to put your page on my server temporarily, you can always contact me on caribbeanknight@jabber.org or msn on eme@skynet.be...

just saying this as i'm really bored and sitting in front of my pc eager to get some udev messing going on...   :Laughing: 

----------

## Decibels

Thanks, but it is rarely down. Plus, the only reason this is noticeable is because this Primer has been a real hit. It's like I wrote a best seller. Hey, I'm a big time author.   :Laughing: 

Normally, I wouldn't be even notice or have others tell me about it. So if continues to be a problem I might take you up on it.

I even found a reference to it on google from some mailing list while looking for a cached page of it.

----------

## tatesworld

bingo, thanks got it working , you do need /dev/console & /dev/null 

here is what i did

boot of a rescue cd 

chroot into root partition

cd dev

rm -r -f *

mknod -m 660 /dev/console c 5 1

mknod -m 660 /dev/null c 1 3

reboot into gentoo

re installed nvidia becouse that devices were not there, I used the NVIDIA-Linux-x86-1.0-5336-pkg1.run from nvidia.com

you will need kernel sources to make the nvidia  kernel module driver.

----------

## jimmybfan

Decibles, thanks for the guide, I got udev up and working. udev only, no devices.tar.bz2.  seems to be working without problems.  I didn't have to create the nvidia stuff, so I don't know whats going on with that, but it's working, so thats cool.

----------

## Decibels

Nvidia devices. The new ebuild is working, just can't have the old one in there also, probably only a problem if using CONFIG_PROTECT to protect /lib/modules. Got it working now.

Console and Null. Figured out why. Posting fix here: https://forums.gentoo.org/viewtopic.php?p=884721#884721

Will update the primer tonight.

----------

## tatesworld

Mine not a New Install

I still had to create console & null from previously using devfs.

I always had to put support for devfs and auto mount at boot ticked in kernel config to boot before.

----------

## Decibels

Strange and getting stranger all the time. So, not totally clear on why or when it happens yet, but fix works if encounter the error.

But if you just changed over, then /dev should have been full of static devices (including console and null), so should have worked. !?!

----------

## tatesworld

my /dev was always empty when I used devfs when booting from rescue cd

so It dont like empty /dev (mind you I always had to tick automatically mount at boot devfs option before when configuring kernels) and since udev is user space it must need an initial console I suppose

----------

## Decibels

After testing this back and forth. Udev populates /dev after the system wants console and null. So if have an empty /dev folder then lack of console or null will cause system to fail.

If anyone doubts this, boot from another system or cd and check you /dev on the partition in question. If your not having any problems with console or null, then you will see the devices in there.  If you are, then you will see a blank folder or at least one without console or null in it.

Solution is to have at least console and null in root /dev folder as static devices.

----------

## water

Decibels: little typo in your UDEV-primer?

Paragraph 10 (GRUB/LiLo): sometimes devsf instead off  devfs

EDIT: Corrected within five minutes, after posting.   :Very Happy: 

----------

## beandog

So can I unmerge sys-fs/devfsd now, or do I still need it?

----------

## Decibels

Don't need it unless going to be using devfs for some other kernel. If you have a problem let me know.

----------

## Decibels

Made some more updates. Started a little part near the top showing recent changes also, so will know at a quicker glance if something added/changed.

Also like to thank dsd for all his help. For those got udev working, also check out dsd's Writing Udev Rules page: http://www.reactivated.net/udevrules.php

----------

## beekman001

i've been looking at your page & some other udev stuff.  and i had a thought. 

would it be practical to create a script to generate /dev nodes at bootup from a config file

i was thinking something along the lines of

1) get a listing of modules known not to work with udev, and their major / minor numbers etc

2) have the script go through that listing and generate device files at boot up

results:

1) it eliminates the devices.tar.bz2 kludge

2) as drivers are made compatable, they can be removed from the list

3) comments could be implemented so say, people who dont have an nvidia video card could simply comment the nvidia stuff out of the config file

----------

## rockfly

the page : 

http://www.reactivated.net/udevrules.php

does not work, is it broken?

----------

## Decibels

Check it again. It isn't my site, it is dsd's and just went there. Must have been down for maintenance. Works now.

----------

## d3c3it

how do you change node permissions? ie changing /dev/lp0 so a user can use it. atm only root has access

----------

## OneOfOne

thanks to mattthebaker on #gentoo i've found a fix for the weird alsa perm problems.

the file /etc/security/console.perms some how rechmods the nodes the first time after udev creates them but not the 2nd time.

personally i just removed the file (after making a backup  :Wink: ).

peace

----------

## Decibels

It changes them once, then what the next time your reboot, it doesn't?

I was thinking my /etc/security folder was empty anyway. 

Have to look when get home.

----------

## OneOfOne

 *beekman001 wrote:*   

> i've been looking at your page & some other udev stuff.  and i had a thought. 
> 
> would it be practical to create a script to generate /dev nodes at bootup from a config file
> 
> i was thinking something along the lines of
> ...

 

i shameless stole your idea and made a very simple script to do what you were thinking about, kinda.

first you supply a file with simple rules, if the "module X" is loaded and the node doesnt exist it'll create it.

simple configuration file :

```

# udh.conf

# this is just an example

#kernel_module, dev and node are required.

#kernel_module can be set to none if the module is built in.

kernel_module=ppp_generic,dev=/dev/ppp,perm=660,group=dialout,user=root,node=108 0

kernel_module=none,dev=/dev/test-test,perm=660,group=users,user=oneofone,node=1 3,symlink=/dev/test2

kernel_module=none,dev=/dev/fb/0,perm=660,group=video,user=root,node=29 0,dir=/dev/fb,synlink=/dev/fb0

```

Actual script : 

```

#!/usr/bin/python -O

# Distributed under the terms of the GNU General Public License v2

#UDev Device Helper

#Changes :

#   fixed permissions problem and misc tweaks

import sys,os,grp,pwd,commands,stat

default_perm = '660'

loaded_modules = commands.getoutput("lsmod | awk '{print $1'}").splitlines()[1:]

loaded_modules.append('none');

def parse_config(conf_file='udh.conf'):

   if not os.access(conf_file,os.F_OK) and len(sys.argv) > 1 and os.access(sys.argv[1], os.F_OK) :

      conf_file = sys.argv[1]

   f = file(conf_file,"r"); lines = f.readlines(); f.close()

   final_conf = []

   for line in lines:

      if not line.startswith('#'):

         conf = line.strip().split(',')

         temp_dict = {}

         for c in conf:

            cc = c.strip().split('=')

            temp_dict[cc[0].strip()] = cc[1].strip()

         final_conf.append(temp_dict)

   return final_conf

conf = parse_config()

for line in conf:

   try:

      if 'kernel_module' in line and line['kernel_module'] in loaded_modules and not os.access(line['dev'],os.F_OK):

         print "Making node : " + line['dev']

         if 'perm' in line : line['perm'] = default_perm

         if 'dir' in line : print "\t Making Directory : " + line['dir'] + ' ' + os.mkdir(line['dir'])

         n = line['node'].split(' ')

         os.mknod(line['dev'], stat.S_IFCHR, os.makedev( int(n[0]), int(n[1]) ) )

         #fix this...

         commands.getoutput("chmod %(p)s %(f)s" % {'p':line['perm'], 'f': line['dev']} )

         #commands.getoutput( 'mknod -m '+line['perm']+' '+line['dev']+' c '+line['node'])

         gid , uid = 0 , 0

         if 'group' in line : gid = grp.getgrnam(line['group'])[2]

         if 'user' in line : uid = pwd.getpwnam(line['user'])[2]

         os.chown(line['dev'], uid, gid)

         if 'symlink' in line : 

            print "\tCreating Symlink from %(src)s to %(dst)s" % {'src':line['dev'], 'dst':line['symlink']}

            os.symlink(line['dev'], line['symlink'])

      else:

         print 'Error : [%(e)s] isn\'t currently loaded or device already exists.' % {'e':line["kernel_module"]}

   except:

      print "Configuration : "+ str(line)+" is invalid, please check your syntax!"

```

either put udh.conf in the same directory or call the script with the full path name to the .conf file, example : 

```

[11:40:21][~/programming/python/udh]-> chmod +x udh.py

[11:40:21][~/programming/python/udh] -> ./udh.py ~/programming/python/udh/udh.conf

Error : [ppp_generic] isn't currently loaded or device already exists.

Making node : /dev/test-test

        Creating Symlink from /dev/test-test to /dev/test2

Error : [none] isn't currently loaded or device already exists.

[11:40:23][~/programming/python/udh] -> l /dev/test* && rm /dev/test* -f

c-w----r-T    1 oneofone users      1,   3 Feb 28 23:40 /dev/test-test

lrwxrwxrwx    1 root     root           14 Feb 28 23:40 /dev/test2 -> /dev/test-test

[11:40:25][~/programming/python/udh] ->

```

i hope this helps someone.

a good place to put it is either local.start or edit /sbin/rc and append /path/to/udh.py /path/to/udh.conf before the "return 0" line in populate_udev().

fixed a problem with the perm, for some reason os.chmod() hates me and submited a bug https://bugs.gentoo.org/show_bug.cgi?id=43225

peaceLast edited by OneOfOne on Sat Feb 28, 2004 10:23 pm; edited 1 time in total

----------

## OneOfOne

 *Decibels wrote:*   

> It changes them once, then what the next time your reboot, it doesn't?
> 
> I was thinking my /etc/security folder was empty anyway. 
> 
> Have to look when get home.

 

no, i use pure udev so when i reboot it used to do the same thing all over again.

if you delete the file it won't do that and it'll create the devices with right perm from /etc/udev/udev.permissions.

peace

----------

## Decibels

```
# /etc/security/console.perms

#

# This file determines the permissions that will be given to priviledged

# users of the console at login time, and the permissions to which to

# revert when the users log out.
```

Okay, must have been thinking of something else when said it was empty. Home now and it's not. Weird, haven't noticed any strange permission problems on my system that I know of. I seem to own all my alsa devices in snd and group audio.

Is there something you think I should make a not of on the Primer. Or is it something that probably isn't affecting many people?

PS. Running a pure udev system also.

----------

## Decibels

 *d3c3it wrote:*   

> how do you change node permissions? ie changing /dev/lp0 so a user can use it. atm only root has access

 

You could edit udev.permissions.

```
# lp devices

lp*:root:lp:0660

parport*:root:lp:0660

irlpt*:root:lp:0660

usblp*:root:lp:0660

usb/lp*:root:lp:0660
```

That should be correct and mine is like that. Better yet, I would just add the user to the 'lp' group. That would be better than changing the owner in udev.permissions. IMHO

----------

## Cerement

Now running a pure udev system thanks to Debibels' guide and Gentoo's new baselayout package:

kernel config without devfs

in /etc/conf.d/rc disabled devices.tar.bz and loading devfs at boot

(and overly redundant devfs=nomount gentoo=nodevfs on kernel line)

then did as tatesworld did,

rebooted with gentoo cd, mounted my HD,

cleaned out /dev completely,

created console and null,

rebooted,

needed to emerge nvidia-kernel

and everything runs just fine

Thanks to everyone here and in the support thread for a great job!

----------

## tecknojunky

Decibels, thank you.

Thanks to your most excellent and crystal clear howto, I now have a pure udev running system and it worked right out of the box.

I still have to go around to check for any permissions problems, but for now, /dev/null and /dev/console got created automagically without any intervention on my part, sound seem ok, I can mount cdrom, really, quite trivial.

Good job.  You should be elected president of the entire world.

----------

## OneOfOne

 *Decibels wrote:*   

>  *d3c3it wrote:*   how do you change node permissions? ie changing /dev/lp0 so a user can use it. atm only root has access 
> 
> You could edit udev.permissions.
> 
> ```
> ...

 

i believe his problem is the same like mine.

also it works for some people although the permissions are wrong, no idea how.

if you do ls -l /dev/sound/* you'll find them 600 not 660.

it probably works for them because they edit udev.permissions and change root: to user-name:.

and i also think it's totally harmless to remove that console.perms file, atleast make a back up of it and if anything goes wrong the root will always be able to restore it.

peace

----------

## Decibels

```
bash-2.05b$ ls -l /dev/sound*

total 0

crw-------    1 decibels    audio     14,  12 Feb 27 07:36 adsp

crw-------    1 decibels    audio     14,   4 Feb 27 07:36 audio

crw-------    1 decibels    audio     14,   3 Feb 27 07:36 dsp

crw-------    1 decibels    audio     14,   0 Feb 27 07:36 mixer
```

Your certainly right about the permissions changing. Overwrites udev.permissions of 660. Not that I doubted you, just like to see it for myself.

Guess it doesn't really matter on a single user system. Does anyone have a multi-user system and let's say something like the first user owns the devices and when another user comes on they don't get any?

Busy keeping the Primer updated and some things like this require others to bring it to the fore front.

Just noticed the same thing on my hdc (cdwriter).

----------

## OneOfOne

well, i know its good for 1 user system but i run as root most of the time, except programs that use the internet (xchat, firefox, etc). and they can't play sounds for example.

same goes to "links" and /dev/fb/0

i think you really should add a comment about it in your great howto, after all if it wasn't for your howto i wouldnt be using udev now  :Smile: 

peace

----------

## Decibels

I'll see what can do. Now battling a weird problem where can't use kdesu, kuser, or a lot of other su X programs. Can't even login as root, but can su in terminal. Weird.

----------

## tecknojunky

 *OneOfOne wrote:*   

> ...and /dev/fb/0

 Hum, me too.  Anything using /dev/fb* is doomed.  I guess I'll have to use the device tarball after all  :Sad: 

----------

## OneOfOne

 *tecknojunky wrote:*   

>  *OneOfOne wrote:*   ...and /dev/fb/0 Hum, me too.  Anything using /dev/fb* is doomed.  I guess I'll have to use the device tarball after all 

 

well, latest love sources include a patch to make fb generate the /dev/fb* stuff.

Decibels: i dont have the problem, sorry.

peace

----------

## tecknojunky

oh, and one more thing.  I just updated mm-sources and there is no more "Support for hot-pluggable devices" entry: http://www.tecknojunky.com/images/mm4.png

What is to be shoosen?

----------

## OneOfOne

 *tecknojunky wrote:*   

> oh, and one more thing.  I just updated mm-sources and there is no more "Support for hot-pluggable devices" entry: http://www.tecknojunky.com/images/mm4.png
> 
> What is to be shoosen?

 

it moved into general devices.

peace

----------

## tecknojunky

 *OneOfOne wrote:*   

>  *tecknojunky wrote:*   oh, and one more thing.  I just updated mm-sources and there is no more "Support for hot-pluggable devices" entry: http://www.tecknojunky.com/images/mm4.png
> 
> What is to be shoosen? 
> 
> it moved into general devices.
> ...

 Is there a General Devices or if you just throw that arbitrarly from the top of your mind?

Searching and found "Hotplug firmware loading support" in Generic Driver Options.

----------

## OneOfOne

 *tecknojunky wrote:*   

>  *OneOfOne wrote:*    *tecknojunky wrote:*   oh, and one more thing.  I just updated mm-sources and there is no more "Support for hot-pluggable devices" entry: http://www.tecknojunky.com/images/mm4.png
> 
> What is to be shoosen? 
> 
> it moved into general devices.
> ...

 

General setup ->  [*] Support for hot-pluggable devices

peace

----------

## tecknojunky

Got it.  Big thanks from a member of species 5618

----------

## Decibels

New German translation of the Udev Primer has been written. Thanks to Alexander Minges. 

http://www.athemis.de/content/linux/udev_primer_de.html

----------

## eNTi

section 1. in the howto shows a little error.

```

# CONFIG_DEVFS_FS is not set   <--- Can say 'Y' if want, will have to add devfs=nomount to boot-loader to boot with udev.

```

it should be (iirc):

```

# CONFIG_DEVFS_FS is not set   <--- Can say 'Y' if want, will have to add gentoo=nodevfs to boot-loader to boot with udev.

```

----------

## rockfly

 *rockfly wrote:*   

> the page : 
> 
> http://www.reactivated.net/udevrules.php
> 
> does not work, is it broken?

 

well i tried it today again, but it still doesn't work, can we have a copy of it somewhere else?

----------

## Decibels

 *eNTi wrote:*   

> section 1. in the howto shows a little error.
> 
> ```
> 
> # CONFIG_DEVFS_FS is not set   <--- Can say 'Y' if want, will have to add devfs=nomount to boot-loader to boot with udev.
> ...

 

Note to self. Fix this. Thanks will do tomorrow. If forget PM me.

Rockfly Link does work, just tried it.

----------

## rockfly

 *Quote:*   

> Rockfly Link does work, just tried it.

 

i now see why i can't reach it, it's in the same ip adress range, i can't connect with computer in this range. (chello)

----------

## VolcomPimp

Im having some trouble...

I just formatted and did another stage 1 install

from knoppix and compiled in support for the stuff

needed for udev, and took out devfs...

I deleted all the stuff in my /dev and added

null and console.

I emerged grub and tried:

```
grub-install --no-floppy --root-directory=/boot /dev/hdb
```

(my hd is on  /dev/hdb)

and I get:

```
/dev/hdb: Not found or not a block device.
```

because I wiped out my /dev directory...

I tried

```
running /etc/init.d/hotplug start
```

but I dont see anything being added to /dev 

Anyone have any suggestions?

----

Ok I got passed that but now when I boot up I get

```
**The "try" command failed with error:

/sbin/rc: line26: /dev/null: Read-only file system

Line 1: /dev/null: Read-only file system

....

asks for root pw for maintainance
```

k I deleted null and recreated it, now when I boot I get an error

when mounting my root fs /dev/hdb3...

says failed to open FS and to run fsch.reiserfs w/ --rebuild-sb

though it looks like its already trying it and it says

*filesystem couldn't be fixed  :Sad: 

and when I try it and reboot I get the same error

----------

## VolcomPimp

w00t!

everything seems to work now...

fstab mistake

----------

## mlybarger

hopefully this thread accepts questions about udev as well as the primer. nice primer. been running udev for a bit now.  the udev.rules no longer contains examples of rules for printers, etc.  anyone know why these examples were removed?  i'm using 024-r1 udev.  went to ~x86 per advice from IRC. also, i have one device (memory stick) that locks up the machine hard.  sometimes it gets recognized, but frequently it'll lock up the box.  iders?

----------

## Decibels

Needs to be posted on: https://forums.gentoo.org/viewtopic.php?t=115096

----------

