LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   /proc/devices missing (http://www.linuxquestions.org/questions/linux-general-1/proc-devices-missing-782216/)

euroquisling 01-14-2010 11:52 AM

/proc/devices missing
 
Hello everyone,

I am booting RH over network (PXE) with custom initrd.img. I managed to get NFS working and switch root and do normal RH /sbin/init, but as RH boots it complains about /proc/devices missing:

/proc/devices: fopen failed: No such file or directory

The file is indeed missing, even though I'm doing "modprobe dm_mod" before. But still /proc/devices is not created. What am I doing wrong?

init script for that initrd.img:

Code:

#!/bin/bash

export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/kerberos/lib

mount -t proc /proc /proc
setquiet
echo Mounting proc filesystem
echo Mounting sysfs filesystem
mount -t sysfs /sys /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
mkdir /dev/shm
mkdir /dev/mapper
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/urandom c 1 9
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/rtc c 10 135
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/tty4 c 4 4
mknod /dev/tty5 c 4 5
mknod /dev/tty6 c 4 6
mknod /dev/tty7 c 4 7
mknod /dev/tty8 c 4 8
mknod /dev/tty9 c 4 9
mknod /dev/tty10 c 4 10
mknod /dev/tty11 c 4 11
mknod /dev/tty12 c 4 12
mknod /dev/ttyS0 c 4 64
mknod /dev/ttyS1 c 4 65
mknod /dev/ttyS2 c 4 66
mknod /dev/ttyS3 c 4 67
echo Setting up hotplug.
hotplug
echo Creating block device nodes.
mkblkdevs
echo "Loading ehci-hcd.ko module"
insmod /lib/ehci-hcd.ko
echo "Loading ohci-hcd.ko module"
insmod /lib/ohci-hcd.ko
echo "Loading uhci-hcd.ko module"
insmod /lib/uhci-hcd.ko
mount -t usbfs /proc/bus/usb /proc/bus/usb
echo "Loading jbd.ko module"
insmod /lib/jbd.ko
echo "Loading ext3.ko module"
insmod /lib/ext3.ko
echo "Loading scsi_mod.ko module"
insmod /lib/scsi_mod.ko
echo "Loading sd_mod.ko module"
insmod /lib/sd_mod.ko
echo "Loading scsi_transport_spi.ko module"
insmod /lib/scsi_transport_spi.ko
echo "Loading mptbase.ko module"
insmod /lib/mptbase.ko
echo "Loading mptscsih.ko module"
insmod /lib/mptscsih.ko
echo "Loading mptspi.ko module"
insmod /lib/mptspi.ko
echo "Loading libata.ko module"
insmod /lib/libata.ko
echo "Loading ata_piix.ko module"
insmod /lib/ata_piix.ko
echo "Loading dm-mod.ko module"
insmod /lib/dm-mod.ko
echo "Loading dm-log.ko module"
insmod /lib/dm-log.ko
echo "Loading dm-mirror.ko module"
insmod /lib/dm-mirror.ko
echo "Loading dm-zero.ko module"
insmod /lib/dm-zero.ko
echo "Loading dm-snapshot.ko module"
insmod /lib/dm-snapshot.ko
echo "Loading dm-mem-cache.ko module"
insmod /lib/dm-mem-cache.ko
echo "Loading dm-region_hash.ko module"
insmod /lib/dm-region_hash.ko
echo "Loading dm-message.ko module"
insmod /lib/dm-message.ko
echo "Loading dm-raid45.ko module"
insmod /lib/dm-raid45.ko
echo Waiting for driver initialization.
stabilized --hash --interval 1000 /proc/scsi/scsi
mkblkdevs
echo Scanning and configuring dmraid supported devices
echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure  rootvg
resume LABEL=SWAP-sda3

################################ Modified ################################

# modules
depmod -a
modprobe pcnet32

# device mapper
modprobe dm_mod

# network
ip addr add 127.0.0.1/8 dev lo
echo "127.0.0.1              localhost.localdomain localhost" >> /etc/hosts
echo "::1            localhost6.localdomain6 localhost6" >> /etc/hosts

ip link set lo up
ip link set eth0 up
ip link set eth1 up

dhclient eth0

portmap

echo Mounting root filesystem.

mkdir /mnt
mount -o ro 192.168.1.1:/nfs/RH /mnt

echo "PID of the init script: $$"

#exec bin/bash
exec switch_root -c /dev/console /mnt /sbin/init

Script creating initrd:

Code:

#!/bin/bash -x

rm -rf /tmp/initrd
mkdir -p /tmp/initrd

cd /tmp/initrd

cat /boot/initrd-2.6.18-164.el5.img | gzip -dc | cpio -ivd

cp /sbin/nash bin
cp /sbin/busybox bin
cp /bin/bash bin
cp /sbin/consoletype bin
cp /sbin/dhclient bin
cp /sbin/dhclient-script bin
cp /usr/sbin/rpcinfo bin
cp /sbin/ifconfig bin
cp /sbin/insmod bin
cp /sbin/ip bin
cp /sbin/lspci bin
cp /sbin/lsmod bin
cp /sbin/modprobe bin
cp /bin/mount bin
cp /sbin/mount.nfs bin
cp /sbin/mount.nfs4 bin
cp /sbin/pivot_root bin
cp /sbin/rmmod bin
cp /sbin/route bin
cp /sbin/iptables bin

# portmap is necessary for running NFS

cp /sbin/portmap bin
cp /usr/sbin/pmap_dump bin
cp /usr/sbin/pmap_set bin


#rm -f /tmp/liblist
#ls -1 bin | while read x; do
#        ldd
#done


#
cd /tmp/initrd/bin

ln -s busybox '['
ln -s busybox '[['
ln -s busybox 'addgroup'
ln -s busybox 'adduser'
ln -s busybox 'adjtimex'
ln -s busybox 'ar'
ln -s busybox 'arping'
ln -s busybox 'ash'
ln -s busybox 'awk'
ln -s busybox 'basename'
ln -s busybox 'bbconfig'
ln -s busybox 'bunzip2'
ln -s busybox 'busybox'
ln -s busybox 'bzcat'
ln -s busybox 'cal'
ln -s busybox 'cat'
ln -s busybox 'catv'
ln -s busybox 'chattr'
ln -s busybox 'chgrp'
ln -s busybox 'chmod'
ln -s busybox 'chown'
ln -s busybox 'chroot'
ln -s busybox 'chvt'
ln -s busybox 'cksum'
ln -s busybox 'clear'
ln -s busybox 'cmp'
ln -s busybox 'comm'
ln -s busybox 'cp'
ln -s busybox 'cpio'
ln -s busybox 'crond'
ln -s busybox 'crontab'
ln -s busybox 'cut'
ln -s busybox 'date'
ln -s busybox 'dc'
ln -s busybox 'dd'
ln -s busybox 'deallocvt'
ln -s busybox 'delgroup'
ln -s busybox 'deluser'
ln -s busybox 'devfsd'
ln -s busybox 'df'
ln -s busybox 'diff'
ln -s busybox 'dirname'
ln -s busybox 'dmesg'
ln -s busybox 'dnsd'
ln -s busybox 'dos2unix'
ln -s busybox 'dpkg'
ln -s busybox 'dpkg-deb'
ln -s busybox 'du'
ln -s busybox 'dumpkmap'
ln -s busybox 'dumpleases'
ln -s busybox 'e2fsck'
ln -s busybox 'e2label'
ln -s busybox 'echo'
ln -s busybox 'ed'
ln -s busybox 'egrep'
ln -s busybox 'eject'
ln -s busybox 'env'
ln -s busybox 'ether-wake'
ln -s busybox 'expr'
ln -s busybox 'fakeidentd'
ln -s busybox 'false'
ln -s busybox 'fbset'
ln -s busybox 'fdflush'
ln -s busybox 'fdformat'
ln -s busybox 'fdisk'
ln -s busybox 'fgrep'
ln -s busybox 'find'
ln -s busybox 'findfs'
ln -s busybox 'fold'
ln -s busybox 'free'
ln -s busybox 'freeramdisk'
ln -s busybox 'fsck'
ln -s busybox 'fsck.ext2'
ln -s busybox 'fsck.ext3'
ln -s busybox 'fsck.minix'
ln -s busybox 'ftpget'
ln -s busybox 'ftpput'
ln -s busybox 'fuser'
ln -s busybox 'getopt'
ln -s busybox 'getty'
ln -s busybox 'grep'
ln -s busybox 'gunzip'
ln -s busybox 'gzip'
ln -s busybox 'hdparm'
ln -s busybox 'head'
ln -s busybox 'hexdump'
ln -s busybox 'hostid'
ln -s busybox 'hostname'
ln -s busybox 'httpd'
ln -s busybox 'hush'
ln -s busybox 'hwclock'
ln -s busybox 'id'
ln -s busybox 'ifdown'
ln -s busybox 'ifup'
ln -s busybox 'inetd'
ln -s busybox 'install'
ln -s busybox 'ipaddr'
ln -s busybox 'ipcalc'
ln -s busybox 'ipcrm'
ln -s busybox 'ipcs'
ln -s busybox 'iplink'
ln -s busybox 'iproute'
ln -s busybox 'iptunnel'
ln -s busybox 'kill'
ln -s busybox 'killall'
ln -s busybox 'lash'
ln -s busybox 'last'
ln -s busybox 'length'
ln -s busybox 'less'
ln -s busybox 'linux32'
ln -s busybox 'linux64'
ln -s busybox 'ln'
ln -s busybox 'load_policy'
ln -s busybox 'loadfont'
ln -s busybox 'loadkmap'
ln -s busybox 'login'
ln -s busybox 'logname'
ln -s busybox 'losetup'
ln -s busybox 'ls'
ln -s busybox 'lsattr'
ln -s busybox 'lzmacat'
ln -s busybox 'makedevs'
ln -s busybox 'md5sum'
ln -s busybox 'mdev'
ln -s busybox 'mesg'
ln -s busybox 'mkdir'
ln -s busybox 'mke2fs'
ln -s busybox 'mkfifo'
ln -s busybox 'mkfs.ext2'
ln -s busybox 'mkfs.ext3'
ln -s busybox 'mkfs.minix'
ln -s busybox 'mknod'
ln -s busybox 'mkswap'
ln -s busybox 'mktemp'
ln -s busybox 'more'
ln -s busybox 'mountpoint'
ln -s busybox 'msh'
ln -s busybox 'mt'
ln -s busybox 'mv'
ln -s busybox 'nameif'
ln -s busybox 'nc'
ln -s busybox 'netstat'
ln -s busybox 'nice'
ln -s busybox 'nohup'
ln -s busybox 'nslookup'
ln -s busybox 'od'
ln -s busybox 'openvt'
ln -s busybox 'passwd'
ln -s busybox 'patch'
ln -s busybox 'pidof'
ln -s busybox 'ping'
ln -s busybox 'ping6'
ln -s busybox 'pipe_progress'
ln -s busybox 'printenv'
ln -s busybox 'printf'
ln -s busybox 'ps'
ln -s busybox 'pwd'
ln -s busybox 'rdate'
ln -s busybox 'readlink'
ln -s busybox 'readprofile'
ln -s busybox 'realpath'
ln -s busybox 'renice'
ln -s busybox 'reset'
ln -s busybox 'rm'
ln -s busybox 'rmdir'
ln -s busybox 'rpm'
ln -s busybox 'rpm2cpio'
ln -s busybox 'run-parts'
ln -s busybox 'runlevel'
ln -s busybox 'rx'
ln -s busybox 'sed'
ln -s busybox 'seq'
ln -s busybox 'setarch'
ln -s busybox 'setconsole'
ln -s busybox 'setkeycodes'
ln -s busybox 'setlogcons'
ln -s busybox 'setsid'
ln -s busybox 'sha1sum'
ln -s busybox 'sleep'
ln -s busybox 'sort'
ln -s busybox 'start-stop-daemon'
ln -s busybox 'stat'
ln -s busybox 'strings'
ln -s busybox 'stty'
ln -s busybox 'su'
ln -s busybox 'sulogin'
ln -s busybox 'sum'
ln -s busybox 'swapoff'
ln -s busybox 'swapon'
ln -s busybox 'switch_root'
ln -s busybox 'sync'
ln -s busybox 'sysctl'
ln -s busybox 'tail'
ln -s busybox 'tar'
ln -s busybox 'tee'
ln -s busybox 'telnet'
ln -s busybox 'telnetd'
ln -s busybox 'test'
ln -s busybox 'tftp'
ln -s busybox 'time'
ln -s busybox 'top'
ln -s busybox 'touch'
ln -s busybox 'tr'
ln -s busybox 'traceroute'
ln -s busybox 'true'
ln -s busybox 'tty'
ln -s busybox 'tune2fs'
ln -s busybox 'udhcpc'
ln -s busybox 'udhcpd'
ln -s busybox 'umount'
ln -s busybox 'uname'
ln -s busybox 'uncompress'
ln -s busybox 'uniq'
ln -s busybox 'unix2dos'
ln -s busybox 'unlzma'
ln -s busybox 'unzip'
ln -s busybox 'uptime'
ln -s busybox 'usleep'
ln -s busybox 'uudecode'
ln -s busybox 'uuencode'
ln -s busybox 'vconfig'
ln -s busybox 'vi'
ln -s busybox 'vlock'
ln -s busybox 'watch'
ln -s busybox 'watchdog'
ln -s busybox 'wc'
ln -s busybox 'wget'
ln -s busybox 'which'
ln -s busybox 'who'
ln -s busybox 'whoami'
ln -s busybox 'xargs'
ln -s busybox 'yes'
ln -s busybox 'zcat'
ln -s busybox 'zcip'

# libs, 1
rm -f /tmp/liblist
find . -type f | while read x; do ldd "$x" >>/tmp/liblist 2>&1; done

cd /tmp/initrd


cat /tmp/liblist  | awk '{for(i=1; i<=NF; i++) {if($i ~ /\/.+/) print $i;}}' | sort | uniq > /tmp/liblist2

cat /tmp/liblist2 | while read x; do
        cp -f "$x" lib
done

cp -a /lib/modules lib

# libs, 2
cp /lib/libcrypt.so.1 lib
cp /lib/libkeyutils-1.2.so lib
cp /lib/libcom_err.so.2.1 lib
cp /lib/libm.so.6 lib
cp /lib/librt.so.1 lib
cp /lib/libnsl.so.1 lib
cp /lib/libcrypto.so.0.9.8e lib
cp /lib/ld-2.5.so lib
cp /lib/libblkid.so.1.0 lib
cp /lib/libdl-2.5.so lib
cp /lib/libnsl-2.5.so lib
cp /lib/libuuid.so.1.2 lib
cp /lib/libcrypt-2.5.so lib
cp /lib/libcom_err.so.2 lib
cp /lib/libcrypto.so.6 lib
cp /lib/libc-2.5.so lib
cp /lib/libm-2.5.so lib
cp /lib/libpthread-2.5.so lib
cp /lib/libtermcap.so.2.0.8 lib
cp /lib/libkeyutils.so.1 lib

# networking
cp /etc/nsswitch.conf etc
cp /lib/libnss_dns* lib
cp /lib/libnss_files* lib
cp /lib/libresolv-2.5.so lib
cd lib
ln -s libresolv-2.5.so libresolv.so.2

cd /tmp/initrd

rm -f /tmp/initrd.img

cp -f /tmp/init_script /tmp/initrd/init

find . | cpio -o -H newc > /tmp/initrd.img
gzip /tmp/initrd.img
mv -f /tmp/initrd.img.gz /tmp/initrd.img

cp -f /tmp/initrd.img /tftpboot/linux-install/initrd_mk.img


DrLove73 01-14-2010 05:50 PM

Shouldn't you create actual directory "proc/devices". I do not see the mkdir line. I am not familiar with this, so I am just asking.


All times are GMT -5. The time now is 10:36 PM.