3 echo Starting /init script ...
5 PATH=/sbin:/usr/sbin:/bin:/usr/bin
10 mount -t proc /proc /proc
11 mount -t sysfs /sys /sys
13 if [ ! -L /etc/init.d/udev -a -x /etc/init.d/udev ]; then
14 if type service >/dev/null 2>&1; then
17 /etc/init.d/udev start
19 elif [ -x /sbin/start_udev ] && /sbin/start_udev; then
21 elif [ -x /sbin/udevd ]; then
22 echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
25 /sbin/udevadm settle --timeout=10
27 echo No udev, creating /dev manually
28 mount -t tmpfs none /dev
29 mkdir /dev/pts /dev/shm /dev/mapper
30 mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
31 # Must do each MAKEDEV individually, because if one device fails,
32 # MAKEDEV will quit without creating the rest (RHBZ#507374).
33 for dev in mem null port zero core full ram tty console fd \
34 hda hdb hdc hdd sda sdb sdc sdd loop sd; do
37 mknod /dev/ptmx c 5 2; chmod 0666 /dev/ptmx
38 mknod /dev/random c 1 8; chmod 0666 /dev/random
39 mknod /dev/urandom c 1 9; chmod 0444 /dev/urandom
40 ln -sf /proc/self/fd/0 /dev/stdin
41 ln -sf /proc/self/fd/1 /dev/stdout
42 ln -sf /proc/self/fd/2 /dev/stderr
48 if grep -sq selinux=1 /proc/cmdline; then
49 mount -t selinuxfs none /selinux
52 # Update the system clock.
57 ifconfig eth0 169.254.2.10
58 route add default gw 169.254.2.2
63 lvm vgscan --ignorelockingfailure
64 lvm vgchange -ay --ignorelockingfailure
66 # Improve virtio-blk performance (RHBZ#509383).
67 for f in /sys/block/vd*/queue/rotational; do echo 1 > $f; done
69 # http://kbase.redhat.com/faq/docs/DOC-5428
70 # Disabled this until https://bugzilla.redhat.com/show_bug.cgi?id=630583
71 # is fixed (broken in Linux 2.6.36).
72 #for f in /sys/block/[hsv]d*/queue/scheduler; do echo noop > $f; done
74 # These are useful when debugging.
75 if grep -sq guestfs_verbose=1 /proc/cmdline; then
86 #ping -n -v -c 5 10.0.2.2
87 #ping -n -v -c 5 10.0.2.4
89 echo -n "uptime: "; cat /proc/uptime
92 if ! grep -sq guestfs_rescue=1 /proc/cmdline; then
96 # Use appliance in rescue mode, also used by the virt-rescue command.
97 eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline)
101 echo "------------------------------------------------------------"
103 echo "Welcome to virt-rescue, the libguestfs rescue shell."
105 echo "Note: The contents of / are the rescue appliance."
106 echo "You have to mount the guest's partitions under /sysroot"
107 echo "before you can examine them."
111 echo "virt-rescue: Syncing the disk now before exiting ..."
112 echo "(Don't worry if you see a 'Kernel panic' message below)"