Patch for Slackware 14.1 guest on a Linux-Vserver host ======================================================== by Roberto Puzzanghera - http://notes.sagredo.eu version: 2014.08.05 ======================================================== diff -ruN rc.d-original/rc.0 rc.d/rc.0 --- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200 +++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100 @@ -37,22 +37,6 @@ ;; esac -# Save the system time to the hardware clock using hwclock --systohc. -if [ -x /sbin/hwclock ]; then - # Check for a broken motherboard RTC clock (where ioports for rtc are - # unknown) to prevent hwclock causing a hang: - if ! grep -q -w rtc /proc/ioports ; then - CLOCK_OPT="--directisa" - fi - if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then - echo "Saving system time to the hardware clock (UTC)." - /sbin/hwclock $CLOCK_OPT --utc --systohc - else - echo "Saving system time to the hardware clock (localtime)." - /sbin/hwclock $CLOCK_OPT --localtime --systohc - fi -fi - # Run any local shutdown scripts: if [ -x /etc/rc.d/rc.local_shutdown ]; then /etc/rc.d/rc.local_shutdown stop @@ -98,24 +82,6 @@ sh /etc/rc.d/rc.messagebus stop fi -# Kill any processes (typically gam) that would otherwise prevent -# unmounting NFS volumes: -unset FUSER_DELAY -for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do - echo "Killing processes holding NFS mount $dir open..." - # Background this to prevent fuser from also blocking shutdown: - /usr/bin/fuser -k -m $dir & - FUSER_DELAY=5 -done -# If fuser was run, let it have some delay: -if [ ! -z "$FUSER_DELAY" ]; then - sleep $FUSER_DELAY -fi - -# Unmount any NFS, SMB, or CIFS filesystems: -echo "Unmounting remote filesystems." -/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs - # Try to shut down pppd: PS="$(ps ax)" if echo "$PS" | /bin/grep -q -w pppd ; then @@ -131,45 +97,11 @@ fi fi -# Bring down the networking system, but first make sure that this -# isn't a diskless client with the / partition mounted via NFS: -if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then - if [ -x /etc/rc.d/rc.inet1 ]; then - . /etc/rc.d/rc.inet1 stop - fi -fi - -# In case dhcpcd might have been manually started on the command line, -# look for the .pid file, and shut dhcpcd down if it's found: -if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then - /sbin/dhcpcd -k 1> /dev/null 2> /dev/null - # A little time for /etc/resolv.conf and/or other files to - # restore themselves. - sleep 2 -fi - -# Shut down PCMCIA devices: -if [ -x /etc/rc.d/rc.pcmcia ]; then - . /etc/rc.d/rc.pcmcia stop - # The cards might need a little extra time here to deactivate: - /bin/sleep 5 -fi - # Turn off process accounting: if [ -x /sbin/accton -a -r /var/log/pacct ]; then /sbin/accton off fi -# Terminate acpid before syslog: -if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit - . /etc/rc.d/rc.acpid stop -fi - -# Stop udev: -if [ -x /etc/rc.d/rc.udev ]; then - sh /etc/rc.d/rc.udev force-stop -fi - # Kill all remaining processes. if [ ! "$1" = "fast" ]; then echo "Sending all processes the SIGTERM signal." @@ -187,16 +119,6 @@ fi fi -# Carry a random seed between reboots. -echo "Saving random seed from /dev/urandom in /etc/random-seed." -# Use the pool size from /proc, or 4096 bits: -if [ -r /proc/sys/kernel/random/poolsize ]; then - /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null -else - /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null -fi -/bin/chmod 600 /etc/random-seed - # Before unmounting file systems write a reboot or halt record to wtmp. $command -w @@ -205,80 +127,5 @@ rm -f /var/lock/subsys/* fi -# Turn off swap: -echo "Turning off swap." -/sbin/swapoff -a -/bin/sync - -echo "Unmounting local file systems." -/bin/umount -v -a -t no,proc,sysfs - -echo "Remounting root filesystem read-only." -/bin/mount -v -n -o remount,ro / - # This never hurts: /bin/sync - -# Close any volumes opened by cryptsetup: -if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then - cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do - # NOTE: we only support LUKS formatted volumes (except for swap)! - LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ') - DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ') - OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ') - if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then - echo "Locking LUKS crypt volume '${LUKS}':" - /sbin/cryptsetup luksClose ${LUKS} - elif echo $OPTS | grep -wq swap ; then - # If any of the volumes was used as encrypted swap, - # then run mkswap on the underlying device - - # in case other Linux installations on this computer should use it: - echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:" - /sbin/cryptsetup remove ${LUKS} - mkswap $DEV - fi - done -fi - -# Deactivate LVM volume groups: -if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then - echo "Deactivating LVM volume groups:" - /sbin/vgchange -an --ignorelockingfailure -fi - -# This never hurts again (especially since root-on-LVM always fails -# to deactivate the / logical volume... but at least it was -# remounted as read-only first) -/bin/sync - -# sleep 3 fixes problems with some hard drives that don't -# otherwise finish syncing before reboot or poweroff -/bin/sleep 3 - -# This is to ensure all processes have completed on SMP machines: -wait - -if [ -x /sbin/genpowerd ]; then - # See if this is a powerfail situation: - if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then - # Signal UPS to shut off the inverter: - /sbin/genpowerd -k - if [ ! $? = 0 ]; then - echo - echo "There was an error signaling the UPS." - echo "Perhaps you need to edit /etc/genpowerd.conf to configure" - echo "the serial line and UPS type." - # Wasting 15 seconds of precious power: - /bin/sleep 15 - fi - fi -fi - -# Now halt (poweroff with APM or ACPI enabled kernels) or reboot. -if [ "$command" = "reboot" ]; then - echo "Rebooting." - /sbin/reboot -else - /sbin/poweroff -fi - diff -ruN rc.d-original/rc.6 rc.d/rc.6 --- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200 +++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100 @@ -37,22 +37,6 @@ ;; esac -# Save the system time to the hardware clock using hwclock --systohc. -if [ -x /sbin/hwclock ]; then - # Check for a broken motherboard RTC clock (where ioports for rtc are - # unknown) to prevent hwclock causing a hang: - if ! grep -q -w rtc /proc/ioports ; then - CLOCK_OPT="--directisa" - fi - if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then - echo "Saving system time to the hardware clock (UTC)." - /sbin/hwclock $CLOCK_OPT --utc --systohc - else - echo "Saving system time to the hardware clock (localtime)." - /sbin/hwclock $CLOCK_OPT --localtime --systohc - fi -fi - # Run any local shutdown scripts: if [ -x /etc/rc.d/rc.local_shutdown ]; then /etc/rc.d/rc.local_shutdown stop @@ -98,24 +82,6 @@ sh /etc/rc.d/rc.messagebus stop fi -# Kill any processes (typically gam) that would otherwise prevent -# unmounting NFS volumes: -unset FUSER_DELAY -for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do - echo "Killing processes holding NFS mount $dir open..." - # Background this to prevent fuser from also blocking shutdown: - /usr/bin/fuser -k -m $dir & - FUSER_DELAY=5 -done -# If fuser was run, let it have some delay: -if [ ! -z "$FUSER_DELAY" ]; then - sleep $FUSER_DELAY -fi - -# Unmount any NFS, SMB, or CIFS filesystems: -echo "Unmounting remote filesystems." -/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs - # Try to shut down pppd: PS="$(ps ax)" if echo "$PS" | /bin/grep -q -w pppd ; then @@ -131,45 +97,11 @@ fi fi -# Bring down the networking system, but first make sure that this -# isn't a diskless client with the / partition mounted via NFS: -if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then - if [ -x /etc/rc.d/rc.inet1 ]; then - . /etc/rc.d/rc.inet1 stop - fi -fi - -# In case dhcpcd might have been manually started on the command line, -# look for the .pid file, and shut dhcpcd down if it's found: -if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then - /sbin/dhcpcd -k 1> /dev/null 2> /dev/null - # A little time for /etc/resolv.conf and/or other files to - # restore themselves. - sleep 2 -fi - -# Shut down PCMCIA devices: -if [ -x /etc/rc.d/rc.pcmcia ]; then - . /etc/rc.d/rc.pcmcia stop - # The cards might need a little extra time here to deactivate: - /bin/sleep 5 -fi - # Turn off process accounting: if [ -x /sbin/accton -a -r /var/log/pacct ]; then /sbin/accton off fi -# Terminate acpid before syslog: -if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit - . /etc/rc.d/rc.acpid stop -fi - -# Stop udev: -if [ -x /etc/rc.d/rc.udev ]; then - sh /etc/rc.d/rc.udev force-stop -fi - # Kill all remaining processes. if [ ! "$1" = "fast" ]; then echo "Sending all processes the SIGTERM signal." @@ -187,16 +119,6 @@ fi fi -# Carry a random seed between reboots. -echo "Saving random seed from /dev/urandom in /etc/random-seed." -# Use the pool size from /proc, or 4096 bits: -if [ -r /proc/sys/kernel/random/poolsize ]; then - /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null -else - /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null -fi -/bin/chmod 600 /etc/random-seed - # Before unmounting file systems write a reboot or halt record to wtmp. $command -w @@ -205,80 +127,5 @@ rm -f /var/lock/subsys/* fi -# Turn off swap: -echo "Turning off swap." -/sbin/swapoff -a -/bin/sync - -echo "Unmounting local file systems." -/bin/umount -v -a -t no,proc,sysfs - -echo "Remounting root filesystem read-only." -/bin/mount -v -n -o remount,ro / - # This never hurts: /bin/sync - -# Close any volumes opened by cryptsetup: -if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then - cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do - # NOTE: we only support LUKS formatted volumes (except for swap)! - LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ') - DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ') - OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ') - if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then - echo "Locking LUKS crypt volume '${LUKS}':" - /sbin/cryptsetup luksClose ${LUKS} - elif echo $OPTS | grep -wq swap ; then - # If any of the volumes was used as encrypted swap, - # then run mkswap on the underlying device - - # in case other Linux installations on this computer should use it: - echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:" - /sbin/cryptsetup remove ${LUKS} - mkswap $DEV - fi - done -fi - -# Deactivate LVM volume groups: -if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then - echo "Deactivating LVM volume groups:" - /sbin/vgchange -an --ignorelockingfailure -fi - -# This never hurts again (especially since root-on-LVM always fails -# to deactivate the / logical volume... but at least it was -# remounted as read-only first) -/bin/sync - -# sleep 3 fixes problems with some hard drives that don't -# otherwise finish syncing before reboot or poweroff -/bin/sleep 3 - -# This is to ensure all processes have completed on SMP machines: -wait - -if [ -x /sbin/genpowerd ]; then - # See if this is a powerfail situation: - if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then - # Signal UPS to shut off the inverter: - /sbin/genpowerd -k - if [ ! $? = 0 ]; then - echo - echo "There was an error signaling the UPS." - echo "Perhaps you need to edit /etc/genpowerd.conf to configure" - echo "the serial line and UPS type." - # Wasting 15 seconds of precious power: - /bin/sleep 15 - fi - fi -fi - -# Now halt (poweroff with APM or ACPI enabled kernels) or reboot. -if [ "$command" = "reboot" ]; then - echo "Rebooting." - /sbin/reboot -else - /sbin/poweroff -fi - diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2 --- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200 +++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100 @@ -16,26 +16,6 @@ # At this point, we are ready to talk to The World... -# Mount remote (NFS) filesystems: -if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then - # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS - # volumes defined in /etc/fstab since these will need to be running in order - # to mount them. If they are not running, attempting to mount an NFS - # partition will cause mount to hang, or at least result in unreliable - # operation. Keep this in mind if you plan to mount unlisted NFS - # partitions... - # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run - # whether it is set as executable or not. If you don't want to run it, - # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc. - if [ -r /etc/rc.d/rc.rpc ]; then - sh /etc/rc.d/rc.rpc start - fi - echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs" - /sbin/mount -a -t nfs # This may be our /usr runtime! - # Show the mounted volumes: - /sbin/mount -v -t nfs -fi - # If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd, # and rpc.statd. This might be needed to mount NFS partitions that are not # listed in /etc/fstab. Starting this twice won't hurt as the script will @@ -44,23 +24,6 @@ sh /etc/rc.d/rc.rpc start fi -# Mount remote CIFS filesystems. Note that where possible, using CIFS is -# preferred over SMBFS. SMBFS is no longer actively maintained. -if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then - echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs" - /sbin/mount -a -t cifs - # Show the mounted volumes: - /sbin/mount -v -t cifs -fi - -# Mount remote SMB filesystems: -if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then - echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs" - /sbin/mount -a -t smbfs - # Show the mounted volumes: - /sbin/mount -v -t smbfs -fi - # Start the system logger if it is not already running (maybe because /usr # is on a network partition). if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then diff -ruN rc.d-original/rc.M rc.d/rc.M --- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100 +++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100 @@ -20,10 +20,6 @@ /sbin/ldconfig & fi -# Screen blanks after 15 minutes idle time, and powers down in one hour -# if the kernel supports APM or ACPI power management: -/bin/setterm -blank 15 -powersave powerdown -powerdown 60 - # Set the hostname. if [ -r /etc/HOSTNAME ]; then /bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .) diff -ruN rc.d-original/rc.S rc.d/rc.S --- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100 +++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100 @@ -48,31 +48,6 @@ fi fi -# Mount Control Groups filesystem interface: -if grep -wq cgroup /proc/filesystems ; then - if [ -d /sys/fs/cgroup ]; then - # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6) - # Check if we have some tools to autodetect the available cgroup controllers - if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then - # Mount a tmpfs as the cgroup filesystem root - mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup - # Autodetect available controllers and mount them in subfolders - controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)" - for i in $controllers; do - mkdir /sys/fs/cgroup/$i - mount -t cgroup -o $i $i /sys/fs/cgroup/$i - done - unset i controllers - else - # We can't use autodetection so fall back mounting them all together - mount -t cgroup cgroup /sys/fs/cgroup - fi - else - mkdir -p /dev/cgroup - mount -t cgroup cgroup /dev/cgroup - fi -fi - # Initialize the Logical Volume Manager. # This won't start unless we find /etc/lvmtab (LVM1) or # /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog --- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200 +++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100 @@ -5,7 +5,7 @@ syslogd_start() { if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then - echo -n "Starting sysklogd daemons: " +# echo -n "Starting sysklogd daemons: " echo -n "/usr/sbin/syslogd " /usr/sbin/syslogd # prevent syslogd/klogd race condition on SMP kernels @@ -16,10 +16,10 @@ else sleep 1 fi - echo "/usr/sbin/klogd -c 3 -x" +# echo "/usr/sbin/klogd -c 3 -x" # '-c 3' = display level 'error' or higher messages on console # '-x' = turn off broken EIP translation - /usr/sbin/klogd -c 3 -x +# /usr/sbin/klogd -c 3 -x fi }