You are not logged in.

#1 2004-03-03 01:47:57

jon
Member
Registered: 2002-11-28
Posts: 87

udev HowTo for Arch

This topic was first posted in the "General" section, but I think it is better suited for the hardware section.

Ok, for everyone who want to convert the system to uDev & sysfs; here is how I did it. 
Install the latest (019) udev package, make sure you copy out a script in the "extras" directory called "start_udev" and put it in you /etc directory. I think that if you make a PKGBUILD package that a symlink gets messed up.
Next you need to build a kernel WITHOUT devfs support, but DONT reboot yet.
Next change you're /etc/rc.sysinit to something like the following:

#!/bin/sh
#
# /etc/rc.sysinit
#

. /etc/rc.conf
. /etc/rc.d/functions

echo " "
printhl "Arch Linux v0.6 $C_OTHER(${C_H2}Widget$C_OTHER)n"
printhl "${C_H2}http://www.archlinux.org"
printhl "Copyright 2002-2004 Judd Vinet"
printhl "Distributed under the GNU General Public License (GPL)"
printsep

# start up our mini logger until syslog takes over
/sbin/minilogd

# anything more serious than KERN_WARNING goes to the console
/bin/dmesg -n 3

status "Mounting /sys" /bin/mount -n -t sysfs none /sys

status "Mounting /proc" /bin/mount -n -t proc none /proc

status "Starting uDEV" /etc/start_udev




#if [ -e /dev/.devfsd -a -x /sbin/devfsd ]; then
#    status "Starting DevFS Daemon" /sbin/devfsd /dev
#fi

#if [ -f /etc/lvmtab ]; then
    # /proc is temporarily mounted to check for LVM support - it is
    # re-mounted later from /etc/fstab
#    /bin/mount -n -t proc none /proc
#    if [ -f /proc/lvm/global -a -x /sbin/vgchange ]; then
#        stat_busy "Activating LVM groups"
#        /sbin/vgchange -a y
#        stat_done
#    fi
#    umount /proc
#fi

status "Activating Swap" /sbin/swapon -a

status "Mounting Root Read-only" /bin/mount -n -o remount,ro /

if [ -x /sbin/fsck ]; then
    stat_busy "Checking Filesystems"
    /sbin/fsck -A -T -C -a
    if [ $? -gt 1 ]; then
        stat_fail
        echo
        echo "*****************  FILESYSTEM CHECK FAILED  ****************"
        echo "*                                                          *"
        echo "*  Please repair manually and reboot. Note that the root   *"
        echo "*  file system is currently mounted read-only. To remount  *"
        echo "*  it read-write type: mount -n -o remount,rw /            *"
        echo "*  When you exit the maintenance shell the system will     *"
        echo "*  reboot automatically.                                   *"
        echo "*                                                          *"
        echo "************************************************************"
        echo
        /sbin/sulogin -p
        echo "Automatic reboot in progress..."
        /bin/umount -a
        /bin/mount -n -o remount,ro /
        /sbin/reboot -f
        exit 0
    fi
    stat_done
fi

stat_busy "Mounting Local Filesystems"
/bin/mount -n -o remount,rw /
/bin/rm -f /etc/mtab*
#/bin/mount /proc
/bin/mount -a -t nonfs,nosmbfs,noncpfs
stat_done

The code after that is the same as normal. Notice what I commented out, it can be removed (not the LVM section if you have that). I left it in "just in case".

Then you have to change the /etc/start_udev because some of the syntax makes it break. Change line 54 to say:

cut -d / -f 3-'

because the current syntax of "cut" makes it break. 
Make sure you put "cut" in /bin/ otherwise it wol'nt work I think you also need "grep" in /bin/ othewise you'll get an error message, but i don't remember if it was serious.

You will need to mkdir /dev/pts/

Change you're /etc/inittab to say

 c1:2345:respawn:/sbin/agetty 38400 tty1 linux 

in the part where you put the "gettys" and use tty1, tty2, etc.

You NEED to create a /dev/console so that you can get to atleast single user mode use:

mknod /dev/console c 5 1

also make a /dev/null and /dev/zero

mknod -m 666 /dev/null c 1 3
mknod -m 666 /dev/zero c 1 5

You need to change the /etc/udev/udev.permissions to something like the following:
THIS HAS CHANGED... SEE THE END...

If you want to use xterm, aterm, rxvt, etc you need at add yourself to the "tty" group.

If you wish to use the NVIDIA driver then add the following to your /etc/rc.local
THIS HAS CHANGED... SEE THE END

Now reboot, or you can't do everthing in one step, use a rescue disk, the arch .04 works fine for me. (I used the rescue disk method)

Ok, it wasnt the best HOWTo but it works for me. Although i havent got OpenGL working yet. Although i think it's a nvidia problem.


Good Luck,
Jon
.........................


Ok, after working with this for a few day I have gotten openGL and more reiable sound. Use the following udev.permissions file...

#name:user:group:mode
ttyUSB0:root:uucp:0660
ttyUSB1:root:uucp:0666
pl2303:500:500:0666
visor:root:uucp:0666
camera*:500:500:0666

# For ATerm & RXVT
ptmx:root:tty:0660

