Difference between revisions of "Install Debian 5.0 (Lenny) On Buffalo Linkstation Mini"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m (cosmetics)
m (Cosmetic changes)
 
(38 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
__TOC__
 
__TOC__
  
== Prerequisites ==
+
{{Warning|This procedure is for installing an older release of Debian.  <ul><li><b>It is highly recommended that users [[Install_Debian_On_Buffalo_Linkstation_Mini|install the latest release of Debian]].</b></li></ul>}}
# Buffalo LinkStation Mini running stock firmware
+
#* If your device has already been modified to run another operating system and/or firmware, you can [[Revert Buffalo Linkstation Mini To Stock Firmware| revert to stock firmware]]
+
#* This process was tested with model LS-WS1.0TGL/R1, but other models may work as well
+
# Ubuntu 10.04 Desktop Edition CD-ROM (download and burn [http://releases.ubuntu.com/lucid/ubuntu-10.04-desktop-i386.iso this ISO file])
+
# Computer which can boot the Ubuntu 10.04 Desktop Edition CD-ROM and access the network successfully (most modern computers meet this requirement)
+
  
  
 
== Overview ==
 
== Overview ==
# Use ACP Commander to establish Telnet session with device
+
The following process converts a [[:Category:LS-WSGL/R1|Buffalo Linkstation Mini]] (model LS-WSxxxxGL/R1) into a fully functional [http://www.gnu.org/gnu/linux-and-gnu.html GNU/Linux] server running [http://en.wikipedia.org/wiki/Debian Debian] version 5.0.6 (Lenny) with the backported [http://en.wikipedia.org/wiki/Linux_kernel Linux] kernel (version 2.6.32-27).
 +
'''No disassembly required.'''
 +
Both [http://en.wikipedia.org/wiki/Standard_RAID_levels#RAID_1 RAID1 (Mirroring)] and [http://en.wikipedia.org/wiki/Standard_RAID_levels#RAID_0 RAID0 (Striping)] configurations are supported.
 +
Here is how the process works:
 +
# Use ACP Commander software to establish Telnet session with device
 
# Uncouple secondary drive partitions from existing RAID configuration
 
# Uncouple secondary drive partitions from existing RAID configuration
 
# Partition and format secondary drive, install Debian 5.0, and prepare for initial boot
 
# Partition and format secondary drive, install Debian 5.0, and prepare for initial boot
Line 22: Line 21:
  
  
== Procedure ==
+
== Requirements ==
 +
# Buffalo LinkStation Mini models LS-WSxxxxGL/R1 running stock firmware ('''LS-WSXxxxxTL/R1 models will not work''')
 +
#* If your device has already been modified to run another operating system and/or firmware, you should [[Revert Buffalo Linkstation Mini To Stock Firmware| revert to stock firmware]]
 +
#* This process was tested with model LS-WS1.0TGL/R1, but other models may work as well
 +
# Ubuntu 10.04 Desktop Edition CD-ROM (download and burn [http://releases.ubuntu.com/lucid/ubuntu-10.04.2-desktop-i386.iso this disc image])
 +
# Computer which can boot the Ubuntu 10.04 Desktop Edition CD-ROM and access the network successfully (most modern computers meet this requirement)
 +
 
 +
 
 +
== Instructions ==
 
<b>
 
<b>
Note: Do not attempt to execute the following commands as a single script
+
Note: Do not attempt to execute the following commands as a single script.
 
Instead, copy and paste each block of commands into a shell window and monitor the resulting output for errors
 
Instead, copy and paste each block of commands into a shell window and monitor the resulting output for errors
 
</b>
 
</b>
Line 31: Line 38:
 
=== Prepare Device ===
 
=== Prepare Device ===
 
<li> Disconnect power cable from device
 
<li> Disconnect power cable from device
 +
<li> Disconnect all USB devices (and keep them disconnected for the duration of this process)
 
<li> Move device switch to "on" position
 
<li> Move device switch to "on" position
 
<li> Attach device to network
 
<li> Attach device to network
Line 36: Line 44:
 
<li> Wait for device to finish booting (no blinking lights)
 
<li> Wait for device to finish booting (no blinking lights)
  
<li> Open device web interface (factory default address is [http://192.168.11.150 http://192.168.11.150], or use the IP address assigned by DHCP)
+
<li> Open device web interface (factory default address is [http://192.168.11.150 http://192.168.11.150], or use the IP address assigned by your network)
 
<li> Login (user = admin, password = password)
 
<li> Login (user = admin, password = password)
 
</li>
 
</li>
 +
 
{{Warning|<b>The next step will erase all data on your Linkstation Mini.  It is recommended that you backup your existing data. Proceed at your own risk.</b>}}
 
{{Warning|<b>The next step will erase all data on your Linkstation Mini.  It is recommended that you backup your existing data. Proceed at your own risk.</b>}}
 
<li> Remove existing RAID configuration (Disk Management | RAID Setup | RAID Array 1 | Change RAID Array ...)
 
<li> Remove existing RAID configuration (Disk Management | RAID Setup | RAID Array 1 | Change RAID Array ...)
 
<li> Create new RAID1 (mirroring) array (Disk Management | RAID Setup | RAID Array 1 | RAID Mode: RAID1 ...)
 
<li> Create new RAID1 (mirroring) array (Disk Management | RAID Setup | RAID Array 1 | RAID Mode: RAID1 ...)
 
<li> Wait for "Building RAID Array" to complete</li>
 
<li> Wait for "Building RAID Array" to complete</li>
'''You may proceed immediately after the array has been built (you do not need to wait for the drive check to complete)''''
+
'''You may proceed immediately after the array has been built (you do not need to wait for the drive check to complete)'''
  
 
<li> Boot Ubuntu 10.04 Desktop Edition CD-ROM on computer
 
<li> Boot Ubuntu 10.04 Desktop Edition CD-ROM on computer
Line 53: Line 62:
 
<pre>
 
<pre>
 
sudo bash
 
sudo bash
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Install OpenJDK (for running ACP Commander software)
 
<li> Install OpenJDK (for running ACP Commander software)
Line 59: Line 70:
 
  apt-get update
 
  apt-get update
 
  apt-get -q -y install openjdk-6-jre
 
  apt-get -q -y install openjdk-6-jre
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Download ACP Commander software (acp_commander.jar)
 
<li> Download ACP Commander software (acp_commander.jar)
 
<pre>
 
<pre>
  wget http://downloads.nas-central.org/TOOLS/ALL_LS_KB_ARM9/ACP_COMMANDER/acp_commander.jar
+
  wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/acp_commander.jar
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Determine IP address of device and assign it to environment variable (substitute appropriate IP address)
 
<li> Determine IP address of device and assign it to environment variable (substitute appropriate IP address)
 
<pre>
 
<pre>
  export IP_ADDRESS=192.168.11.150
+
  IP_ADDRESS=192.168.11.150
 +
 
 
</pre>  
 
</pre>  
 +
</li>
  
 
<li> Instruct device to enable Telnet and remove root password
 
<li> Instruct device to enable Telnet and remove root password
 
<pre>
 
<pre>
 
  java -jar acp_commander.jar -t ${IP_ADDRESS} -o
 
  java -jar acp_commander.jar -t ${IP_ADDRESS} -o
 +
 
</pre>  
 
</pre>  
 +
</li>
  
 
<li> Establish Telnet session with device
 
<li> Establish Telnet session with device
 
<pre>
 
<pre>
 
  telnet ${IP_ADDRESS}
 
  telnet ${IP_ADDRESS}
 +
 
</pre>  
 
</pre>  
 +
</li>
  
 
<li> Login as root (no password required)
 
<li> Login as root (no password required)
Line 85: Line 106:
 
<li> Set recent date and time (prevent error messages about file dates, format=MMDDhhnnYYYY)
 
<li> Set recent date and time (prevent error messages about file dates, format=MMDDhhnnYYYY)
 
<pre>
 
<pre>
  date 071720032010
+
  date 050900002011
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Kill all unnecessary processes
 
<li> Kill all unnecessary processes
 
<pre>
 
<pre>
 
  kill -9 $(ps | grep -vE '\[.*\]|(init)|(syslogd)|(klogd)|(getty)|(telnetd)|(-sh)|(ps)|(VmSize)|(grep)|(kill)|(awk)' | awk '{print $1}')
 
  kill -9 $(ps | grep -vE '\[.*\]|(init)|(syslogd)|(klogd)|(getty)|(telnetd)|(-sh)|(ps)|(VmSize)|(grep)|(kill)|(awk)' | awk '{print $1}')
 +
 +
</pre>
 +
</li>
 +
 +
<li> Disable all active swap paritions
 +
<pre>
 +
swapoff -a
 +
 
</pre>
 
</pre>
 
</li>
 
</li>
  
{{Warning|<b>Your device will no longer boot after the next step.  You must complete the installation of the Debian system before your device will boot again.</b>}}
+
{{Warning|<b>Your device will no longer boot after the next step.  You must complete the installation of the Debian operating system before your device will boot again.</b>}}
 
<li> Free secondary drive (/dev/sdb) partitions from RAID configuration
 
<li> Free secondary drive (/dev/sdb) partitions from RAID configuration
 
<pre>
 
<pre>
Line 106: Line 137:
 
  mdadm --manage /dev/md10 --remove /dev/sdb5
 
  mdadm --manage /dev/md10 --remove /dev/sdb5
 
  mdadm --manage /dev/md2  --remove /dev/sdb6
 
  mdadm --manage /dev/md2  --remove /dev/sdb6
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Make sure secondary drive is not in use
 
<li> Make sure secondary drive is not in use
 
<pre>
 
<pre>
 
  if hdparm -z /dev/sdb ; then echo; echo "SECONDARY DRIVE READY (/dev/sdb)"; echo; else grep sdb /proc/mounts /proc/mdstat; echo "Please check that /dev/sdb is not in use"; fi;
 
  if hdparm -z /dev/sdb ; then echo; echo "SECONDARY DRIVE READY (/dev/sdb)"; echo; else grep sdb /proc/mounts /proc/mdstat; echo "Please check that /dev/sdb is not in use"; fi;
</pre>
+
 
 +
</pre>  
 
</li>
 
</li>
  
Line 154: Line 188:
 
  PARTITION3_SIZE=12GB
 
  PARTITION3_SIZE=12GB
 
  echo -e "d\n1\nd\n2\nd\n3\nd\n4\nn\np\n1\n\n+${PARTITION1_SIZE}\nn\np\n2\n\n+${PARTITION2_SIZE}\nn\np\n3\n\n+${PARTITION3_SIZE}\nn\np\n\n\nt\n1\nfd\nt\n2\n82\nt\n3\nfd\nt\n4\nfd\nw\n" | fdisk /dev/sdb
 
  echo -e "d\n1\nd\n2\nd\n3\nd\n4\nn\np\n1\n\n+${PARTITION1_SIZE}\nn\np\n2\n\n+${PARTITION2_SIZE}\nn\np\n3\n\n+${PARTITION3_SIZE}\nn\np\n\n\nt\n1\nfd\nt\n2\n82\nt\n3\nfd\nt\n4\nfd\nw\n" | fdisk /dev/sdb
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Create and activate swap partition
 
<li> Create and activate swap partition
Line 160: Line 196:
 
  mkswap /dev/sdb2
 
  mkswap /dev/sdb2
 
  swapon /dev/sdb2
 
  swapon /dev/sdb2
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Create RAID volumes
 
<li> Create RAID volumes
Line 166: Line 204:
 
  echo "y" | mdadm --create --verbose /dev/md11 --level=1 --raid-devices=2 missing /dev/sdb1
 
  echo "y" | mdadm --create --verbose /dev/md11 --level=1 --raid-devices=2 missing /dev/sdb1
 
  echo "y" | mdadm --create --verbose /dev/md13 --level=1 --raid-devices=2 missing /dev/sdb3
 
  echo "y" | mdadm --create --verbose /dev/md13 --level=1 --raid-devices=2 missing /dev/sdb3
echo "y" | mdadm --create --verbose /dev/md14 --level=1 --raid-devices=2 missing /dev/sdb4
+
 
</pre>
+
</pre>
 +
</li>
  
 
<li> Format RAID volumes
 
<li> Format RAID volumes
Line 173: Line 212:
 
  mkfs.ext3 -F /dev/md11
 
  mkfs.ext3 -F /dev/md11
 
  mkfs.ext3 -F /dev/md13
 
  mkfs.ext3 -F /dev/md13
mkfs.ext3 -F /dev/md14
+
 
</pre>
+
</pre>  
 +
</li>
 +
 
 +
 
 +
=== Install Debian System ===
  
 
<li> Mount RAID volumes
 
<li> Mount RAID volumes
Line 182: Line 225:
 
  mkdir -p                /mnt/lsmini/boot
 
  mkdir -p                /mnt/lsmini/boot
 
  mount -t ext3 /dev/md11 /mnt/lsmini/boot
 
  mount -t ext3 /dev/md11 /mnt/lsmini/boot
mkdir -p                /mnt/lsmini/srv
 
mount -t ext3 /dev/md14 /mnt/lsmini/srv
 
</pre>
 
  
=== Install Debian System ===
+
</pre>
 +
</li>
  
<li> Install root filesystem (from archive of debootstrap stage 2 files)
+
<li> Install custom boot loader (force boot from /dev/md13)
 
<pre>
 
<pre>
 
  cd /mnt/lsmini
 
  cd /mnt/lsmini
  wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/debian/5.0/bootstrap-debian-5.0.5-armel-stage2.tar.gz
+
  wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/initrd-md13-armv5tejl-softfloat-1.0.tar.gz
  tar --extract --verbose --same-permissions --gzip --file /mnt/lsmini/bootstrap-debian-5.0.5-armel-stage2.tar.gz
+
  tar --extract --verbose --same-permissions --gzip --file /mnt/lsmini/initrd-md13-armv5tejl-softfloat-1.0.tar.gz
</pre>
+
  
<li> Install custom kernel (Debian 5.0 backported kernel 2.6.32-15)
+
</pre>
 +
</li>
 +
 
 +
<li> Install custom kernel (Debian 5.0 backported kernel 2.6.32-27)
 
<pre>
 
<pre>
 
  cd /mnt/lsmini
 
  cd /mnt/lsmini
  wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/debian/5.0/kernel-2.6.32-15-debian-lsmini.tar.gz
+
  wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/debian/5.0/kernel-2.6.32-27-debian-lsmini.tar.gz
  tar --extract --verbose --same-permissions --gzip --file kernel-2.6.32-15-debian-lsmini.tar.gz
+
  tar --extract --verbose --same-permissions --gzip --file kernel-2.6.32-27-debian-lsmini.tar.gz
</pre>
+
  
<li> Install custom boot loader (force boot from /dev/md13)
+
</pre>
 +
</li>
 +
 
 +
<li> Install root filesystem (from archive of debootstrap stage 2 files)
 
<pre>
 
<pre>
 
  cd /mnt/lsmini
 
  cd /mnt/lsmini
  wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/initrd-md13-armv5tejl-softfloat-1.0.tar.gz
+
  wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/debian/5.0/bootstrap-debian-5.0.6-armel-stage2.tar.gz
  tar --extract --verbose --same-permissions --gzip --file /mnt/lsmini/initrd-md13-armv5tejl-softfloat-1.0.tar.gz
+
  tar --extract --verbose --same-permissions --gzip --file /mnt/lsmini/bootstrap-debian-5.0.6-armel-stage2.tar.gz
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Prepare host settings (adjust host name and IP addresses as needed)
 
<li> Prepare host settings (adjust host name and IP addresses as needed)
 
<pre>
 
<pre>
  export HOST_NAME=lsmini
+
  HOST_NAME=lsmini
  export HOST_ADDRESS=192.168.1.77
+
  HOST_ADDRESS=192.168.1.77
  export HOST_NETMASK=255.255.0.0
+
  HOST_NETMASK=255.255.255.0
  export HOST_GATEWAY=192.168.1.1
+
  HOST_GATEWAY=192.168.1.1
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Configure network interface (/etc/network/interfaces)
 
<li> Configure network interface (/etc/network/interfaces)
Line 228: Line 277:
 
  echo " netmask ${HOST_NETMASK}" >>/mnt/lsmini/etc/network/interfaces
 
  echo " netmask ${HOST_NETMASK}" >>/mnt/lsmini/etc/network/interfaces
 
  echo " gateway ${HOST_GATEWAY}" >>/mnt/lsmini/etc/network/interfaces
 
  echo " gateway ${HOST_GATEWAY}" >>/mnt/lsmini/etc/network/interfaces
</pre>
+
rm -f /mnt/lsmini/etc/udev/rules.d/[0-9]*-persistent-net.rules  # remove all persistent network devices (force auto detection of eth0)
 +
 
 +
</pre>
 +
</li>
  
 
<li> Configure host name (/etc/hostname)
 
<li> Configure host name (/etc/hostname)
 
<pre>
 
<pre>
 
  echo "${HOST_NAME}" >/mnt/lsmini/etc/hostname
 
  echo "${HOST_NAME}" >/mnt/lsmini/etc/hostname
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Configure mapping from address to host name (/etc/hosts)
 
<li> Configure mapping from address to host name (/etc/hosts)
Line 239: Line 293:
 
  echo "127.0.0.1 localhost"          >/mnt/lsmini/etc/hosts
 
  echo "127.0.0.1 localhost"          >/mnt/lsmini/etc/hosts
 
  echo "${HOST_ADDRESS} ${HOST_NAME}" >>/mnt/lsmini/etc/hosts
 
  echo "${HOST_ADDRESS} ${HOST_NAME}" >>/mnt/lsmini/etc/hosts
</pre>
 
  
 +
</pre>
 +
</li>
 +
 +
{{Warning|<b>Do not modify the last column of /etc/fstab... any value other than zero will cause the device to hang on startup.  Basically, the system fails to detect the RAID volumes, sends the failure message to the console, waits for keyboard input (that can never arrive), and cannot respond to pings or any other network traffic.  Don't find out the hard way.</b>}}
 
<li> Configure mount points (/etc/fstab)
 
<li> Configure mount points (/etc/fstab)
'''WARNING: Do not modify the last column... any value other than zero will cause the device to hang (at the console) on disk errors.  Don't find out the hard way.'''
 
 
<pre>
 
<pre>
 
  echo "/dev/sdb2  none      swap  sw,pri=1                    0  0"  >/mnt/lsmini/etc/fstab
 
  echo "/dev/sdb2  none      swap  sw,pri=1                    0  0"  >/mnt/lsmini/etc/fstab
  echo "/dev/md13  /        ext3  noatime,errors=remount-ro    0  0" >>/mnt/lsmini/etc/fstab
+
  echo "/dev/md13  /        ext3  noatime                     0  0" >>/mnt/lsmini/etc/fstab
  echo "/dev/md11  /boot    ext3  noatime,errors=remount-ro    0  0" >>/mnt/lsmini/etc/fstab
+
  echo "/dev/md11  /boot    ext3  noatime                     0  0" >>/mnt/lsmini/etc/fstab
  echo "/dev/md14  /srv      ext3  noatime,errors=remount-ro    0  0" >>/mnt/lsmini/etc/fstab
+
  echo "none        /dev/shm  tmpfs  noatime,nodev,nosuid,noexec  0  0" >>/mnt/lsmini/etc/fstab
echo "shm        /dev/shm  tmpfs  noatime,nodev,nosuid,noexec  0  0" >>/mnt/lsmini/etc/fstab
+
 
</pre>
+
</pre>
 +
</li>
  
 
<li> Configure network name resolution (/etc/resolv.conf)
 
<li> Configure network name resolution (/etc/resolv.conf)
 
<pre>
 
<pre>
 
  cp -a /etc/resolv.conf /mnt/lsmini/etc/resolv.conf
 
  cp -a /etc/resolv.conf /mnt/lsmini/etc/resolv.conf
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Change root password (new password = lsmini)
 
<li> Change root password (new password = lsmini)
 
<pre>
 
<pre>
  export SED_FILE='/mnt/lsmini/etc/shadow'
+
  SED_FILE='/mnt/lsmini/etc/shadow'
  export SED_SEARCH='^\s*root\:\*?\:'
+
  SED_SEARCH='^\s*root\:\*?\:'
  export SED_REPLACE='root:$6$bmlbpJYn$xAgZr6KxoRLjDcPZNDBcnMF52gZrU7xkib43LhSlAvzVS4OqmiHaxB0GInPtoaPQ2FguHQQuxM95cMfvUnYn31:'
+
  SED_REPLACE='root:$6$bmlbpJYn$xAgZr6KxoRLjDcPZNDBcnMF52gZrU7xkib43LhSlAvzVS4OqmiHaxB0GInPtoaPQ2FguHQQuxM95cMfvUnYn31:'
 
  sed -r "s/${SED_SEARCH}/${SED_REPLACE}/" -i ${SED_FILE}
 
  sed -r "s/${SED_SEARCH}/${SED_REPLACE}/" -i ${SED_FILE}
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Prepare for reboot (Overwrite factory-installed boot files with custom ones)
 
<li> Prepare for reboot (Overwrite factory-installed boot files with custom ones)
Line 269: Line 330:
 
  rm -rf /boot/*
 
  rm -rf /boot/*
 
  cp -a /mnt/lsmini/boot/* /boot/
 
  cp -a /mnt/lsmini/boot/* /boot/
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Wait for RAID synchronization to complete
 
<li> Wait for RAID synchronization to complete
Line 281: Line 344:
 
  cat /proc/mdstat
 
  cat /proc/mdstat
 
  sync
 
  sync
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Unmount RAID volumes
 
<li> Unmount RAID volumes
Line 288: Line 353:
 
  cd /mnt
 
  cd /mnt
 
  umount /mnt/lsmini/boot
 
  umount /mnt/lsmini/boot
umount /mnt/lsmini/srv
 
 
  umount /mnt/lsmini
 
  umount /mnt/lsmini
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Reboot device
 
<li> Reboot device
 
<pre>
 
<pre>
  reboot; logout
+
  sync; reboot; logout
</pre>
+
 
 +
</pre>  
 +
</li>
 +
 
  
 
=== Configure Debian System ===
 
=== Configure Debian System ===
Line 303: Line 372:
 
<li> Assign new IP address to environment variable
 
<li> Assign new IP address to environment variable
 
<pre>
 
<pre>
  export IP_ADDRESS=192.168.1.77
+
  IP_ADDRESS=192.168.1.77
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Use SSH to login as root (password = lsmini)
 
<li> Use SSH to login as root (password = lsmini)
 
<pre>
 
<pre>
 
  ssh root@${IP_ADDRESS}
 
  ssh root@${IP_ADDRESS}
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Change root password to something hard to guess
 
<li> Change root password to something hard to guess
 
<pre>
 
<pre>
 
  passwd root
 
  passwd root
</pre>
 
  
<li> Configure package sources (/etc/apt/sources.list)
+
</pre>  
<pre>
+
</li>
echo "deb    http://ftp.debian.org      lenny        main contrib"  >/etc/apt/sources.list
+
echo "deb-src http://ftp.debian.org      lenny        main contrib" >>/etc/apt/sources.list
+
echo "deb    http://security.debian.org lenny/updates main contrib" >>/etc/apt/sources.list
+
echo "deb-src http://security.debian.org lenny/updates main contrib" >>/etc/apt/sources.list
+
</pre>
+
 
+
<li> Update package lists
+
<pre>
+
apt-get update
+
</pre>
+
  
 
<li> Select timezone
 
<li> Select timezone
 
<pre>
 
<pre>
 
  dpkg-reconfigure tzdata
 
  dpkg-reconfigure tzdata
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Ensure that date and time are correct
 
<li> Ensure that date and time are correct
 
<pre>
 
<pre>
 
  date
 
  date
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Make sure primary drive is not in use (/dev/sda)
 
<li> Make sure primary drive is not in use (/dev/sda)
 
<pre>
 
<pre>
 
  if hdparm -z /dev/sda ; then echo; echo "PRIMARY DRIVE READY (/dev/sda)"; echo; else grep sda /proc/mounts /proc/mdstat; echo "Please check that /dev/sda is not in use"; fi;
 
  if hdparm -z /dev/sda ; then echo; echo "PRIMARY DRIVE READY (/dev/sda)"; echo; else grep sda /proc/mounts /proc/mdstat; echo "Please check that /dev/sda is not in use"; fi;
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Repartition primary drive ('''must have same partition sizes as secondary drive''')
 
<li> Repartition primary drive ('''must have same partition sizes as secondary drive''')
Line 350: Line 418:
 
  PARTITION3_SIZE=12GB
 
  PARTITION3_SIZE=12GB
 
  echo -e "d\n1\nd\n2\nd\n3\nd\n4\nn\np\n1\n\n+${PARTITION1_SIZE}\nn\np\n2\n\n+${PARTITION2_SIZE}\nn\np\n3\n\n+${PARTITION3_SIZE}\nn\np\n\n\nt\n1\nfd\nt\n2\n82\nt\n3\nfd\nt\n4\nfd\nw\n" | fdisk /dev/sda
 
  echo -e "d\n1\nd\n2\nd\n3\nd\n4\nn\np\n1\n\n+${PARTITION1_SIZE}\nn\np\n2\n\n+${PARTITION2_SIZE}\nn\np\n3\n\n+${PARTITION3_SIZE}\nn\np\n\n\nt\n1\nfd\nt\n2\n82\nt\n3\nfd\nt\n4\nfd\nw\n" | fdisk /dev/sda
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Format and activate swap partition on primary drive
 
<li> Format and activate swap partition on primary drive
Line 356: Line 426:
 
  mkswap /dev/sda2
 
  mkswap /dev/sda2
 
  swapon /dev/sda2
 
  swapon /dev/sda2
</pre>
 
  
<li> Automatically mount swap partition at boot
+
</pre>
 +
</li>
 +
 
 +
<li> Automatically mount swap partition during boot
 
<pre>
 
<pre>
 
  echo  "/dev/sda2  none      swap  sw,pri=2                    0  0"  >>/etc/fstab
 
  echo  "/dev/sda2  none      swap  sw,pri=2                    0  0"  >>/etc/fstab
</pre>
 
  
<li> Add primary drive partitions to RAID volumes (/dev/md11, /dev/md13, and /dev/md14)
+
</pre>
 +
</li>
 +
 
 +
<li> Add primary drive partitions to RAID volumes (/dev/md11 and /dev/md13)
 
<pre>
 
<pre>
 
  echo "y" | mdadm --manage /dev/md11 --add /dev/sda1
 
  echo "y" | mdadm --manage /dev/md11 --add /dev/sda1
 
  echo "y" | mdadm --manage /dev/md13 --add /dev/sda3
 
  echo "y" | mdadm --manage /dev/md13 --add /dev/sda3
  echo "y" | mdadm --manage /dev/md14 --add /dev/sda4
+
 
 +
</pre>
 +
</li>
 +
 
 +
<li> Create large RAID volume on /dev/md14 (substitute RAID level as desired; 1=Mirroring, 0=Striping)
 +
<pre>
 +
RAID_LEVEL=1
 +
  echo "y" | mdadm --create --verbose /dev/md14 --level=${RAID_LEVEL} --raid-devices=2 /dev/sda4 /dev/sdb4
 +
 
 
</pre>
 
</pre>
 +
</li>
  
<li> Add user (never login as root again, use sudo command instead)
+
<li> Format large RAID volume and mount it (as /srv)
 
<pre>
 
<pre>
  export USER_NAME=visitor
+
  mkfs.ext3 -F /dev/md14
  adduser ${USER_NAME}
+
  mount -t ext3 /dev/md14 /srv
 +
 
 
</pre>
 
</pre>
 +
</li>
  
<li> Allow user to become super user (using sudo command)
+
<li> Automatically mount large RAID volume during boot (as /srv)
 
<pre>
 
<pre>
  echo "${USER_NAME}    ALL=(ALL) ALL" >>/etc/sudoers
+
  echo "/dev/md14  /srv      ext3  noatime                      0  0" >>/etc/fstab
 +
 
 
</pre>
 
</pre>
 +
</li>
 +
 +
<li> Clean up mdadm.conf (allow detection of all RAID volumes during boot)
 +
<pre>
 +
SED_FILE='/etc/mdadm/mdadm.conf'
 +
SED_SEARCH='^\s*ARRAY\s+.*$'
 +
SED_REPLACE=''
 +
sed -r "s/${SED_SEARCH}/${SED_REPLACE}/" -i ${SED_FILE}
 +
mdadm --quiet --detail --scan >>/etc/mdadm/mdadm.conf
 +
 +
</pre>
 +
</li>
 +
 +
<li> Disable login terminals (prevent error messages in /var/log/syslog every 5 minutes about /sbin/getty respawning too fast)
 +
<pre>
 +
SED_FILE='/etc/inittab'
 +
SED_SEARCH='(^\s*[0-9]+\:[0-9]+\:respawn\:\/sbin\/getty\s+[0-9]+\s+tty[0-9]+\s*$)'
 +
SED_REPLACE='#\1'
 +
sed -r "s~${SED_SEARCH}~${SED_REPLACE}~g" -i ${SED_FILE}
 +
 +
</pre>
 +
</li>
 +
 +
<li> Allow USB flash drives formatted with the VFAT file system (Windows) to be mounted automatically in /media/usb
 +
<pre>
 +
SED_FILE='/etc/usbmount/usbmount.conf'
 +
SED_SEARCH='^(\s*FILESYSTEMS\s*=\s*\")(.*)(\"\s*)$'
 +
SED_REPLACE='\1\2 vfat\3'
 +
if ! grep -E '^\s*FILESYSTEMS\s*=\s*\"((vfat\s+[^\"]*)|([^\"]*\s+vfat\s+[^\"]*)|([^\"]*\s+vfat))\"$' "${SED_FILE}"; then sed -r "s~${SED_SEARCH}~${SED_REPLACE}~g" -i ${SED_FILE}; fi
 +
 +
</pre>
 +
</li>
 +
 +
<li> Configure package sources (/etc/apt/sources.list)
 +
<pre>
 +
echo "deb    http://ftp.debian.org      lenny        main contrib"  >/etc/apt/sources.list
 +
echo "deb-src http://ftp.debian.org      lenny        main contrib" >>/etc/apt/sources.list
 +
echo "deb    http://security.debian.org lenny/updates main contrib" >>/etc/apt/sources.list
 +
echo "deb-src http://security.debian.org lenny/updates main contrib" >>/etc/apt/sources.list
 +
 +
</pre>
 +
</li>
 +
 +
<li> Update package lists
 +
<pre>
 +
apt-get update
 +
 +
</pre>
 +
</li>
  
 
<li> Wait for RAID synchronization to complete
 
<li> Wait for RAID synchronization to complete
Line 391: Line 526:
 
  cat /proc/mdstat
 
  cat /proc/mdstat
 
  sync
 
  sync
</pre>
+
 
 +
</pre>
 +
</li>
  
 
<li> Restart device
 
<li> Restart device
 
<pre>
 
<pre>
  reboot; logout;
+
  sync; reboot; logout
</pre>
+
 
 +
</pre>
 +
</li>
  
 
'''Congratulations!  You should now have a working Debian 5.0 server running on a Buffalo Linkstation Mini.'''
 
'''Congratulations!  You should now have a working Debian 5.0 server running on a Buffalo Linkstation Mini.'''
 +
 +
 +
=== Extras ===
 +
 +
<li> Add user (never login as root again, use sudo command instead)
 +
<pre>
 +
USER_NAME=visitor
 +
adduser ${USER_NAME}
 +
 +
</pre>
 +
</li>
 +
 +
<li> Allow user to become super user (using sudo command)
 +
<pre>
 +
echo "${USER_NAME}    ALL=(ALL) ALL" >>/etc/sudoers
 +
 +
</pre>
 +
</li>
 +
 
</ol>
 
</ol>
 +
  
 
== See Also ==
 
== See Also ==
 +
* [[Install_Debian_6.0_(Squeeze)_On_Buffalo_Linkstation_Mini|Install Debian 6.0 On Linkstation Mini]]
 
* [[Revert Buffalo Linkstation Mini To Stock Firmware]]
 
* [[Revert Buffalo Linkstation Mini To Stock Firmware]]
* [[LS_Mini:_Install_Ubuntu|Install Ubuntu 9.04 On Linkstation Mini]]
+
* [[Install_Ubuntu_9.04_(Jaunty_Jackalope)_On_Buffalo_Linkstation_Mini|Install Ubuntu 9.04 On Linkstation Mini]]
 
* [[LS_Mini:_Install_Gentoo|Install Gentoo On Linkstation Mini]]
 
* [[LS_Mini:_Install_Gentoo|Install Gentoo On Linkstation Mini]]
 
* [[GenLink for ARM9]]
 
* [[GenLink for ARM9]]

Latest revision as of 17:45, 30 May 2011


Kurobrick.png
WARNING!

There is a possibility that you could brick your NAS with these instructions. Please make sure that you read the entire page carefully. These instructions may void your warranty. Proceed at your own risk.



Linkstation Mini

Contents


Nuvola apps important.png 
WARNING!

This procedure is for installing an older release of Debian.



Overview

The following process converts a Buffalo Linkstation Mini (model LS-WSxxxxGL/R1) into a fully functional GNU/Linux server running Debian version 5.0.6 (Lenny) with the backported Linux kernel (version 2.6.32-27). No disassembly required. Both RAID1 (Mirroring) and RAID0 (Striping) configurations are supported. Here is how the process works:

  1. Use ACP Commander software to establish Telnet session with device
  2. Uncouple secondary drive partitions from existing RAID configuration
  3. Partition and format secondary drive, install Debian 5.0, and prepare for initial boot
  4. Reboot device, establish SSH session with device, and complete installation


Requirements

  1. Buffalo LinkStation Mini models LS-WSxxxxGL/R1 running stock firmware (LS-WSXxxxxTL/R1 models will not work)
    • If your device has already been modified to run another operating system and/or firmware, you should revert to stock firmware
    • This process was tested with model LS-WS1.0TGL/R1, but other models may work as well
  2. Ubuntu 10.04 Desktop Edition CD-ROM (download and burn this disc image)
  3. Computer which can boot the Ubuntu 10.04 Desktop Edition CD-ROM and access the network successfully (most modern computers meet this requirement)


Instructions

Note: Do not attempt to execute the following commands as a single script. Instead, copy and paste each block of commands into a shell window and monitor the resulting output for errors

    Prepare Device

  1. Disconnect power cable from device
  2. Disconnect all USB devices (and keep them disconnected for the duration of this process)
  3. Move device switch to "on" position
  4. Attach device to network
  5. Connect power cable to device
  6. Wait for device to finish booting (no blinking lights)
  7. Open device web interface (factory default address is http://192.168.11.150, or use the IP address assigned by your network)
  8. Login (user = admin, password = password)
  9. Nuvola apps important.png 
    WARNING!

    The next step will erase all data on your Linkstation Mini. It is recommended that you backup your existing data. Proceed at your own risk.


  10. Remove existing RAID configuration (Disk Management | RAID Setup | RAID Array 1 | Change RAID Array ...)
  11. Create new RAID1 (mirroring) array (Disk Management | RAID Setup | RAID Array 1 | RAID Mode: RAID1 ...)
  12. Wait for "Building RAID Array" to complete
  13. You may proceed immediately after the array has been built (you do not need to wait for the drive check to complete)

  14. Boot Ubuntu 10.04 Desktop Edition CD-ROM on computer
  15. Select language as desired (English)
  16. Click on "Try Ubuntu 10.04 LTS" (to use Ubuntu without making any changes to your system)
  17. Open a new terminal window (Applications | Accessories | Terminal )
  18. Start a new bash shell with root privileges
    sudo bash
    
    
  19. Install OpenJDK (for running ACP Commander software)
     apt-get update
     apt-get -q -y install openjdk-6-jre
    
    
  20. Download ACP Commander software (acp_commander.jar)
     wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/acp_commander.jar
    
    
  21. Determine IP address of device and assign it to environment variable (substitute appropriate IP address)
     IP_ADDRESS=192.168.11.150
    
    
  22. Instruct device to enable Telnet and remove root password
     java -jar acp_commander.jar -t ${IP_ADDRESS} -o
    
    
  23. Establish Telnet session with device
     telnet ${IP_ADDRESS}
    
    
  24. Login as root (no password required)
  25. Set recent date and time (prevent error messages about file dates, format=MMDDhhnnYYYY)
     date 050900002011
    
    
  26. Kill all unnecessary processes
     kill -9 $(ps | grep -vE '\[.*\]|(init)|(syslogd)|(klogd)|(getty)|(telnetd)|(-sh)|(ps)|(VmSize)|(grep)|(kill)|(awk)' | awk '{print $1}')
    
    
  27. Disable all active swap paritions
    swapoff -a
    
    
  28. Nuvola apps important.png 
    WARNING!

    Your device will no longer boot after the next step. You must complete the installation of the Debian operating system before your device will boot again.


  29. Free secondary drive (/dev/sdb) partitions from RAID configuration
     mdadm --manage /dev/md0  --fail /dev/sdb1
     mdadm --manage /dev/md1  --fail /dev/sdb2
     mdadm --manage /dev/md10 --fail /dev/sdb5
     mdadm --manage /dev/md2  --fail /dev/sdb6
    
     mdadm --manage /dev/md0  --remove /dev/sdb1
     mdadm --manage /dev/md1  --remove /dev/sdb2
     mdadm --manage /dev/md10 --remove /dev/sdb5
     mdadm --manage /dev/md2  --remove /dev/sdb6
    
    
  30. Make sure secondary drive is not in use
     if hdparm -z /dev/sdb ; then echo; echo "SECONDARY DRIVE READY (/dev/sdb)"; echo; else grep sdb /proc/mounts /proc/mdstat; echo "Please check that /dev/sdb is not in use"; fi;
    
    
  31. The following commands will delete all existing partitions on the secondary drive and reconfigure it as follows...

    Partition Mount Size Type Description
    1 /boot 128MB fd linux raid autodetect
    2 swap 256MB 82 linux swap
    3 / (root) 12GB fd linux raid autodetect
    4 /srv 100% fd linux raid autodetect
  32. Repartition secondary drive (substitute partition sizes as desired)
     PARTITION1_SIZE=128MB
     PARTITION2_SIZE=256MB
     PARTITION3_SIZE=12GB
     echo -e "d\n1\nd\n2\nd\n3\nd\n4\nn\np\n1\n\n+${PARTITION1_SIZE}\nn\np\n2\n\n+${PARTITION2_SIZE}\nn\np\n3\n\n+${PARTITION3_SIZE}\nn\np\n\n\nt\n1\nfd\nt\n2\n82\nt\n3\nfd\nt\n4\nfd\nw\n" | fdisk /dev/sdb
    
    
  33. Create and activate swap partition
     mkswap /dev/sdb2
     swapon /dev/sdb2
    
    
  34. Create RAID volumes
     echo "y" | mdadm --create --verbose /dev/md11 --level=1 --raid-devices=2 missing /dev/sdb1
     echo "y" | mdadm --create --verbose /dev/md13 --level=1 --raid-devices=2 missing /dev/sdb3
    
    
  35. Format RAID volumes
     mkfs.ext3 -F /dev/md11
     mkfs.ext3 -F /dev/md13
    
    

  36. Install Debian System

  37. Mount RAID volumes
     mkdir -p                /mnt/lsmini
     mount -t ext3 /dev/md13 /mnt/lsmini
     mkdir -p                /mnt/lsmini/boot
     mount -t ext3 /dev/md11 /mnt/lsmini/boot
    
    
  38. Install custom boot loader (force boot from /dev/md13)
     cd /mnt/lsmini
     wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/initrd-md13-armv5tejl-softfloat-1.0.tar.gz
     tar --extract --verbose --same-permissions --gzip --file /mnt/lsmini/initrd-md13-armv5tejl-softfloat-1.0.tar.gz
    
    
  39. Install custom kernel (Debian 5.0 backported kernel 2.6.32-27)
     cd /mnt/lsmini
     wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/debian/5.0/kernel-2.6.32-27-debian-lsmini.tar.gz
     tar --extract --verbose --same-permissions --gzip --file kernel-2.6.32-27-debian-lsmini.tar.gz
    
    
  40. Install root filesystem (from archive of debootstrap stage 2 files)
     cd /mnt/lsmini
     wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/debian/5.0/bootstrap-debian-5.0.6-armel-stage2.tar.gz
     tar --extract --verbose --same-permissions --gzip --file /mnt/lsmini/bootstrap-debian-5.0.6-armel-stage2.tar.gz
    
    
  41. Prepare host settings (adjust host name and IP addresses as needed)
     HOST_NAME=lsmini
     HOST_ADDRESS=192.168.1.77
     HOST_NETMASK=255.255.255.0
     HOST_GATEWAY=192.168.1.1
    
    
  42. Configure network interface (/etc/network/interfaces)
     echo "# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or"  >/mnt/lsmini/etc/network/interfaces
     echo "# /usr/share/doc/ifupdown/examples for more information."          >>/mnt/lsmini/etc/network/interfaces
     echo "#"                        >>/mnt/lsmini/etc/network/interfaces
     echo "auto lo eth0"             >>/mnt/lsmini/etc/network/interfaces
     echo "iface lo inet loopback"   >>/mnt/lsmini/etc/network/interfaces
     echo "iface eth0 inet static"   >>/mnt/lsmini/etc/network/interfaces
     echo " address ${HOST_ADDRESS}" >>/mnt/lsmini/etc/network/interfaces
     echo " netmask ${HOST_NETMASK}" >>/mnt/lsmini/etc/network/interfaces
     echo " gateway ${HOST_GATEWAY}" >>/mnt/lsmini/etc/network/interfaces
     rm -f /mnt/lsmini/etc/udev/rules.d/[0-9]*-persistent-net.rules  # remove all persistent network devices (force auto detection of eth0)
    
    
  43. Configure host name (/etc/hostname)
     echo "${HOST_NAME}" >/mnt/lsmini/etc/hostname
    
    
  44. Configure mapping from address to host name (/etc/hosts)
     echo "127.0.0.1 localhost"           >/mnt/lsmini/etc/hosts
     echo "${HOST_ADDRESS} ${HOST_NAME}" >>/mnt/lsmini/etc/hosts
    
    
  45. Nuvola apps important.png 
    WARNING!

    Do not modify the last column of /etc/fstab... any value other than zero will cause the device to hang on startup. Basically, the system fails to detect the RAID volumes, sends the failure message to the console, waits for keyboard input (that can never arrive), and cannot respond to pings or any other network traffic. Don't find out the hard way.


  46. Configure mount points (/etc/fstab)
     echo "/dev/sdb2   none      swap   sw,pri=1                     0  0"  >/mnt/lsmini/etc/fstab
     echo "/dev/md13   /         ext3   noatime                      0  0" >>/mnt/lsmini/etc/fstab
     echo "/dev/md11   /boot     ext3   noatime                      0  0" >>/mnt/lsmini/etc/fstab
     echo "none        /dev/shm  tmpfs  noatime,nodev,nosuid,noexec  0  0" >>/mnt/lsmini/etc/fstab
    
    
  47. Configure network name resolution (/etc/resolv.conf)
     cp -a /etc/resolv.conf /mnt/lsmini/etc/resolv.conf
    
    
  48. Change root password (new password = lsmini)
     SED_FILE='/mnt/lsmini/etc/shadow'
     SED_SEARCH='^\s*root\:\*?\:'
     SED_REPLACE='root:$6$bmlbpJYn$xAgZr6KxoRLjDcPZNDBcnMF52gZrU7xkib43LhSlAvzVS4OqmiHaxB0GInPtoaPQ2FguHQQuxM95cMfvUnYn31:'
     sed -r "s/${SED_SEARCH}/${SED_REPLACE}/" -i ${SED_FILE}
    
    
  49. Prepare for reboot (Overwrite factory-installed boot files with custom ones)
     cd /mnt/lsmini
     rm -rf /boot/*
     cp -a /mnt/lsmini/boot/* /boot/
    
    
  50. Wait for RAID synchronization to complete
     while egrep -iq '(recovery)|(resync)' /proc/mdstat; do
         clear
         cat /proc/mdstat
         sleep 5
     done
     clear
     cat /proc/mdstat
     sync
    
    
  51. Unmount RAID volumes
     sync
     cd /mnt
     umount /mnt/lsmini/boot
     umount /mnt/lsmini
    
    
  52. Reboot device
     sync; reboot; logout
    
    

  53. Configure Debian System

  54. Wait for device to finish booting (no blinking lights)
  55. Assign new IP address to environment variable
     IP_ADDRESS=192.168.1.77
    
    
  56. Use SSH to login as root (password = lsmini)
     ssh root@${IP_ADDRESS}
    
    
  57. Change root password to something hard to guess
     passwd root
    
    
  58. Select timezone
     dpkg-reconfigure tzdata
    
    
  59. Ensure that date and time are correct
     date
    
    
  60. Make sure primary drive is not in use (/dev/sda)
     if hdparm -z /dev/sda ; then echo; echo "PRIMARY DRIVE READY (/dev/sda)"; echo; else grep sda /proc/mounts /proc/mdstat; echo "Please check that /dev/sda is not in use"; fi;
    
    
  61. Repartition primary drive (must have same partition sizes as secondary drive)
     PARTITION1_SIZE=128MB
     PARTITION2_SIZE=256MB
     PARTITION3_SIZE=12GB
     echo -e "d\n1\nd\n2\nd\n3\nd\n4\nn\np\n1\n\n+${PARTITION1_SIZE}\nn\np\n2\n\n+${PARTITION2_SIZE}\nn\np\n3\n\n+${PARTITION3_SIZE}\nn\np\n\n\nt\n1\nfd\nt\n2\n82\nt\n3\nfd\nt\n4\nfd\nw\n" | fdisk /dev/sda
    
    
  62. Format and activate swap partition on primary drive
     mkswap /dev/sda2
     swapon /dev/sda2
    
    
  63. Automatically mount swap partition during boot
     echo  "/dev/sda2   none      swap   sw,pri=2                     0  0"  >>/etc/fstab
    
    
  64. Add primary drive partitions to RAID volumes (/dev/md11 and /dev/md13)
     echo "y" | mdadm --manage /dev/md11 --add /dev/sda1
     echo "y" | mdadm --manage /dev/md13 --add /dev/sda3
    
    
  65. Create large RAID volume on /dev/md14 (substitute RAID level as desired; 1=Mirroring, 0=Striping)
     RAID_LEVEL=1
     echo "y" | mdadm --create --verbose /dev/md14 --level=${RAID_LEVEL} --raid-devices=2 /dev/sda4 /dev/sdb4
    
    
  66. Format large RAID volume and mount it (as /srv)
     mkfs.ext3 -F /dev/md14
     mount -t ext3 /dev/md14 /srv
    
    
  67. Automatically mount large RAID volume during boot (as /srv)
     echo "/dev/md14   /srv      ext3   noatime                      0  0" >>/etc/fstab
    
    
  68. Clean up mdadm.conf (allow detection of all RAID volumes during boot)
     SED_FILE='/etc/mdadm/mdadm.conf'
     SED_SEARCH='^\s*ARRAY\s+.*$'
     SED_REPLACE=''
     sed -r "s/${SED_SEARCH}/${SED_REPLACE}/" -i ${SED_FILE}
     mdadm --quiet --detail --scan >>/etc/mdadm/mdadm.conf
    
    
  69. Disable login terminals (prevent error messages in /var/log/syslog every 5 minutes about /sbin/getty respawning too fast)
     SED_FILE='/etc/inittab'
     SED_SEARCH='(^\s*[0-9]+\:[0-9]+\:respawn\:\/sbin\/getty\s+[0-9]+\s+tty[0-9]+\s*$)'
     SED_REPLACE='#\1'
     sed -r "s~${SED_SEARCH}~${SED_REPLACE}~g" -i ${SED_FILE}
    
    
  70. Allow USB flash drives formatted with the VFAT file system (Windows) to be mounted automatically in /media/usb
     SED_FILE='/etc/usbmount/usbmount.conf'
     SED_SEARCH='^(\s*FILESYSTEMS\s*=\s*\")(.*)(\"\s*)$'
     SED_REPLACE='\1\2 vfat\3'
     if ! grep -E '^\s*FILESYSTEMS\s*=\s*\"((vfat\s+[^\"]*)|([^\"]*\s+vfat\s+[^\"]*)|([^\"]*\s+vfat))\"$' "${SED_FILE}"; then sed -r "s~${SED_SEARCH}~${SED_REPLACE}~g" -i ${SED_FILE}; fi
    
    
  71. Configure package sources (/etc/apt/sources.list)
     echo "deb     http://ftp.debian.org      lenny         main contrib"  >/etc/apt/sources.list
     echo "deb-src http://ftp.debian.org      lenny         main contrib" >>/etc/apt/sources.list
     echo "deb     http://security.debian.org lenny/updates main contrib" >>/etc/apt/sources.list
     echo "deb-src http://security.debian.org lenny/updates main contrib" >>/etc/apt/sources.list
    
    
  72. Update package lists
     apt-get update
    
    
  73. Wait for RAID synchronization to complete
     while egrep -iq '(recovery)|(resync)' /proc/mdstat; do
         clear
         cat /proc/mdstat
         sleep 5
     done
     clear
     cat /proc/mdstat
     sync
    
    
  74. Restart device
     sync; reboot; logout
    
    
  75. Congratulations! You should now have a working Debian 5.0 server running on a Buffalo Linkstation Mini.


    Extras

  76. Add user (never login as root again, use sudo command instead)
     USER_NAME=visitor
     adduser ${USER_NAME}
    
    
  77. Allow user to become super user (using sudo command)
     echo "${USER_NAME}    ALL=(ALL) ALL" >>/etc/sudoers
    
    


See Also


References