Installing unRAID on a full Slackware distro

From unRAID
Jump to: navigation, search

This procedure is intended to help some with moderate Linux experience set up unRAID on a full Slackware development system.

Of upmost importance was to have a failsafe system, that could be converted back to booting off the standard unRAID USB stick at any time.

This procedure only works for the specifically indicated versions of unRAID.

If you want to install unRAID 5.0x on Slackware, use this article instead.

Prerequisites and preparation

Changes for unRAID 4.4.2 are highlighted

You need to be able to do the following on your own:

  • Install a virgin Slackware 12.1 system (12.2 for unRAID 4.4).
  • Set up static IP under Linux.
  • Enable Apache and edit the Apache httpd.conf.
  • Edit various startup scripts in /etc/rc.d.
  • Run menuconfig, select drivers, and rebuild a kernel.
  • Debug panics caused by missing drivers in your kernel configuration.
  • Use a browser on nonstandard port numbers.
  • Edit lilo.conf to create multiple kernel boot options.

If you are doing this on an existing unRAID server, do NOT make any changes (adding or deleting drives) until this process is COMPLETELY done. If something goes fubar, go back to a standard unRAID setup booting from the USB, and get things stable and parity good BEFORE starting this process.

If you are doing this on an existing unRAID server, make sure your unRAID system is stable and parity is good BEFORE starting this process.