# For Sound
dsp*:root:audio:0660
snd/*:root:audio:0660
mixer*:root:audio:0660

# /dev/null & /dev/zero (Many programs break without this)
null:root:root:0666
zero:root:root:0666

# For Printer
lp*:root:root:lp:0666

And if you use NVIDIA add the following script to your rc.local file....

#!/bin/sh

major=195

for i in 0 1 2 3; do
        devfile="/dev/nvidia$i"
        rm -f $devfile
        if ! mknod $devfile c $major $i || ! chmod 0666 $devfile; then
                echo "Couldn't create device "$devfile"."
                exit 1
        fi
done

devfile=/dev/nvidiactl              
rm -f $devfile        
mknod $devfile c $major 255
chmod 0666 $devfile   

exit 0

Offline

#2 2004-03-03 02:21:24

wdemoss
Member
From: WV - USA
Registered: 2004-01-18
Posts: 222

Re: udev HowTo for Arch

Its probably even better posted on the wiki smile


Hobbes : Shouldn't we read the instructions?
Calvin : Do I look like a sissy?

Offline

#3 2004-03-04 11:43:05

Guest
Guest

Re: udev HowTo for Arch

Hi there, thanks for the tutorial, worked like a charm! I have two small notes though.

1) You poiinted out that you should update /etc/inittab, but forgot to mention /etc/securetty also needs to be changed to use tty* instead of vc/*, you won't be able to log in as root if you don't.

2) As an alternative to changing everything from vc/* to tty*, it's also possible to make udev create the vc/* devices instead of tty* (possibly with symlinks). Here's a rule for /etc/udev/udev.rules:

KERNEL="tty[0-9]*", NAME="vc/%n"

or, if you want both vc/* and tty*:

KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k"

Hyriand

#4 2004-03-15 21:00:40

peschmae
Member
Registered: 2004-02-28
Posts: 18

Re: udev HowTo for Arch

Thanks for the howto. It works gread. smile

For those like me (that means you don't read Readmes and such things)  just one small note. Per default udev plays with the directory /udev - but for replacing devfs it needs to create the devices in /dev

just change the config: /etc/udev/udev.conf to:

udev_root="/dev/"
udev_db="/dev/.udev.tdb"

Peschmä

Offline

#5 2004-03-17 13:27:56

d3c3it
Member
From: Manchester, UK
Registered: 2003-09-10
Posts: 112
Website

Re: udev HowTo for Arch

ill try this tonight, its going to be needed now more than ever, 2.6.5 see's devfsd taken out completly now


"Covered in blood, Cant understand" - Biffy Clyro

Offline

#6 2004-03-17 14:25:02

wdemoss
Member
From: WV - USA
Registered: 2004-01-18
Posts: 222

Re: udev HowTo for Arch

where did you see this? As far as i can tell, its still in -rc1?  I thought it would be taken out in 2.8 but I can't imagine they would remove a whole subsystem on a point release.
-wd


Hobbes : Shouldn't we read the instructions?
Calvin : Do I look like a sissy?

Offline

#7 2004-03-17 18:48:26

d3c3it
Member
From: Manchester, UK
Registered: 2003-09-10
Posts: 112
Website

Re: udev HowTo for Arch

well, shoot me, i heard it on the grape vine, im yet to check the rc sources but i was told it had been taken out now

EDIT
im wrong, but it is a slow good bye now

http://kernel.org/pub/linux/kernel/v2.6 … -2.6.5-rc1


"Covered in blood, Cant understand" - Biffy Clyro

Offline

#8 2004-03-18 00:01:22

tehdely
Member
Registered: 2004-02-20
Posts: 148
Website

Re: udev HowTo for Arch

I like this.  Right now I'm using a static /dev system, but I've been thinking about migrating to udev in a bit once I figure out the workings of it.

One thing... I found that the way Gentoo handles udev involves a rather ingenious hack that you may want to look into, that doesn't require you to create the ttys and console in /dev.

With Gentoo, the initrd contains a very tiny /dev file system containing everything you need to boot your kernel, and a copy of busybox that I believe copies it over and mknods a few things.  Once it gets to boot, it unmounts the initrd and lets udev take over handling /dev.  It's a hack, but it's pretty nifty.

Just a thought.

Also, I don't use Gentoo, I just heard that from a Gentoo user who uses udev exclusively  :twisted:


[Arch GNUstep Repository] [ PKGBUILDS ]
[code][gnustep]
Server = ftp://blkwidow.lerp.com/pub/mirror/arch/gnustep[/code]

Offline

#9 2004-03-18 07:04:26

d3c3it
Member
From: Manchester, UK
Registered: 2003-09-10
Posts: 112
Website

Re: udev HowTo for Arch

tehdely wrote:

I like this.  Right now I'm using a static /dev system, but I've been thinking about migrating to udev in a bit once I figure out the workings of it.

One thing... I found that the way Gentoo handles udev involves a rather ingenious hack that you may want to look into, that doesn't require you to create the ttys and console in /dev.

With Gentoo, the initrd contains a very tiny /dev file system containing everything you need to boot your kernel, and a copy of busybox that I believe copies it over and mknods a few things.  Once it gets to boot, it unmounts the initrd and lets udev take over handling /dev.  It's a hack, but it's pretty nifty.

Just a thought.

Also, I don't use Gentoo, I just heard that from a Gentoo user who uses udev exclusively  :twisted:

im an arch and gentoo user, it is true smile


"Covered in blood, Cant understand" - Biffy Clyro

Offline

Board footer

Powered by FluxBB