Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
udev device nodes trick
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Chewi
Developer
Developer


Joined: 01 Sep 2003
Posts: 875
Location: Edinburgh, Scotland

PostPosted: Sun Mar 07, 2004 5:44 pm    Post subject: udev device nodes trick Reply with quote

I installed Gentoo on my friend's system but was disappointed when ALSA constantly failed to start on bootup. I couldn't figure out what the problem was and then after I ran some updates on my own machine, the same thing happened to me! It had been working fine on 2.6 with udev after I'd run the script in the alsa-drivers package so this was puzzling. As far as I can tell, not all the device nodes were being saved on shutdown, /dev/snd/seq in particular. I have also noted that the device node script provided in the kernel sources package does not create /dev/snd/seq while the one in the alsa-drivers package does.

In any case, I needed a fix. So I decided to run the alsa-drivers script and then recreate the device tarball myself. The problem is that the tarball gets recreated on every shutdown. So I decided to modify the shutdown script to update the tarball with new files each time instead of recreating it from scratch. Compress tars cannot be updated in this way so it needs to use a plain old tar rather than a bzipped one. Hence I also needed to change the startup script. Here are the changes I made...

/sbin/rc
Code:
                ebegin "Configuring system to use udev"
                if [ "${RC_DEVICE_TARBALL}" = "yes" ]
                then
                        einfo "  Populating /dev with device nodes..."
                        try tar -xpf /lib/udev-state/devices.tar -C /dev
                fi
                populate_udev


/etc/init.d/halt.sh
Code:
elif [ ! -e /dev/.devfsd -a -e /dev/.udev -a "${RC_DEVICE_TARBALL}" = "yes" ]
then
        ebegin "Saving device nodes"
        cd /dev
        try tar -ulpf "/lib/udev-state/devices.tar" *
        eend 0
fi


And then whenever you have a problem with device nodes disappearing (such as with ALSA) then just manually update the tarball with the following command and the changes should be kept.

cd /dev && tar -ulpf "/lib/udev-state/devices.tar" *

It's not an ideal long-term solution but the device nodes tarball is only a temporary measure while udev matures anyway. Hopefully soon enough it'll be able to stand up on its own.
Back to top
View user's profile Send private message
MighMoS
Guru
Guru


Joined: 24 Apr 2003
Posts: 416
Location: @ ~

PostPosted: Sun Mar 07, 2004 5:49 pm    Post subject: Reply with quote

This is interesting, because ALSA works just fine for me, and I am also running a 2.6 kernel with udev. Did you have ALSA compiled as modules or built-in, and did you accidently over-write your /etc/modules.d/alsa file?
_________________
jabber: MighMoS@jabber.org

localhost # export HOME=`which heart`
Back to top
View user's profile Send private message
Chewi
Developer
Developer


Joined: 01 Sep 2003
Posts: 875
Location: Edinburgh, Scotland

PostPosted: Sun Mar 07, 2004 5:52 pm    Post subject: Reply with quote

Yeah I thought it was strange too. I've got it all compiled as modules, which always worked fine before. My /etc/modules.d/alsa file is fine. I don't think it was a kernel update that did it because I'm fairly sure it happened before I updated the kernel. I was on 2.6.3-rc4 when it happened and now I'm on 2.6.3-r2. Changes to udev perhaps?
Back to top
View user's profile Send private message
MighMoS
Guru
Guru


Joined: 24 Apr 2003
Posts: 416
Location: @ ~

PostPosted: Sun Mar 07, 2004 5:55 pm    Post subject: Reply with quote

Question: Why compile it as modules, if you're gonna have them load on start-up with the alsasound init script?
_________________
jabber: MighMoS@jabber.org

localhost # export HOME=`which heart`
Back to top
View user's profile Send private message
Chewi
Developer
Developer


Joined: 01 Sep 2003
Posts: 875
Location: Edinburgh, Scotland

PostPosted: Sun Mar 07, 2004 5:56 pm    Post subject: Reply with quote

I dunno, I've got most stuff compiled as modules because I just think modules are the way to go. I don't think that's what the problem was though.
Back to top
View user's profile Send private message
MighMoS
Guru
Guru


Joined: 24 Apr 2003
Posts: 416
Location: @ ~

PostPosted: Sun Mar 07, 2004 6:01 pm    Post subject: Reply with quote

I think that may have something to do with it though, because (I don't know if this was fixed) but my nvidia device nodes wont get created untill the nvidia module is loaded (or my local.start init script creates them :D )

Correct me if I'm wrong, but wouldn't a cleaner way be to note the major and minor numbers, and just add the corresponding mknod entries to your local.start init script?
_________________
jabber: MighMoS@jabber.org

localhost # export HOME=`which heart`
Back to top
View user's profile Send private message
Mark Clegg
Apprentice
Apprentice


Joined: 05 Jan 2004
Posts: 270
Location: ZZ9 Plural Z Alpha

PostPosted: Sun Mar 07, 2004 6:08 pm    Post subject: Reply with quote

I'm getting similar 'funny' results with USB mass-storage devices.

I plug the device in, and sda / sda1 get created. When I unplug - they get deleted - This is good, except it doesn't always create them. At the moment it's working, but half an hour ago it didn't.

So what have I done in the last half hour? - Well if you must know - I've had tea :lol: I've not touched the system at all....

I suppose we can expect this until the 2.6 / udev business settles down a bit....
Back to top
View user's profile Send private message
Chewi
Developer
Developer


Joined: 01 Sep 2003
Posts: 875
Location: Edinburgh, Scotland

PostPosted: Sun Mar 07, 2004 6:09 pm    Post subject: Reply with quote

I tried the same thing with the nvidia module just now actually. There were no device nodes present even though the module was loaded. Which is strange because udev is supposed to know about nvidia stuff now.

I could have done something like that but local.start executes after alsasound does so I'd have needed to put them in a different script.
Back to top
View user's profile Send private message
Chewi
Developer
Developer


Joined: 01 Sep 2003
Posts: 875
Location: Edinburgh, Scotland

PostPosted: Sun Mar 07, 2004 6:11 pm    Post subject: Reply with quote

Mark Clegg wrote:
I plug the device in, and sda / sda1 get created. When I unplug - they get deleted - This is good, except it doesn't always create them. At the moment it's working, but half an hour ago it didn't.

If it deletes them when you unplug then this solution probably won't help you much but yeah, hopefully things will get ironed out in time.
Back to top
View user's profile Send private message
MighMoS
Guru
Guru


Joined: 24 Apr 2003
Posts: 416
Location: @ ~

PostPosted: Sun Mar 07, 2004 6:11 pm    Post subject: Reply with quote

I guess this is why udev is still experimental. I think it'll be good though in a few months. I guess we should be filing bug reports so that they know what's going on, but for the homepage, all I found was a FAQ.
_________________
jabber: MighMoS@jabber.org

localhost # export HOME=`which heart`
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum