Bug#609476: installation-reports: Insufficient care in pre-install script risks bricking Linkstation
Justification: breaks the whole system
I attempted to install Debian squeeze on my Buffalo Linkstation Live
(LS-CHLv2), as per guidance at
Ultimately I failed, but this report concerns one serious issue encountered on
The daily snapshots linked from <http://www.debian.org/devel/debian-installer/>
include this script:
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 220.127.116.11-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 @@
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
if [ $BOOTVER_MAJOR -eq 1 -a $BOOTVER_MINOR -lt 10 ]; then
echo "Incompatible bootloader version detected. Please update to the latest firmware version."
printf "Saving U-Boot environment to ubootenv.bak... "
-$PRINTENV > ubootenv.bak
+$PRINTENV > ubootenv.bak || exit 1
echo "Changing U-Boot environment... "
$SETENV bootargs_root "root=/dev/sda2 rw panic=5"