Installing unRAID 5.0 on a full Slackware Distro
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.
- Make a Slackware 13.37 (or 14.0) DVD (http://www.slackware.com/getslack/)
- 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.
- Boot unRAID from USB and confirm functionality with your mobo, drives, and controllers.
- Save/print a copy of the syslog and dmesg output to help in identifying hardware when you make your own config.
- Save a copy of the output from these commands, to assist you in identifying the hardware in your system:
- lspci -v
- ethtool -i
- If migrating an existing unRAID server:
- Go to "Devices" page of unRAID control panel and PRINT OUT the list of devices.... you will need it later.
- Make a Slackware 13.37 (or 14.0) USB Installer using a new usb key
Install Boot Drive and Linux
- 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.
- 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.
- Boot Slackware DVD
- Use fdisk and create 2GB swap and otherwise partition the disk as you want it.
- Run the Slackware setup, and accept all defaults, except you should enable Apache, and use a static IP.
- 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.
- Reboot from the hard drive.
- Reconfigure your BIOS to boot from hard drive instead of flash.
- If using a PATA drive, run hdparm /dev/hda and make sure your drive can run in DMA mode.
- Make sure you can ping the new server.
- Make sure you can telnet to the new server.
- 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.
- Edit /etc/inetd.conf and uncomment the telnet server.
- Run kill -HUP 'cat /var/run/inetd.pid' to restart network services.
- 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.
- 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
- 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.
- Create lilo entry for alternative kernel for recovery if new kernel hangs
- $ ls -la /boot and see what file vmlinuz is linked to (probably vmlinuz-huge-smp-2.6.xx.x-smp)
- Edit /etc/lilo.conf and duplicate the linux boot section
- Changing the “image=” line to point to to the real file vmlinuz was symlinked to.
- 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-188.8.131.52-smp root = /dev/sdaX label = Linux read-only # Linux bootable partition config ends
- Save and Exit
- Run lilo -v (You may also have to run lilo -P ignore if you get errors here)
- Reboot and test alternative kernel entry to make sure it works.
Extract unRAID initramfs files from bzroot
- Decide where to store a copy of the unRAID distro. I use /unraid
- mkdir /unraid
- cd /unraid
- wget http://lime-technology.com/download/doc_download/31-unraid-server-version-50-rc8a-aio (be sure to use the latest version.)
- unzip *.zip bzroot
- 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
- Get linux source for 3.4.11 and untar it in /usr/src (RC8a was using kernel 3.4.11, adjust sources if desire). 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,
- $ cd /usr/src
- wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.4.11.tar.bz2
- $ tar -xjf linux-3.4.11.tar.bz2
- Rename the directory linux-3.4.11 to linux-3.4.11-unraid
- Delete (rm linux) the existing linux symlink (if present)
- Symlink linux (ln -s linux-3.4.11-unraid linux)
- Confirm symlink is pointing to the right place (ls -la linux)
Copy the unRAID kernel config and MD source mods
- $ cd /usr/src/linux
- $ cp /unraid/usr/src/linux-3.4.11-unRAID/.config .
- $ cd /usr/src/linux/drivers/md
- $ cp /unraid/usr/src/linux-3.4.11-unRAID/drivers/md/* .
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.
- Run lsmod and lspci and save the output to help you determine which drivers to put in the kernel later.
- $ cd /usr/src/linux
- $ make clean
- $ make oldconfig
$ make localyesconfig(NOT RECOMMENDED; May strip out all of the unRAID setup from the .config file)
- $ make menuconfig
- Check the procesor type is correct for you system
- Processor Type and Features-->
- You have to include the drivers for unRAID.
- Device Drivers ---> Multiple Device Support ---> Multi-device support (unRAID) ---> [*] Multiple devices driver support (unRAID)
- Device Drivers ---> Multiple Device Support ---> Multi-device support (unRAID) ---> <M> RAID support
- You have to include (not as modules) drivers for the controller for your boot disk.
- Set the following to [*] and not as <M> by using the spacebar to change it:
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.
- File Systems ---> DOS/FAT/NT Filesystems ---> NTFS file system support for NTFS support. May want to include write support as well.
- Device Drivers ---> Serial ATA and Parallel ATA Drivers (* this first) ---> Make sure support is included for your needed hardware.
- Also select AHCI if you are using AHCI in your BIOS.
Device Drivers ---> SCSI device support --> SCSI disk supportunRAID has this as the default now.
- Device Drivers ---> SCSI device support --> SCSI CDROM support (if you want it)
- Device Drivers --> Network device support --> Ethernet driver support and check that support for your network card has been included.
- 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)
- Device Drivers ---> Generic Driver Option ----> [*] Maintain a devtmpfs filesystem to mount at /dev
- Don't forget a mouse driver if you want to use a Linux GUI.
- Device Drivers --> Input Device support --> <*> Event Interface to be able to use plug-and play devices such as USB mice and keyboards.
- If you want to be able to use a bluetooth keyboard and/or mouse
- Networking Support ---> Bluetooth subsystem support --> <M> RFCOMM protocol support
- Networking Support ---> Bluetooth subsystem support --> <M> HIDP protocol support
- Networking Support ---> Bluetooth subsystem support --> Bluetooth device drivers ---> <M> HCI USB driver
- 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
- $ cd /usr/src/linux
- $ make
- $ make modules_install
- $ make install
- $ 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.
- 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
- 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.
- $ cp /unraid/root/* /root -r
- $ cp /unraid/usr/local/* /usr/local -r
- $ mkdir /var/local
- $ cp /unraid/var/local/* /var/local -r
- $ cp /unraid/usr/sbin/* /usr/sbin -r
- $ cp /unraid/etc/samba/* /etc/samba -r
- $ cp /unraid/etc/unraid-version /etc/
- Plus you need these files (or merge their changes from stock into yours) from /unraid/etc/rc.d:
- $ cp /unraid/etc/rc.d/rc.samba /etc/rc.d/
- $ cp /unraid/etc/rc.d/rc.local /etc/rc.d/
- $ cp /unraid/etc/rc.d/rc.nfsd /etc/rc.d/
- $ cp /unraid/etc/rc.d/rc.ntpd /etc/rc.d/
- $ cp /unraid/etc/rc.d/rc.atalk /etc/rc.d/
- $ cp /unraid/etc/rc.d/rc.avahidaemon /etc/rc.d/
- $ cp /unraid/etc/rc.d/rc.avahidnsconfd /etc/rc.d/
- $ cp /unraid/etc/exports- /etc/
- $ cp /unraid/etc/ntp.conf- /etc/
- If you plan on using user shares, you may need to copy the following files (to their respective Slackware directories):
- $ cp /unraid/etc/rc.d/rc.fuse /etc/rc.d/
- $ cp /unraid/bin/fusermount /bin/
- 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.
- $ cp /unraid/usr/bin/php /usr/bin/
- Also chmod +x each of the above scripts
- If anyone finds something else important, be sure to post it.
Copy additional libraries
- Libraries -- there may be more, but these are specifically used by emhttp:
- $ cp -pP /unraid/usr/lib/libdaemon* /usr/lib/
- $ cp -pP /unraid/usr/lib/libk* /usr/lib/
- $ cp -pP /unraid/usr/lib/libavahi* /usr/lib/
- $ cp -pP /unraid/usr/lib/libgssapi* /usr/lib/
- $ cp -pP /unraid/usr/lib/libcom_err* /usr/lib/
- $ cp -pP /unraid/usr/lib/libwbclient* /usr/lib/
- $ cp -pP /unraid/lib/libfuse* /lib/
- If anyone finds something else important, be sure to post it.
Test new kernel and drivers with unRAID
- Reinstall the unRAID USB stick (either registered or unregistered).
- Boot your new kernel from the hard drive. (Make sure you are not booting from USB... change your BIOS if necessary.)
- Log in
- 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".
- Run emhttp -p 88. You should get error message “mkdir: cannot create directory `/boot/config/shares': Not a directory” ignore it for now.
- Open browser to your server on port 88... you should see unRAID control panel.
- 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:
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
- Add new line to /etc/fstab: "/dev/disk/by-label/UNRAID /flash vfat rw,noatime,nodiratime,umask=0,shortname=mixed 0 0"
- $ mkdir /flash
- Manually mount the flash with $ mount /dev/disk/by-label/UNRAID /flash
- Remove the symlink for /boot/config (rm /boot/config).
- Create symlink to /flash/config (ln -s /flash/config /boot/config)
- Run $ emhttp -p 88. You should get no errors this time.
- 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.
- 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..
- Control-C to kill emhttp and reboot.
Install drives and test
- 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.
- Install all your drives.
- Watch your POST messages and see that all hard drives are appearing.
- Reboot and log in as root. Make sure you are booting from the hard drive, and not the flash.
- 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.
- Configure your drives for unRAID, and start the array.
- Test the drives by:
- Mapping from another PC and read from each one
- Run $ hdparm -tT /dev/xxx for each one
- Any problems that show up, probably mean you need to reconfig something in the kernel
- Stop the array and reboot one last time.
- Your system should autoboot from the HD, with the USB flash installed.
- Your go script from the flash should execute, and start emhttp... check syslog or dmesg if it doesn’t start.
- Open browser to your server on port 88... should see unRAID control panel and the configuration changes you just made should have been retained.
- 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.