Hi Guus, Hi Ziga,

Guus Sliepen schrieb am Tue 20. Feb, 15:40 (+0100):
> After booting a few times I noticed that it sometimes works OK, but most
> of the time it doesn't. I guess it's caused by udev mounting a tmpfs
> over /dev, which makes /dev empty for a short interval. Perhaps you
> should create a copy of /dev/null to a safe place in the postinst
> script? Not very nice, I agree.

Can you try this patch for bootchartd? Does it now work?

@Ziga: Another idea is to not use /dev/null inside of start() and call
  start() with >/dev/null 2>&1. But I couldn't see if stdout/stderr is
  used for something in start. Until the call “start &” the problem
  should not happen, because udev can run while we are running.

Bye, Jörg.
-- 
Wenn unser Hirn so einfach wäre, dass es sich selbst
begreifen könnte, dann könnte es sich selbst nicht mehr
begreifen, weil es zu einfach wäre ;) Nur mal so als
philosophischer Denkanstoss …
#! /bin/sh /usr/share/dpatch/dpatch-run
## fix-missing-devnull.dpatch by Jörg Sommer <[EMAIL PROTECTED]>
##
## DP: udev mounts a (empty) tmpfs over /dev. Hence, there is a short
## DP: time where /dev/null is not available. If bootchartd tries to use
## DP: it in such a moment, it fails.

@DPATCH@
diff -urNad bootchart~/script/bootchartd bootchart/script/bootchartd
--- bootchart~/script/bootchartd        2007-02-24 12:09:18.229278214 +0100
+++ bootchart/script/bootchartd 2007-02-24 12:13:49.497278214 +0100
@@ -31,6 +31,9 @@
         exit 1
 fi
 
+# udev may remove /dev/null later for a short period. Save it now for later
+# use.
+exec 3>/dev/null
 
 # Start the boot logger.
 start()
@@ -43,11 +46,11 @@
        # boot), a tmpfs is mounted in /mnt.  The mount point is immediately
        # released using a lazy umount, so the script must never leave that
        # directory.
-       LOG_DIR="$( mktemp -d /tmp/bootchart.XXXXXX 2>/dev/null )"
+       LOG_DIR="$( mktemp -d /tmp/bootchart.XXXXXX 2>&3)"
        if [ -z "$LOG_DIR" ]; then
                LOG_DIR="/mnt"
                LAZY_UMOUNT="yes"
-               mount -n -t tmpfs -o size=$TMPFS_SIZE none "$LOG_DIR" 
>/dev/null 2>&1
+               mount -n -t tmpfs -o size=$TMPFS_SIZE none "$LOG_DIR" >&3 2>&1
        fi
        cd "$LOG_DIR"
        > "$BOOTLOG_LOCK"
@@ -105,7 +108,7 @@
                echo ${uptime%.*}${uptime#*.}
 
                # Log the command output
-               eval $cmd 2>/dev/null
+               eval $cmd 2>&3
                echo
                sleep $SAMPLE_PERIOD
        done  >> "$logfile" || stop

Attachment: pgpL084eoYk01.pgp
Description: PGP signature

Reply via email to