Start

  1. Make a Slackware 12.1 DVD (http://www.slackware.com/getslack/) (Slackware 12.2 with 2.6.27.7 kernel for unRAID 4.4)
  2. Either use an existing unRAID flash or make a new one. You can make a new unregistered one for install process, and then swap it with your registered one later.
  3. Boot unRAID from USB and confirm functionality with your mobo, drives, and controllers.
  4. Save/print a copy of the syslog and dmesg output to help in identifying hardware when you make your own config.
  5. Save a copy of the output from these commands, to assist you in identifying the hardware in your system:
    1. lsmod
    2. lsdev
    3. lspci -v
    4. ethtool -i
  6. If migrating an existing unRAID server:
    1. Go to "Devices" page of unRAID control panel and PRINT OUT the list of devices.... you will need it later.

Install Boot Drive and Linux

  1. Shutdown and disconnect all drives and USB sticks you're not using. They can cause problems later.
  2. Install a DVD drive and one hard drive to be used for Linux and swap, that will NOT be part of the unRAID array.
    • Drive should be on primary IDE controller (i.e. /hda). Speed is not critical. Size is not critical, I used a spare 250GB I had laying around, but you can use anything about 20GB and up. A larger drive can be useful as temporary storage for things like nzbget, so your array drives can stay spun down.
  3. Boot Slackware 12.1 DVD (12.2 for unRAID 4.4)
  4. cfdisk and create 2GB swap and the rest for Linux. Set the Linux partition to bootable
  5. Run the Slackware setup, and accept all defaults, except you should enable Apache, and should use a static IP.
  6. Use a blank password for root. (Note, this will make SSH difficult, so plan to use telnet instead)
  7. Login as root.
    • If you wish to use the GUI, $ startx
  8. Run hdparm /dev/hda and make sure your drive can run in DMA mode.
  9. If you want a password on the unRAID management interface and for ssh, set it now. Otherwise make sure root has no password.
  10. Run pwunconv to remove shadow passwords.
  11. Make sure you can ping the new server.
  12. Make sure you can telnet to the new server.
    • If not, $ nano /etc/inetd.conf
    • Uncomment the Telnet server
    • $ kill -HUP 'cat /var/run/inetd.pid' -to start it
    • If it says your password is incorrect (and you've checked); $ nano /etc/securetty and remove the '#' for all the pts/X entries
  13. Open a browser on a PC and browse to your server’s IP and you should see the Apache "It Works" message
    • If it doesn't work, you must install Apache, see install instructions here
  14. Create lilo entry for alternative kernel for recovery if new kernel hangs
    1. $ ls -la /boot and see what file vmlinuz is linked to (probably vmlinuz-huge-smp-2.6.xx.x-smp)
    2. $ nano /etc/lilo.conf and duplicate the linux boot section
    3. Changing the “image=” line to point to to the real file vmlinuz was symlinked to.
    4. Change the label to unRAID as this is your new image
It should look something like this:
 # Linux bootable partition config begins
image = /boot/vmlinuz
root = /dev/hdaX
label = unRAID
read-only

image = /boot/vmlinuz-huge-smp-2.6.27.7-smp
root = /dev/hdaX
label = Linux
read-only
# Linux bootable partition config ends

15. Save and Exit
16. Run lilo -v
17. Boot back to Slackware, boot alternative kernel entry to make sure it works

Extract initramfs files from bzroot

  1. Decide where to store a copy of the unRAID distro. I use /unraid
  2. mkdir /unraid
  3. cd /unraid
  4. wget http://download.lime-technology.com/unRAID%20Server%204.3.3.zip, wget http://download.lime-technology.com/unRAID%20Server%204.4.2.zip (for unRAID 4.4)
  5. unzip *.zip bzroot
  6. zcat bzroot | cpio -m -i -d -H newc --no-absolute-filenames
  • It should read 197274 blocks if it completes correctly.

Prepare Linux source, and copy unRAID config and source mods

  1. get linux source for 2.6.24.4 and untar it in /usr/src (I've also successfully used 2.6.24.5)
  2. $ cd /usr/src
  3. wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.24.4.tar.bz2, wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.27.7.tar.bz2 (for unRAID 4.4)
  4. $ tar -xjf linux-2.6.24.4.tar.bz2 (linux-2.6.27.7.tar.bz2 for unRAID 4.4)
  5. rename it to linux-2.6.24.4-unraid-special (2.6.27.7 for unRAID 4.4)
  6. delete (rm linux) the existing linux symlink (if present)
  7. symlink linux (ln -s linux-2.6.24.4-unraid-special /usr/src/linux) (2.6.27.7 for unRAID 4.4)
  8. confirm symlink is pointing to the right place (ls -la linux)

Copy unRAID config and MD source mods

  1. $ cd /usr/src/linux
  2. $ cp /unraid/usr/src/linux/.config .
  3. $ cd /usr/src/linux/drivers/md
  4. $ cp /unraid/usr/src/linux/drivers/md/* .

Modify the unRAID config

This is important. UnRAID uses an initramfs to provide the root file system to the kernel. We are going to use a hard drive for the root file system, so the drivers for Linux to access that drive have to be built into the kernel, and not left as modules.

  1. run lsmod and lspci and save the output to help you determine which drivers to put in the kernel later.
  2. $ cd /usr/src/linux
  3. $ make clean
  4. $ make oldconfig
  5. $ make menuconfig
  6. You have to include (not modularize) drivers for boot disk. My boot disk is IDE.
  7. Unselect Initial RAM filesystem and RAM disk (initramfs/initrd) support
  8. Set the following to (*) and not as (M) by using the spacebar to change it:
    1. File Systems ---> Ext3 journalling file system support and ALL other filesystems on your boot disk, even if you are not mounting them.
    2. File Systems ---> DOS/FAT/NT Filesystems ---> NTFS file system support for NTFS support. May want to include write support as well.
    3. Device Drivers ---> ATA/ATAPI/MFM/RLL support (* this first) ---> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
    4. And Include IDE/ATA-2 DISK support
    5. And generic/default IDE chipset support
  9. Save and Exit

You will need to select the necessary drivers for your system. You only need the drivers for the boot drive, not the rest of the unRAID disks. So if the boot drive is IDE, and the unRIAD disks are all SATA, you only need the IDE drivers at this point. You may need to enable something in Serial ATA (prod) and Parallel ATA (experimental) drivers if your boot drive is SATA.

If you have problems here, boot the alternate Linux kernel, and save/print a copy of the syslog and dmesg output for use in identifying hardware.

Build a new Linux kernel

  1. $ cd /usr/src/linux
  2. $ make
  3. $ make modules
  4. $ make modules_install
  5. $ make install
  6. $ reboot into the new kernel
    • If it panics, reboot back to the alternate kernel and check the disk drivers. Particularly if the panic was a failure when attempting to mount the root fs.
    • Build a new kernel and boot again.
  7. After your new kernel is booting, log in and run hdparm /dev/hda and make sure your boot drive is in DMA mode. If not, adjust the Linux config until you do.

Once your new kernel is booting and your boot drive is in DMA mode, shut down and congratulate yourself.

Copy unRAID scripts and executables

  1. I diff’d the unRAID distro to the Slackware distro to see the missing packages. All you really need to copy is these differences to your Slackware distro: eg. $ diff /unraid/root /root to see the differences.
    1. /unraid/root
    2. /unraid/usr/local/sbin
    3. /unraid/etc/samba
  2. Plus you need these files (or merge their changes from stock into yours) from /unraid/etc/rc.d:
    1. rc.samba
    2. rc.ifplugd
    3. rc.local
    4. rc.syslog
    5. rc.nfsd
    6. rc.ntpd
    7. Yes, there are some other files with changes, but I found they were not apparently critical to unRAID. You can diff them and see. If anyone finds something else important, be sure to post it.
  3. If you plan on using user shares, you must also copy the following files (to their respective Slackware directories):
    1. /unraid/etc/rc.d/rc.fuse
    2. /unraid/bin/fusermount

Test new kernel and drivers with unRAID

  1. Reconfigure your BIOS to boot from hard drive instead of flash.
  2. Reinstall the unRAID USB stick (either registered or unregistered).
  3. Boot your new kernel. (Make sure you are not booting from USB... change your BIOS if necessary.)
  4. Log in and run emhttp -p 88. You should get error message “mkdir: cannot create directory `/boot/config/shares': Not a directory” ignore it for now.
  • If you get a segmentation fault, boot into the other kernel
  1. Open a browser to your server on port 88... should see unRAID control panel. Go to devices, and see if hda is there in the pulldown list.
  2. Shutdown and add one more drive. Boot back to your new kernel.
  3. Log in and run emhttp -p 88.
  4. Open browser to your server on port 88... should see unRAID control panel. Go to devices, and see if both drives are there. Assign the second drive to unRAID, and then start the array.
  5. Map a drive from unRAID on a PC and test file xfers.
  6. Shutdown and reboot from UNRAID control panel.

Congrats.... you are in the home stretch.

Mount flash and symlink to config

  1. If you are upgrading an existing unRAID server and have been using a unregistered flash, now is the time to swap to your registered one.
  2. Install all your drives.
  3. Watch your POST messages and see that all hard drives are appearing.
  4. Reboot and log in as root. Make sure you are booting from the hard drive, and not the flash.
  5. Mkdir /flash
  6. Add new line to /etc/fstab: “/dev/disk/by-label/UNRAID /flash vfat defaults 0 0"
  7. Cd to /boot and remove the symlink for /boot/config.
  8. Create symlink to /flash/config as /boot/config
  9. Start emhttp -p 88. You should get no error this time.
  10. Open browser to your server on port 88... should see unRAID control panel. If you were using a flash with an existing unRAID config, it should have picked it up... if not, it should be empty.
  11. If you used a flash with an existing unRAID config, some drives may appear missing, but they are probably just in the wrong order. Go back to your printout of the unRAID devices and rearrange them as they were originally.
  12. Configure your drives for unRAID, and start the array.
  13. Test the drives by:
    1. Mapping from another PC and read from each one
    2. Run hdparm -tT /dev/xxx for each one
    3. Any problems that show up, probably mean you need to reconfig something in the kernel
  14. Edit the go script on the flash, to run emhttp with -p 88
  15. Stop the array and reboot to your system BIOS

Final boot

  1. Your system should autoboot from the HD, with the USB flash installed.
  2. Your go script from the flash should execute, and start emhttp... check syslog or dmesg if it doesn’t start.
  3. Open browser to your server on port 88... should see unRAID control panel and the configuration changes you just made should have been retained.
  4. You may need to do a parity check... I didn’t, but YMMV. I did one anyway overnight just to be safe, and no errors were found.

Congratulations. You now have unRAID installed and running on a complete Slackware development system. There is now practically nothing you can not do with this system, in terms of adding software and tweaking configurations.

Some Notes and Issues

If you edit Linux scripts and text files on the PC, be sure to use a text editor that supports Linux line endings. I use notepad2 (http://www.flos-freeware.ch/notepad2.html).

Remove the execute bit from /etc/cron.daily/slocate ... if you don't all your drives will be spun up once a day by slocate.

Edit /etc/rc.d/rc.inet1.conf to change your IP

Edit /etc/resolv.conf and /etc/hosts as needed

Startup mods are usually put in your local startup script (including calling the go script from the flash) (/etc/rc.d/rc.local)

Create a shutdown script (/etc/rc.d/rc.local_shutdown) and put commands to unmount unRAID devices, stop samba, sync, and stop the array.

Note that /etc/samba/smb.shares is rewritten on each boot by unRAID, and it has a bad create mask.

If you are going to mess around with features like S3 suspend, hibernation, installing software like nzbget, or do Linux maintenance stuff, stop the array first. Note you need to unmap all samba drives and in any terminal windows, cd to the root before stopping the array.