Installing unRAID 5.0 on a full Slackware Distro

From unRAID
Jump to: navigation, search

Updated for 5.0RC8a

This procedure is intended to help some with moderate Linux experience set up unRAID 5.0 on a full Slackware development system. This is an update of a previous article to incorporate changes for unRAID 5.0. This should be considered a work in progress until unRAID 5.0 is finalized.

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

Prerequisites and preparation

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

  • Install a virgin Slackware 13.37 (or 14.0) system
  • 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 13.37 (or 14.0) DVD (http://www.slackware.com/getslack/)
  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 eth0 #replace with your ethernet device if not eth0
  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.

Alternative Start

  1. Make a Slackware 13.37 (or 14.0) USB Installer using a new usb key
    1. You can get the usb source from here
    2. Not sure how to use reference, but instructions can be found here to setup your usb key to install

Install Boot Drive and Linux

  1. Shutdown and disconnect all drives and USB sticks you're not using. They can cause problems later. It is only necessary if you are unable to keep track of which hard drive you are installing it to.
  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 or SATA controller (i.e. /dev/hda or /dev/sda). 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. You can also combine a Slackware install with a cache drive.
  3. Boot Slackware DVD
  4. Use fdisk and create 2GB swap and otherwise partition the disk as you want it.
  5. Run the Slackware setup, and accept all defaults, except you should enable Apache, and use a static IP.
  6. If you want a password on the unRAID management interface and for ssh, set it during the Slackware setup.
    • Note it is no longer necessary to run pwunconv to remove shadow passwords.
  1. Reboot from the hard drive.
  2. Reconfigure your BIOS to boot from hard drive instead of flash.
  3. If using a PATA drive, run hdparm /dev/hda and make sure your drive can run in DMA mode.
  4. Make sure you can ping the new server.
  5. Make sure you can telnet to the new server.
  6. If you want unRAID to have Internet access, check that you can ping and nslookup web sites like google.com.
    • If not, edit /etc/inetd.conf and /etc/resolv.conf as needed.
  7. Edit /etc/inetd.conf and uncomment the telnet server.
  8. Run kill -HUP 'cat /var/run/inetd.pid' to restart network services.
  9. Log into server via telnet or ssh.
    • If it says your password is incorrect (and you've checked); vi /etc/securetty and remove the '#' for all the pts/X entries.
  10. 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 and you want a web server, you can install Apache, see install instructions here
  11. You should look into using GRUB instead of LILO to prevent possible drive signature detection issues since LILO will write bytes into all drive's MBRs.
  12. 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. Edit /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 when done:
 # Linux bootable partition config begins
image = /boot/vmlinuz
root = /dev/sdaX
label = unRAID
read-only

image = /boot/vmlinuz-huge-smp-2.6.27.7-smp
root = /dev/sdaX
label = Linux
read-only
# Linux bootable partition config ends
  1. Save and Exit
  2. Run lilo -v (You may also have to run lilo -P ignore if you get errors here)
  3. Reboot and test alternative kernel entry to make sure it works.

Extract unRAID 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://lime-technology.com/download/doc_download/31-unraid-server-version-50-rc8a-aio (be sure to use the latest version.)
  5. unzip *.zip bzroot
  6. xzcat bzroot | cpio -m -i -d -H newc --no-absolute-filenames
  • It should read 394912 blocks (for RC 2) if it completes correctly. (394789 for beta13, 394801 for beta14)
  • For older releases before 5.0 Release Candidate 2 that uses LZ77 instead of LZMA2 compression, use zcat instead of xzcat.

Prepare Linux source

  1. Determine unRAID kernel version. After extracting bzroot, check /unraid/lib/modules for the kernel version used by the unRAID version you are installing
    e.g. You will see "3.9.11p-unRAID" when you extract the 5.0.3 version. This means kernel 3.9.11 and "p-unRAID" means "patched for unRAID".
  2. Get linux source for 3.9.11 and untar it in /usr/src. You may also want to try kernels that are more recent than those used in unRAID, but be aware in this case that unRAID will not have been validated against such a kernel,
  3. $ cd /usr/src
  4. $ wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.9.11.tar.bz2
  5. $ tar -xjf linux-3.9.11.tar.bz2
  6. Rename the directory linux-3.9.11 to linux-3.9.11-unraid
  7. Delete (rm linux) the existing linux symlink (if present)
  8. Symlink linux (ln -s linux-3.9.11-unraid linux)
  9. Confirm symlink is pointing to the right place (ls -la linux)

Copy the unRAID kernel config and MD source mods

  1. $ rsync -aIv /unraid/usr/src/linux-3.9.11p-unRAID/ /usr/src/linux
sending incremental file list
.config
COPYING
System.map
drivers/ata/libata-core.c
drivers/md/Kconfig
drivers/md/Makefile
drivers/md/md.c
drivers/md/md_private.h
drivers/md/unraid.c
drivers/scsi/mvsas/mv_init.c
fs/reiserfs/journal.c
fs/reiserfs/super.c

sent 2052526 bytes  received 247 bytes  4105546.00 bytes/sec

The System.map file isn't really needed but it will get replaced on the first kernel build anyway. Otherwise the rsync will copy all changes to the kernel source. Use of the "-I" option ensures that the files will be copied even if the kernel source is newer. Doing a comparison first could be enlightening but is outside the scope of this tutorial.

Modify the unRAID kernel 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 must be built into the kernel, and not left as modules.

"make localyesconfig" looks as your current hardware and enables the necessary drivers. It is not 100% perfect, but it works very well.

  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 localyesconfig (NOT RECOMMENDED; May strip out all of the unRAID setup from the .config file)
  6. $ make menuconfig
  7. Check the procesor type is correct for you system
    1. Processor Type and Features-->
  8. You have to include the drivers for unRAID.
    1. Device Drivers ---> Multiple Device Support ---> Multi-device support (unRAID) ---> [*] Multiple devices driver support (unRAID)
    2. Device Drivers ---> Multiple Device Support ---> Multi-device support (unRAID) ---> <M> RAID support
  9. You have to include (not as modules) drivers for the controller for your boot disk.
  10. Set the following to [*] and not as <M> by using the spacebar to change it:
    1. File Systems ---> Ext4 journalling file system support and ALL other filesystems on your boot disk, even if you are not mounting them. unRAID has them all built in now. If you want any support for other less common file systems (e.g. XFS) then you can add them as modules.
    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 ---> Serial ATA and Parallel ATA Drivers (* this first) ---> Make sure support is included for your needed hardware.
    4. Also select AHCI if you are using AHCI in your BIOS.
    5. Device Drivers ---> SCSI device support --> SCSI disk support unRAID has this as the default now.
    6. Device Drivers ---> SCSI device support --> SCSI CDROM support (if you want it)
    7. Device Drivers --> Network device support --> Ethernet driver support and check that support for your network card has been included.
    8. Executable file formats / Emulations ---> IA32 Emulation --> Include code to run 32-bit programs under 64-bit kernel (if you're building a 64-bit kernel)
    9. Device Drivers ---> Generic Driver Option ----> [*] Maintain a devtmpfs filesystem to mount at /dev
    10. Don't forget a mouse driver if you want to use a Linux GUI.
    11. Device Drivers --> Input Device support --> <*> Event Interface to be able to use plug-and play devices such as USB mice and keyboards.
  11. If you want to be able to use a bluetooth keyboard and/or mouse
    1. Networking Support ---> Bluetooth subsystem support --> <M> RFCOMM protocol support
    2. Networking Support ---> Bluetooth subsystem support --> <M> HIDP protocol support
    3. Networking Support ---> Bluetooth subsystem support --> Bluetooth device drivers ---> <M> HCI USB driver
  12. Save and Exit

If you have problems figuring out which drivers you need, 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_install
  4. $ make install
  5. $ 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.
  6. After your new kernel is booting properly, log in and run hdparm /dev/hda if you are using PATA drives (alternative command: hdparm -i /dev/sda) and make sure your boot drive is in DMA mode.

Once your new kernel is booting properly and your boot drive is in DMA mode (if using PATA drives), shut down and congratulate yourself.

Additional Device Drivers

Most of the time the you only need the device drivers that are supplied with the Linux kernel. However occasionally you may need to get more specialized drivers from the hardware vendor.

A good example of this is that if you are using an AMD processor with built-in graphics then you are likely to need the AMD driver if you want to be able to successfully run a X-based GUI.

Install 32-bit Compatibility (64 bit kernels only)

If you are using a 64-bit kernel then you need to install the 32-bit compatibility layer as unRAID is 32-bit. A discussion on this can be found in the forum: (http://lime-technology.com/forum/index.php?topic=5639.0).

To install multilib follow the instructions at http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:multilib

Copy unRAID scripts and executables

  1. Copy these differences to your Slackware system (Note, don't blindly copy paste these commands. Make sure that you are using either "cp -i" or "cp -n". It WILL cause problems down the road.
    1. $ cp /unraid/root/* /root -r
    2. $ cp /unraid/usr/local/* /usr/local -r
    3. $ mkdir /var/local
    4. $ cp /unraid/var/local/* /var/local -r
    5. $ cp /unraid/usr/sbin/* /usr/sbin -r
    6. $ cp /unraid/etc/samba/* /etc/samba -r
    7. $ cp /unraid/etc/unraid-version /etc/
  2. Plus you need these files (or merge their changes from stock into yours) from /unraid/etc/rc.d:
    1. $ cp /unraid/etc/rc.d/rc.samba /etc/rc.d/
    2. $ cp /unraid/etc/rc.d/rc.local /etc/rc.d/
    3. $ cp /unraid/etc/rc.d/rc.nfsd /etc/rc.d/
    4. $ cp /unraid/etc/rc.d/rc.ntpd /etc/rc.d/
    5. $ cp /unraid/etc/rc.d/rc.atalk /etc/rc.d/
    6. $ cp /unraid/etc/rc.d/rc.avahidaemon /etc/rc.d/
    7. $ cp /unraid/etc/rc.d/rc.avahidnsconfd /etc/rc.d/
    8. $ cp /unraid/etc/exports- /etc/
    9. $ cp /unraid/etc/ntp.conf- /etc/
  3. If you plan on using user shares, you may need to copy the following files (to their respective Slackware directories):
    1. $ cp /unraid/etc/rc.d/rc.fuse /etc/rc.d/
    2. $ cp /unraid/bin/fusermount /bin/
  4. Also copy the unraid php file otherwise you will get warning messages about undeclared constants on the console when the web access is used. A better solution will be to fix the unRAID scripts to not issue this warning with the more recent releases of php, but this is a longer term solution.
    1. $ cp /unraid/usr/bin/php /usr/bin/
  5. Also chmod +x each of the above scripts
  6. If anyone finds something else important, be sure to post it.

Copy additional libraries

  1. Libraries -- there may be more, but these are specifically used by emhttp:
    1. $ cp -pP /unraid/usr/lib/libdaemon* /usr/lib/
    2. $ cp -pP /unraid/usr/lib/libk* /usr/lib/
    3. $ cp -pP /unraid/usr/lib/libavahi* /usr/lib/
    4. $ cp -pP /unraid/usr/lib/libgssapi* /usr/lib/
    5. $ cp -pP /unraid/usr/lib/libcom_err* /usr/lib/
    6. $ cp -pP /unraid/usr/lib/libwbclient* /usr/lib/
    7. $ cp -pP /unraid/lib/libfuse* /lib/
  2. If anyone finds something else important, be sure to post it.
    1. This seems to be needed for smbd/nmbd
      $ cp -pP /unraid/usr/lib/libtevent* /usr/lib/

Test new kernel and drivers with unRAID

  1. Reinstall the unRAID USB stick (either registered or unregistered).
  2. Boot your new kernel from the hard drive. (Make sure you are not booting from USB... change your BIOS if necessary.)
  3. Log in
  4. Modify the web server php config file, either with the following command or with a manual edit
    • sed -i -e "s/^short_open_tag.*=.*Off/short_open_tag = On/" /etc/httpd/php.ini
    • manually edit /etc/httpd/php.ini and change the parameter "short_open_tag" to "On".
  5. Run emhttp -p 88. You should get error message “mkdir: cannot create directory `/boot/config/shares': Not a directory” ignore it for now.
  6. Open browser to your server on port 88... you should see unRAID control panel.
  7. Control-C to kill emhttp and move on to the next steps

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

If instead of the unRAID control panel you saw the following:

    <?=$pg['Title'];?>

then something went wrong with the edit of /etc/httpd/php.ini. Make sure the parameter "short_open_tag" is set to "On",:

Mount flash and symlink to config

  1. Add new line to /etc/fstab: "/dev/disk/by-label/UNRAID /flash vfat rw,noatime,nodiratime,umask=0,shortname=mixed 0 0"
  2. $ mkdir /flash
  3. Manually mount the flash with $ mount /dev/disk/by-label/UNRAID /flash
  4. Remove the symlink for /boot/config (rm /boot/config).
  5. Create symlink to /flash/config (ln -s /flash/config /boot/config)
  6. Run $ emhttp -p 88. You should get no errors this time.
  7. 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.
  8. Edit the go script on the flash, to run emhttp with -p 88.
    If you want to instead continue to use port 80 for administering unRAID, then instead you should edit /etc/httpd/httpd.conf and comment out the Listen 80 line so that Apache is no longer trying to use port 80..
  9. Control-C to kill emhttp and reboot.

Install drives and test

  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. 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.
  6. Configure your drives for unRAID, and start the array.
  7. 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
  8. Stop the array and reboot one last time.

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.

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.