3 echo Starting /init script ...
5 PATH=/sbin:/usr/sbin:/bin:/usr/bin
11 export RUNLEVEL PREVLEVEL
15 rm -f /proc; mkdir /proc
16 mount -t proc /proc /proc
17 rm -f /sys; mkdir /sys
18 mount -t sysfs /sys /sys
21 if [ ! -L /etc/init.d/udev -a -x /etc/init.d/udev ]; then
22 if type service >/dev/null 2>&1; then
25 /etc/init.d/udev start
27 elif [ -x /sbin/start_udev ] && /sbin/start_udev; then
29 elif [ -x /sbin/udevd ]; then
30 echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
35 echo No udev, creating /dev manually
36 mount -t tmpfs none /dev
37 mkdir /dev/pts /dev/shm /dev/mapper
38 mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
39 # Must do each MAKEDEV individually, because if one device fails,
40 # MAKEDEV will quit without creating the rest (RHBZ#507374).
41 for dev in mem null port zero core full ram tty console fd \
42 hda hdb hdc hdd sda sdb sdc sdd loop sd; do
45 mknod /dev/ptmx c 5 2; chmod 0666 /dev/ptmx
46 mknod /dev/random c 1 8; chmod 0666 /dev/random
47 mknod /dev/urandom c 1 9; chmod 0444 /dev/urandom
48 ln -sf /proc/self/fd/0 /dev/stdin
49 ln -sf /proc/self/fd/1 /dev/stdout
50 ln -sf /proc/self/fd/2 /dev/stderr
56 if grep -sq selinux=1 /proc/cmdline; then
57 mount -t selinuxfs none /selinux
60 # Update the system clock.
65 ifconfig eth0 169.254.2.10
66 route add default gw 169.254.2.2
71 lvm vgscan --ignorelockingfailure
72 lvm vgchange -ay --ignorelockingfailure
74 # Improve virtio-blk performance (RHBZ#509383).
75 for f in /sys/block/vd*/queue/rotational; do echo 1 > $f; done
77 # http://kbase.redhat.com/faq/docs/DOC-5428
78 # Disabled this until https://bugzilla.redhat.com/show_bug.cgi?id=630583
79 # is fixed (broken in Linux 2.6.36).
80 #for f in /sys/block/[hsv]d*/queue/scheduler; do echo noop > $f; done
82 # These are useful when debugging.
83 if grep -sq guestfs_verbose=1 /proc/cmdline; then
94 #ping -n -v -c 5 10.0.2.2
95 #ping -n -v -c 5 10.0.2.4
97 echo -n "uptime: "; cat /proc/uptime
100 if ! grep -sq guestfs_rescue=1 /proc/cmdline; then
101 # The host will kill qemu abruptly if guestfsd shuts down normally
104 # Otherwise we try to clean up gracefully. For example, this ensures that a
105 # core dump generated by the guest daemon will be written to disk.
107 # Use appliance in rescue mode, also used by the virt-rescue command.
108 eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline)
112 echo "------------------------------------------------------------"
114 echo "Welcome to virt-rescue, the libguestfs rescue shell."
116 echo "Note: The contents of / are the rescue appliance."
117 echo "You have to mount the guest's partitions under /sysroot"
118 echo "before you can examine them."
122 echo "virt-rescue: Syncing the disk now before exiting ..."