Opened 14 years ago

Closed 14 years ago

#2685 closed defect (worksforme)

Does udev populate /dev correctly?

Reported by: bdubbs@… Owned by: lfs-book@…
Priority: normal Milestone: 6.7
Component: Bootscripts Version: SVN
Severity: normal Keywords:
Cc:

Description

From Andy Benton on lfs-dev:

I haven't updated my bootscripts lately but today I decided to rectify that, I downloaded lfs-bootscripts-20100529 and installed them on a new system. They worked fine apart from the mountfs script which returned a fail.

When I logged in and ran mount -a it complained that /dev/pts and /dev/shm did not exist. It used to be that the udev bootscript copied /lib/udev/devices/{pts,shm} to /dev but looking at it now, the only thing it copies is /lib/udev/devices/null

On the udev page in chapter 6 it still says to install /lib/{firmware,udev/devices/{pts,shm}}. If the udev bootscript doesn't copy /lib/udev/devices/{pts,shm} to /dev, how are /dev/{pts,shm} going to be created?

Change History (4)

comment:1 by houhongxun, 14 years ago

From udev version 155(if i remember correctly), udev will copy content in /lib/udev/devices directory for us. I think Andy Benton didn't upgrade his udev package.

Further more, if we enable kernel devtmpfs, we even don't need null device exists in /lib/udev/devices directory. And according to what udev changelog said, enabling kernel devtmpfs is recommended by udev developers, in future udev release , it will be mandatory.

comment:2 by houhongxun, 14 years ago

Hi,Andrew Benton

I saw your reply on lfs-dev, I haven't subscribed to lfs-dev mailing list, so I reply here.

Here is what my system shows:

[hongxun@HouLFS-09:17:11 ~]$ ls -l /lib/udev/devices
total 12
crw-rw-rw- 1 root root 1, 3 Jun 18  2010 null1
drwxr-xr-x 2 root root 4096 Mar 25 15:23 pts
drwxr-xr-x 2 root root 4096 Mar 25 15:23 shm
drwxr-xr-x 2 root root 4096 Jun 18 09:04 testdir

[hongxun@HouLFS-09:14:08 devices]$ ls -dl /dev/{pts,shm,testdir,null1}
crw-rw-rw- 1 root root 1, 3 Jun 18  2010 /dev/null1
drwxr-xr-x 2 root root    0 Jun 18  2010 /dev/pts
drwxrwxrwt 2 root root   40 Jun 18 09:11 /dev/shm
drwxr-xr-x 2 root root   40 Jun 18  2010 /dev/testdir

[hongxun@HouLFS-09:26:51 ~]$ diff -u lfs-bootscripts-20100529/lfs/init.d/udev /etc/rc.d/init.d/udev
--- lfs-bootscripts-20100529/lfs/init.d/udev    2010-05-29 18:41:33.000000000 +0800
+++ /etc/rc.d/init.d/udev       2010-06-18 09:26:51.207638349 +0800
@@ -34,28 +34,26 @@
                # made or removed during this boot don't affect the next one.
                # The reason we don't write to mtab is because we don't ever
                # want /dev to be unavailable (such as by `umount -a').
-               if ! mountpoint /dev > /dev/null; then
-                       mount -n -t tmpfs tmpfs /dev -o mode=755
-               fi
-               if [ ${?} != 0 ]; then
-                       echo_failure
-                       boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
-                       boot_mesg -n " onto /dev, this system will be halted."
-                       boot_mesg -n "\n\nAfter you press Enter, this system"
-                       boot_mesg -n " will be halted and powered off."
-                       boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
-                       boot_mesg "" ${NORMAL}
-                       read ENTER
-                       /etc/rc.d/init.d/halt stop
-               fi
+               #if ! mountpoint /dev > /dev/null; then
+               #       mount -n -t tmpfs tmpfs /dev -o mode=755
+               #fi
+#              if [ ${?} != 0 ]; then
+#                      echo_failure
+#                      boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
+#                      boot_mesg -n " onto /dev, this system will be halted."
+#                      boot_mesg -n "\n\nAfter you press Enter, this system"
+#                      boot_mesg -n " will be halted and powered off."
+#                      boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
+#                      boot_mesg "" ${NORMAL}
+#                      read ENTER
+#                      /etc/rc.d/init.d/halt stop
+#              fi
 
                # Udev handles uevents itself, so we don't need to have
                # the kernel call out to any binary in response to them
-               echo > /proc/sys/kernel/hotplug
+               #echo > /proc/sys/kernel/hotplug
 
-               # Copy the only static device node that Udev >= 155 doesn't
-               # handle to /dev
-               cp -a /lib/udev/devices/null /dev
+               # Copy static device nodes to /dev
 
                # Start the udev daemon to continually watch for, and act on,
                # uevents

[hongxun@HouLFS-09:26:53 ~]$ udevd -V
157

It's no doubt that udev daemon will copy the files for you.

Do {pts,shm} exist under your /lib/udev/devices directory?

comment:3 by Matthew Burgess, 14 years ago

I see the same behaviour as hohoxu_hao115; udev-156 correctly copies the contents of /lib/udev/devices for me, rather than requiring the bootscript to do it. Not sure what's going wrong for you, Andy, but I can't reproduce here. Could you confirm that your /lib/udev/devices contains the following please?

root:/# ls -l /lib/udev/devices/
total 8
crw-rw-rw- 1 root root 1, 3 May 29 10:18 null
drwxr-xr-x 2 root root 4096 May 29 10:18 pts
drwxr-xr-x 2 root root 4096 May 29 10:18 shm

comment:4 by bdubbs@…, 14 years ago

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.