Now that we are able to boot the kernel and have prepared the harddisk for use in the NAS, it’s time to start the second stage of installing Debian on your NAS!
If you don’t have the commandline ready on your NAS, see my previous post on how to load and boot your kernel on your NAS, when done, you can continue with this post.
INSTALLATION:
This is the first part of this tutorial, which will actually install Debian on your NAS and prepare it for use.
We need to set the PATH variable:
export PATH=/usr/bin:/usr/sbin:/sbin:/bin:/debootstrap
Now we can actually install the prepared armel packages on the NAS with:
debootstrap --second-stage
Wait for it to finish, depeding on the CPU speed this can take up to 10 minutes.
When it’s finished we need to edit some files which are needed to boot the NAS with Debian.
First, edit the /etc/fstab file:
nano /etc/fstab
Put the following lines in that file and save the file after that:
/dev/sda1 / ext4 defaults 0 1
/dev/sda2 none swap sw 0 0
/dev/sda3 /home ext4 defaults,usrquota 1 1
proc /proc proc nodev,noexec,nosuid 0 0
Now edit the network interface file:
nano /etc/network/interfaces
And put the following lines in it and save after that (adapt the IP to your own IP):
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.3
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
Then edit the inittab file:
nano /etc/inittab
Scroll down to the part when you see 7 VGA terminals, comment them all out (put a #
at the beginning of that line.
Set a root password:
passwd root PASS
Close the serial or netconsole connection to your NAS and power the NAS down. You’ve completed the first stage of this turorial, continue to the second part!
BOOTING FROM YOUR NAS:
Now that Debian is fully installed and usable on your NAS, it’s time to actually boot it. In my earlier post i’ve given the steps to load the kernel into your NAS.
There is now one thing that needs to be changed, the bootargs, we now want the init process to call inittab and let it boot into runlevel.
Power on your NAS, open up your connection to your NAS and give all the variables stated in my earlier post, but give this bootargs line:
setenv bootargs console=ttyS0,115200 root=/dev/sda1 rw init=/sbin/init
And let your NAS boot, you’ll see a Linux system starting up like this happens on your desktop! You’ll be left with a prompt if all went ready!
Now we can install some packages and verify if installation went correct:
First check if the networking options are still correctly set:
ifconfig
If the output shows the IP you’ve set you’re good.
Now we can enter the Debian 6 repo’s in the APT sources.list:
nano /etc/apt/sources.list
Enter the following 2 lines:
deb http://ftp.nl.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.nl.debian.org/debian/ squeeze main contrib non-free
Save your settings and exit the editor.
Now that you’ve set up the repositories you can update APT to build the package database:
apt-get update
See the following entries which could be handy on your NAS:
SSH access:
apt-get install openssh-server
Printer sharing:
apt-get install cups
Filesharing via Samba (note that you first need to install cups
before Samba can be installed!):
apt-get install samba
Networkdrive mounting support (must be built in your kernel!):
apt-get install smbfs
Building and compiling (for compiling source programs)
apt-get install build-essential libncurses5-dev
Midnight Commander (like the old Norton Commander):
apt-get install mc
Archive types (.zip etc):
apt-get install rar unrar unzip zip arj p7zip
Sudo (giving normal users root permissions):
apt-get install sudo
That’s it! You definitely want SSH access to the box, so you should set that up first, so you can access the NAS from your own desktop. From there you can install all the stuff needed and create users on the device etc!
When I finish the boot, before the /sbin/init I get this:
Marvell>> bootm 0x400000
## Booting image at 00400000 …
Image Name: Linux-2.6.38.2
Created: 2011-04-16 18:35:58 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1915120 Bytes = 1.8 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum … OK
OK
Starting kernel …
Uncompressing Linux… done, booting the kernel.
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
root@(none):/#
When I boot with the /sbin/init I get stuck at this:
Marvell>> setenv bootargs console=ttyS0,115200 root=/dev/sda1 rw init=/sbin/init
Marvell>> tftp 0x400000 uImage
Using egiga0 device
TFTP from server 192.168.2.40; our IP address is 192.168.2.10
Filename ‘uImage’.
Load address: 0x400000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
##################################################
done
Bytes transferred = 1915184 (1d3930 hex)
Marvell>> bootm 0x400000
## Booting image at 00400000 …
Image Name: Linux-2.6.38.2
Created: 2011-04-16 18:35:58 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1915120 Bytes = 1.8 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum … OK
OK
Starting kernel …
Uncompressing Linux… done, booting the kernel.
INIT: version 2.88 booting
Using makefile-style concurrent boot in runlevel S.
.udev/ already exists on the static /dev! … (warning).
Starting the hotplug events dispatcher: udevd.
Synthesizing the initial hotplug events…done.
Waiting for /dev to be fully populated…done.
Activating swap…done.
Checking root file system…fsck from util-linux-ng 2.17.2
spare: clean, 9319/78000 files, 313235/313236 blocks
done.
Cleaning up ifupdown….
Setting up networking….
Loading kernel modules…done.
Activating lvm and md swap…done.
Checking file systems…fsck from util-linux-ng 2.17.2
data: clean, 11/60989440 files, 3879012/243943008 blocks
done.
Mounting local filesystems…mount: mount point /mnt/data does not exist
failed.
Activating swapfile swap…done.
Cleaning up temporary files….
Mounting emergency tmpfs on /tmp…done.
Configuring network interfaces…done.
Cleaning up temporary files….
Setting kernel variables …done.
INIT: Entering runlevel: 2
Using makefile-style concurrent boot in runlevel 2.
gzip: /var/log//dmesg.0.gz: No space left on device
mv: cannot stat `/var/log//dmesg.0.gz’: No such file or directory
klogctl: Function not implemented
Starting enhanced syslogd: rsyslogd.
Starting periodic command scheduler: cron.
INIT: no more processes left in this runlevel
(ignore the mount error – I haven’t got around to creating the data partition mount point)
It is stuck at the runlevel error. It will not respond to anything but a power down.
Except the kernel address, keep the settings as in my post, they are know to work, uBoot mounts the sda7 partition as read-only, therefore not making changes possible. As stated, to modify the bootargs, you need to update your uBoot, which is a pain to do…
My NAS always boots from TFTP, I have installed everything first using the serial connection and then close the case, put it into place, start clunc listening to the nas and poweron the nas. Via that way I load and boot the kernel and set the bootargs, since my nas never reboots, I can live with this “handicap”. Once clunc output stops, I quit the program and let the nas do it’s thing :).
Did you get any further with your device?
Did you get any further with your NAS?