Package: installation-reports
Severity: critical
Tags: patch
Justification: breaks the whole system
I attempted to install Debian squeeze on my Buffalo Linkstation Live
(LS-CHLv2), as per guidance at
<http://buffalo.nas-central.org/wiki/Install_Debian_on_the_Linkstation_Pro/Live>.
Ultimately I failed, but this report concerns one serious issue encountered on
the way.

The daily snapshots linked from <http://www.debian.org/devel/debian-installer/>
include this script:
<http://people.debian.org/~joeyh/d-i/armel/images/daily/orion5x/network-console/buffalo/lspro/config-debian>
intended to prepare the system for reboot into the Debian kernel.  One of the
ways in which this script can fail is that the buffalo version is not fetched
from the environment.  However, in this case the script does not exit and
proceeds to attempt to modify the environment.  If the users /etc/fw_env.config
is incorrect (as mine was) then this attempt to fetch the version will fail,
and the subsequent modification of the environment might modify an arbitrary
portion of the system's flash memory, potentially rendering it unbootable.
Luckily I noticed this issue when fw_printenv failed for other reasons, and
fw_setenv failed also.

I propose adding an "exit 1" to the script after the error message related to
this issue.  For completeness, I would also recommend exiting from the script
if the attempt to back up the pre-existing environment fails.  The attached
patch to config-debian includes both changes.

-- System Information:
Debian Release: 5.0.7
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: armel (armv5tejl)

Kernel: Linux 2.6.22.18-88f6281
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
--- config-debian       2011-01-09 11:39:49.000000000 +0000
+++ config-debian.new   2011-01-09 18:36:54.143989487 +0000
@@ -43,21 +43,22 @@
 fi
 
 BOOTVER=$($GETENV buffalo_ver | sed 's/^.*=//')
 if [ -z "$BOOTVER" ]; then
        echo "Unable to detect Buffalo bootloader version.  Please ensure that 
your bootloader supports automatic initrd position/size detection."
+       exit 1
 else
        BOOTVER_MAJOR=${BOOTVER%.*}
        BOOTVER_MINOR=${BOOTVER#*.}
        if [ $BOOTVER_MAJOR -eq 1 -a $BOOTVER_MINOR -lt 10 ]; then
                echo "Incompatible bootloader version detected.  Please update 
to the latest firmware version."
                exit 1
        fi
 fi
 
 printf "Saving U-Boot environment to ubootenv.bak... "
-$PRINTENV > ubootenv.bak
+$PRINTENV > ubootenv.bak || exit 1
 echo "done."
 
 echo "Changing U-Boot environment... "
 $SETENV bootargs_root "root=/dev/sda2 rw panic=5"
 echo "done."

Reply via email to