====== Install Debian on a 2Big Network ====== This page could be relevant for all the Orion-based LaCie boards. ===== Boot custom installer ===== In the following process, you should replace ${NAS_IP} with correct IP regarding your network configuration. ${ipaddr} and ${serverip} are automatically set by clunc. ====2Big Network 2==== * Connect to U-Boot using network console with [[CLUNC|clunc]]: As a preliminary step, you must export the installer [[ftp://lacie-nas.org/kernel/kirkwood/uImage_2.6.38-rc4_kirkwood_lacie_miniroot|image]] via a **tftp** server. U-Boot will use this way to load the installer image into RAM. $ ./clunc -i ${NAS_IP} Marvell>> setenv ipaddr ${ipaddr}; setenv serverip ${serverip}; tftpboot 0x800000 uImage setenv ipaddr ${ipaddr}; setenv serverip ${serverip}; tftpboot 0x800000 uImage Using egiga0 device TFTP from server ${serverip}; our IP address is ${ipaddr} Filename 'uImage'. Load address: 0x800000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ####### done Bytes transferred = 2031132 (1efe1c hex) * Boot installer: Marvell>> setenv bootargs ip=dhcp console=ttyS0,115200 netconsole=6666@${ipaddr}/,6666@${serverip}/ setenv bootargs ip=dhcp console=ttyS0,115200 netconsole=6666@${ipaddr}/,6666@${serverip}/ Marvell>> bootm 0x800000 bootm 0x800000 ## Booting image at 00800000 ... Image Name: Linux-2.6.38-rc4-09710-g31481ad- Created: 2011-02-20 13:26:58 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2031068 Bytes = 1.9 MB Load Address: 00008000 Entry Point: 00008000 Verifying Checksum ... OK OK Starting kernel ... [ 0.000000] Linux version 2.6.38-rc4-09710-g31481ad-svn-dirty (simon@X31) (gcc version 4.4.2 (crosstool NG-hg_default@1665_60a47ac6cae1) ) #7 PREEMPT Sun Feb 20 16:16:24 CET 2011 [ 0.000000] CPU: Feroceon [41069260] revision 0 (ARMv5TEJ), cr=a0053177 [ 0.000000] CPU: VIVT data cache, VIVT instruction cache [ 0.000000] Machine: LaCie 2Big Network [ 0.000000] Clearing invalid memory bank 0KB@0x00000000 [ 0.000000] Clearing invalid memory bank 0KB@0x00000000 [ 0.000000] Ignoring unrecognised tag 0x00000000 [ 0.000000] Ignoring unrecognised tag 0x00000000 [ 0.000000] Ignoring unrecognised tag 0x00000000 [ 0.000000] Ignoring unrecognised tag 0x41000403 [ 0.000000] Memory policy: ECC disabled, Data cache writeback [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 [ 0.000000] Kernel command line: ip=dhcp console=ttyS0,115200 netconsole=6666@192.168.0.17/,6666@192.168.0.11/ [ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes) [ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) [ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) [ 0.000000] Memory: 64MB = 64MB total [ 0.000000] Memory: 59008k/59008k available, 6528k reserved, 0K highmem [ 0.000000] Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB) [ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) [ 0.000000] DMA : 0xffc00000 - 0xffe00000 ( 2 MB) [ 0.000000] vmalloc : 0xc4800000 - 0xfd800000 ( 912 MB) [ 0.000000] lowmem : 0xc0000000 - 0xc4000000 ( 64 MB) [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB) [ 0.000000] .init : 0xc0008000 - 0xc012b000 (1164 kB) [ 0.000000] .text : 0xc012b000 - 0xc0517fb8 (4020 kB) [ 0.000000] .data : 0xc0518000 - 0xc0539040 ( 133 kB) [ snip ] ====2Big Network==== A minimal system can be used to prepare disks and to install Debian distribution. A such sytem (kernel+initramfs) is available [[ftp://lacie-nas.org/kernel/orion/uImage_2.6.38-rc4_orion_lacie_miniroot|standard image]] or [[ftp://lacie-nas.org/kernel/orion/uImage_2.6.38-rc4_orion_lacie_net2big_fix_id_miniroot|Fixed ID image]]. The initramfs only embed enssential software: busybox, mdadm and mke2fs. Note that the total image size (kernel+initramfs) must not exceed 2MB. The LaCie stock U-Boot is not able to load images largest than 2MB. * Connect to U-Boot using network console with [[CLUNC|clunc]]: $ ./clunc -i ${NAS_IP} * Edit U-Boot env variables (don't do this if you use the fix_id kernel): Marvell>> setenv arcNumber 2342 setenv arcNumber 2342 Marvell>> setenv mainlineLinux yes setenv mainlineLinux yes Marvell>> saveenv saveenv Saving Environment to Flash... . Un-Protected 1 sectors Erasing Flash... . done Erased 1 sectors Writing to Flash... done . Protected 1 sectors Marvell>> reset reset * Load installer image: As a preliminary step, you must export the installer [[ftp://lacie-nas.org/kernel/orion/uImage_2.6.38-rc4_orion_lacie_miniroot|standard image]] or [[ftp://lacie-nas.org/kernel/orion/uImage_2.6.38-rc4_orion_lacie_net2big_fix_id_miniroot|Fixed ID image]] via a **tftp** server. U-Boot will use this way to load the installer image into RAM. $ ./clunc -i ${NAS_IP} Waiting for LUMP (0) no lump receive; continuing Marvell>> setenv ipaddr ${ipaddr}; setenv serverip ${serverip}; tftpboot 0x400000 uImage setenv ipaddr ${ipaddr}; setenv serverip ${serverip}; tftpboot 0x400000 uImage Using egiga0 device TFTP from server ${serverip}; our IP address is ${ipaddr} Filename 'uImage'. Load address: 0x400000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ####### done Bytes transferred = 2031132 (1efe1c hex) * Boot installer: Marvell>> setenv bootargs ip=dhcp console=ttyS0,115200 netconsole=6666@${ipaddr}/,6666@${serverip}/ setenv bootargs ip=dhcp console=ttyS0,115200 netconsole=6666@${ipaddr}/,6666@${serverip}/ Marvell>> bootm 0x400000 bootm 0x400000 ## Booting image at 00400000 ... Image Name: Linux-2.6.38-rc4-09710-g31481ad- Created: 2011-02-20 13:26:58 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2031068 Bytes = 1.9 MB Load Address: 00008000 Entry Point: 00008000 Verifying Checksum ... OK OK Starting kernel ... [ 0.000000] Linux version 2.6.38-rc4-09710-g31481ad-svn-dirty (simon@X31) (gcc version 4.4.2 (crosstool NG-hg_default@1665_60a47ac6cae1) ) #7 PREEMPT Sun Feb 20 16:16:24 CET 2011 [ 0.000000] CPU: Feroceon [41069260] revision 0 (ARMv5TEJ), cr=a0053177 [ 0.000000] CPU: VIVT data cache, VIVT instruction cache [ 0.000000] Machine: LaCie 2Big Network [ 0.000000] Clearing invalid memory bank 0KB@0x00000000 [ 0.000000] Clearing invalid memory bank 0KB@0x00000000 [ 0.000000] Ignoring unrecognised tag 0x00000000 [ 0.000000] Ignoring unrecognised tag 0x00000000 [ 0.000000] Ignoring unrecognised tag 0x00000000 [ 0.000000] Ignoring unrecognised tag 0x41000403 [ 0.000000] Memory policy: ECC disabled, Data cache writeback [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 [ 0.000000] Kernel command line: ip=dhcp console=ttyS0,115200 netconsole=6666@192.168.0.17/,6666@192.168.0.11/ [ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes) [ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) [ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) [ 0.000000] Memory: 64MB = 64MB total [ 0.000000] Memory: 59008k/59008k available, 6528k reserved, 0K highmem [ 0.000000] Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB) [ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) [ 0.000000] DMA : 0xffc00000 - 0xffe00000 ( 2 MB) [ 0.000000] vmalloc : 0xc4800000 - 0xfd800000 ( 912 MB) [ 0.000000] lowmem : 0xc0000000 - 0xc4000000 ( 64 MB) [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB) [ 0.000000] .init : 0xc0008000 - 0xc012b000 (1164 kB) [ 0.000000] .text : 0xc012b000 - 0xc0517fb8 (4020 kB) [ 0.000000] .data : 0xc0518000 - 0xc0539040 ( 133 kB) [ snip ] ====Log into the installer==== First, you need to guess the installer address IP (delivred by a DHCP server). You could use tools like **dhcpdump**. Example: $ sudo dhcpdump -i eth0 [ snip ] OPTION: 50 ( 4) Request IP address 192.168.0.16 [ snip ] Then, you can simply connect to the installer using **telnet**: $ telnet 192.168.0.16 Trying 192.168.0.16... Connected to 192.168.0.16. Escape character is '^]'. miniroot login: root BusyBox v1.15.3 (2010-10-22 22:14:58 CEST) built-in shell (ash) Enter 'help' for a list of built-in commands. miniroot ~ # uname -a Linux miniroot 2.6.38-rc4-09710-g31481ad-svn-dirty #6 PREEMPT Sun Feb 20 15:37:16 CET 2011 armv5tel GNU/Linux miniroot ~ # ===== Partition Disks ===== Using a custom debian installation on the 2BigNetwork allows great flexibility with the partition structure. The only caveat is that the kernel _must_ be on partition 6 of one or both of the drives, usually both to make the drives swappable. The startup of the initial ram fs will search for a root filesystem on all RAID and regular disk partitions, and if one is found, will switch to it and complete the boot sequence from there. If you didn't change the //bootargs// variable in U-Boot, the rootfs must be on partition 7. Use the supplied **fdisk** to partition the disk. An example scheme is below ==== Running on a single 500GB disk with no RAID === Device Boot Start End Blocks Id System Mount Point /dev/sda1 1 2433 19543041 83 Linux / /dev/sda2 2434 2556 987997+ 83 Linux swap /dev/sda3 2560 60801 467828865 83 Linux /data /dev/sda4 2557 2559 24097+ 5 Extended /dev/sda5 2557 2558 16033+ 83 Linux unused /dev/sda6 2559 2559 8001 83 Linux kernel image ==== A dual disk configuration with RAID ==== Using the same partition but with sda1 and sdb1 making md0 for /, and sda3 and sdb3 making md1 for /data Create the RAID arrays using the mdadm command: mdadm -C /dev/md0 -l 1 -n 2 /dev/sda1 /dev/sdb1 mdadm -C /dev/md1 -l 1 -n 2 /dev/sda3 /dev/sdb3 Format the / filesystem as ext3 with: mke2fs -j /dev/sda1 (or /dev/md0 if using RAID) Format the /data fielsystem as ext3 with: mke2fs -j /dev/sda3 (or /dev/md1) ===== Install kernel ===== Providing that an internet connection is available, installation of the kernel is as simple as: ==== 2Big Network 2 ==== wget ftp://lacie-nas.org/kernel/kirkwood/uImage_2.6.38-rc4_kirkwood_lacie_miniroot -O /dev/sda6 wget ftp://lacie-nas.org/kernel/kirkwood/uImage_2.6.38-rc4_kirkwood_lacie_miniroot -O /dev/sdb6 ==== 2Big Network ==== * If using the regular kernel wget ftp://lacie-nas.org/kernel/orion/uImage_2.6.38-rc4_orion_lacie_miniroot -O /dev/sda6 wget ftp://lacie-nas.org/kernel/orion/uImage_2.6.38-rc4_orion_lacie_miniroot -O /dev/sdb6 * If using the kernel with fixed id wget ftp://lacie-nas.org/kernel/orion/uImage_2.6.38-rc4_orion_lacie_net2big_fix_id_miniroot -O /dev/sda6 wget ftp://lacie-nas.org/kernel/orion/uImage_2.6.38-rc4_orion_lacie_net2big_fix_id_miniroot -O /dev/sdb6 ===== Install rootfs ===== After the basic rootfs is installed, the system can be booted and used as a regular debian system. * Create some useful directories mkdir /mnt mkdir /mnt/root mkdir /data * Mount / and /data mount /dev/sda1 /mnt/root mount /dev/sda3 /data * Download the rootfs into /data cd /data wget ftp://lacie-nas.org/images/rootfs-sid.tar.bz2 bunzip2 rootfs-sid.tar.bz2 tar xf rootfs-sid.tar -C . mv rootfs-sid/* /mnt/root * Copy the console device cp -a /dev/console /mnt/root/dev * Unmount and reboot umount /mnt/root umount /data reboot The NAS should now start the the roofs on /dev/sda1. The rootfs does not contain a telnet daemon, instead it uses ssh * SSH into the NAS ssh root@IPADDRESS From here on, the NAS can be treated and configured as a regular debian system. ===== Initial Configuration ===== * Set a root password root@sid-arm:~# passwd Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully * Automatically mount /data Using your preferred editor (nano is available), edit /etc/fstab to automatically mount the /data partition and setup the swap # UNCONFIGURED FSTAB FOR BASE SYSTEM /dev/sda3 /data auto defaults 0 0 /dev/sda2 swap swap defaults 0 0 * Create the /data directory and mount it mkdir /data mount /data * Update the apt database apt-get update * Install ntpdate to set the correct time on startup apt-get install ntpdate ntpdate pool.ntp.org ==== Set up the network ==== * Set a static IP address so you always know where to find your NAS on the network Edit /etc/network/interfaces and replace iface eth0 inet dhcp With iface eth0 inet static address 192.168.1.9 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 Using your preferred settings where appropriate * Set your hostname Edit /etc/hostname and enter your preferred name * Set up /etc/hosts to ensure proftpd works Edit /etc/hosts and add 127.0.0.1 localhost 192.168.1.9 lacie-nas Changing your IP address appropriately ===== Useful Services ===== ==== SAMBA ==== * Install the packages apt-get install samba A basic configuration * Edit /etc/samba/smb.conf to share the /data directory with public read access [data] comment = NAS Data read only = yes guest ok = yes path = /data * For the sake of simplicity, set the server to *share* level access ####### Authentication ####### # "security = user" is always a good idea. This will require a Unix account # in this server for every user accessing the server. See # /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html # in the samba-doc package for details. security = share ==== FTP ==== * Install Proftpd apt-get install proftpd When asked, choose to start as a service, not through xinetd * Configure the service to load on startup update-rc.d proftpd defaults * Add a user and make them owner of the /data directory root@lacie-nas:~# adduser ftpuser Adding user `ftpuser' ... Adding new group `ftpuser' (1001) ... Adding new user `ftpuser' (1001) with group `ftpuser' ... Creating home directory `/home/ftpuser' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for ftpuser Enter the new value, or press ENTER for the default Full Name []: FTP User Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y chown ftpuser.ftpuser /data ==== MediaTomb UPNP AV Server ==== At the time of installation, the Mediatomb package in debian sid required an unavailable libavtil package, so this needed to be installed manually. wget http://ftp.us.debian.org/debian/pool/main/f/ffmpeg/libavutil49_0.5.2-6_armel.deb dpkg -i libavutil49_0.5.2-6_armel.deb Then, install the Mediatomb package apt-get install mediatomb And set it to startup automatically update-rc.d mediatomb defaults Configure the default parameters for the mediatomb server. Set the interface to listen on, and start the user as root, becuase otherwise it doesnt start properly. Edit /etc/defaults/mediatomb like # Defaults for MediaTomb initscript # sourced by /etc/init.d/mediatomb # installed at /etc/default/mediatomb by the maintainer scripts # # This is a POSIX shell fragment # # Set whether the daemon should be started. Set this value to anything # but 'yes' to enable the daemon NO_START="no" # Additional options that are passed to the daemon. OPTIONS="" # The network interface for MediaTomb to bind to and for which the multicast # routing entry should be added; "" if the route shouldn't be added at all. # For example: INTERFACE="eth0" INTERFACE="eth0" # The route command and arguments to be used if INTERFACE is defined. # These variables should normally be left unmodified. ROUTE_ADD="/sbin/route add -net 239.0.0.0 netmask 255.0.0.0" ROUTE_DEL="/sbin/route del -net 239.0.0.0 netmask 255.0.0.0" # The user and group that MediaTomb should be run as. USER="root" GROUP="root" Create a directory for the mediatomb database mkdir /data/.mediatomb And configure mediatomb to use it and to start the web interface by editing /etc/mediatomb/config.xml MediaTomb uuid:f0b15445-f01e-4c97-987a-406b6d908ef3 /data/.mediatomb/ The address of the mediatomb webserver can be seen in the log cat /var/log/mediatomb.log 2011-02-23 13:57:51 INFO: MediaTomb Web UI can be reached by following this link: 2011-02-23 13:57:51 INFO: http://192.168.1.3:49152/ ===== Troubleshooting ===== * Depending the LaCie U-Boot version, the **savenv** command could fail: as a solution you can use a [[ftp://lacie-nas.org/kernel/uImage-arm-orion-lacie-net2big-fix-id-2.6.38-rc4-miniroot|a dedicated net2big kernel image]] with machine ID set to 526 (Marvell LSP unique number for all the customer boards). * If you are having problems with fix ID or made a mistake in the environment run resetenv