Debian linux installation - hdd booted

From NAS-2000.org

Jump to: navigation, search

Some people may find it useful to have an operating system on their NAS, which is independent from the firmware supplied by this site or RaidSonic. It is possible to install a fully working debian linux on the NAS, which boots directly from disk and behaves like a normal linux system without a graphical user interface.

I tried to do a step-by-step guide, but it's currently too complex. The following how-to is based on a prepared debian etch disk image, available at my site (the link is in the text) and an initrd-image which has to be replaced by a part of the original firmware. This disk image was built out of a debootstrap process with a lot of modifications. But at last - you can use it like a normal linux system, even with a complete build environment (apt-get install build-essential).

Please note, that modifying the flash contents and anything on the hdd can lead in unexpected results. Everything that follows should only be done by experts. If you cannot understand one single step I describe then forget about having Debian on your NAS.

I warned you.

Contents

[edit] What you need to have:

  • a RaidSonic NAS 1000 (NAS 2000 is untested!) with Firmware 2.x and above
  • every single flash image of the original firmware (don't blame me, if you are unable to restore the previous system)
  • a serial connection from NAS to your PC (you really need it!) and a little bit experience with terminal emulation programs (Hyper Terminal, minicom) (Be careful! It is not recommended by the author of this Howto to use this way!)
  • a functional network connection
  • a tftp server which has been set up
  • maybe an unused hard disk that you will use instead of your big hard disk, this will avoid that you loose any data
  • and at last - proper linux knowledge

[edit] (1) Create a partitioning schema and install the base image (use the hdd via usb mode):

  • /dev/hda1 as ext2/ext3 (whatever you like, ext3 cannot be used, when you like to spin down the hdd for energy saving reasons) and at least 200 mb (1,5 gb recommended)
  • /dev/hda2 as an extended partition, may fill the rest of the disk
  • /dev/hda5 as a logical ext2/ext3/xfs, leaving about 600 mb at the end of the disk
  • /dev/hda6 as a logical swap partition
  • do mkfs.ext2/mkfs.ext3 on the newly created primary partition
  • do tune2fs -i 0 on that partition (the nas hasn't got a battery powered real time clock, so fsck would run on every boot up)
  • do mkswap on the swap partition
  • check whether /sbin/restore is installed, if not, install dump
  • download the prepared debian image from

http://www.zis.tu-dresden.de/~felix.mellmann/debian-etch-arm-base-20071121-005-prep.dump.gz

  • mount the primary partition to /mnt
  • cd /mnt
  • restore that image: restore -rf >image-file<
  • in the folder initrd_image is a file initrd.gz, copy this to your tftp root directory
now you have a basic debian etch image on your nas hdd

[edit] (2) replacing the initrd-image in flash rom

  • set up the serial connection
  • start a terminal emulation program (19200,8,n,1)
  • power on the nas in network mode
  • as soon as the message appears telling you to press ^C, press CTRL+C
  • 2 and enter (List images)
  • 4 and enter (Create New Image) (I don't know if it's required to delete the images before uploading a new one)
  • Image Name: Ramdisk
  • Flash Address: 0x701A0000
  • Memory Address: 0x00800000
  • Entry Point: 0x00800000
  • An image named 'Ramdisk' exists - continue (y/n)? y
  • 2 and enter (Download by TFTP)
  • TFTP Server IP Address: <the address of your tftp server>
  • Image Path and name: <full path to the initrd.gz file>
  • Waiting to receive file ....
  • 1 and enter
now the debian system should boot up (hopefully)

[edit] (3) completing the installation

  • the root user has the password root (isn't that clever?!), so change the password
  • you should create new ssh-server host keys, delete them from /etc/ssh and do a dpkg-reconfigure openssh-server (this will take some more time ...)
  • create the filesystem for your data and activate it in /etc/fstab (don't forget to tune2fs -i 0 on that partition)
  • edit /etc/samba/smb.conf to your needs, edit /etc/exports
  • add your users
  • may be change the locale from de_DE to your language ...
  • apt install ntpdate (... don't ask, I thought it has been bootstrapped, but it's missing, the NAS need to have a ntp time source, because it doesn't has a clock by its own)
  • "apt install" whatever you want
  • hmm, ask if you have any further questions

[edit] (4) installing the power button daemon

The power button of the NAS triggers an event, and sends a notification to the OS, thus letting it shut down. Unfortunately, this notification is not processed in Debian. After approx. 30 seconds, the internal hardware shuts itself off automatically, regardless whether the OS was cleanly shut down or not (in case the OS crashed) - possibly leading to data corruption!

In order to use the power button properly, you'll have to install the power daemon:

  • Log into your NAS as root via SSH.
  • Download the daemon.
wget http://sousuke.dyndns.org/NAS/nas2000-event_1.0.tar.bz2
  • Extract the files on your NAS.
tar -xjf nas2000-event_1.0.tar.bz2
  • Change into the extracted directory.
cd nas2000-event_1.0
  • Run installer script.
./install
  • And you're all set!

Run ./uninstall to uninstall the daemon. Read the included README file for information on compiling and/or customizing!

[edit] (5) missing things

  • installer (... nice joke ...)
  • the sources of the modified /sbin/init (the current image includes the sysvinit version of debian sarge, I think rewriting the patch for etch would be appreciated)

[edit] (6) Other related NAS

I used the above explanation and files practically without any change on a Smartdisk SOHO NAS (for a while also sold by Verbatim) - a not documented device which uses more or less identical vendor firmware and is technically extremely similar. The only minor (but crucial) deviation was a different Ramdisk location in flash - instead of 0x701A0000 my ramdisk is located at 0x701C0000. The remainder is identical. I did not choose to install a serial port but logged in via network into redboot. This worked fine. I was aware of the risks, but had decided that my soldering skills are unlikely to be up to scratch.

[edit] (7) News

There will be no Debian Lenny Image unless someone is able to build a more recent kernel for this hardware. Lenny refuses to bootstrap on the NAS complaining about the old kernel.

-> There seems to be a way to do the installation without using a serial connection. Do the steps written above. Let your NAS boot the Debian (takes some time), remove the RSA key from previous installations (~/.ssh/known_hosts) and now you can login as root using ssh. NOTE: This was done by a user and described in Forum and its not verified up to now. see: [1]

Personal tools