Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ------------------------------------------------------------------------------------- #
- # Debian on LS-WVL #
- # ------------------------------------------------------------------------------------- #
- # I have a Buffalo LS-WVL. I bought it with drives, so it does NOT have NAND.
- # I wanted my NAS to have it's brains back, so I decided to install Debian. Then I
- # compiled a vanilla 3.8.3 kernel using patches by hato.
- # Credits
- # -------
- # * The Buffalo NAS-Central wiki: http://buffalo.nas-central.org/wiki/Debian_Squeeze_on_LS-WXL
- # * hato (http://forum.buffalo.nas-central.org/memberlist.php?mode=viewprofile&u=5411). Without
- # him this would not have been possible. Thank you very much!
- # Goal
- # ----
- # It all started with me wanting to run OpenVPN. I quickly found out that the stock Buffalo
- # kernel does not support tun/tap. And here it began.. If only they would've let that module
- # in. Here I tried my best to document my journey.
- # After this guide, you will have a LS-WVL running Debian Squeeze with a kernel 3.8.3 in RAID1
- # You will loose your Buffalo webinterface. If you like, you can replace it with webmin. You
- # will also loose LED indications, and you can also uninstall NasNavigator. Doesn't work either.
- # If you are planning on compiling the kernel after his guide, go ahead and open up the kernel compile
- # guide (Step 6) so you can read some notes you should be aware
- # I am assuming you are ALWAYS logging in as root (except instructed otherwise)
- # Liability and TFTP
- # ------------------
- # Everything you do is your own responsibility. Expect to brick your device several times
- # (I did, COUNTLESS times). But the LS-WVL HAS TFTP support! Here (http://pastebin.com/5sY24CTQ)
- # you can read how it's done. I promise you, it works.
- # You are expected to format all your partitions/drives. So save all your data somewhere else.
- # TFTP is described here: http://pastebin.com/5sY24CTQ
- # Files
- # -----
- # http://members.ziggo.nl/roodgoudzilver/lswvl/
- # * TFTP Boot - To unbrick your NAS (info: http://pastebin.com/5sY24CTQ)
- # * LSRecovery - To reset your linkstation to factory defaults
- (ONLY works when running stock firmware!)
- # * kernel/lswvl_config_by_hato.config - .config file to compile the kernel
- # * kernel/lswvl_support_and_mv-cesa_dma_3.8_x_x.patch - Patch to make the kernel compatible with LS-WVL
- # Further reading & sources
- # -------------------------
- # * vi - linux text editor: http://www.cs.colostate.edu/helpdocs/vi.html
- # * nano - another linux text editor: https://www.linux.com/learn/tutorials/325049:linuxables-introduction-to-the-nano-text-editor
- # * netconsole - log kernel printk messages over UDP: https://www.kernel.org/doc/Documentation/networking/netconsole.txt
- # * netcat for windows: http://joncraton.org/blog/46/netcat-for-windows
- # * screen - http://ss64.com/bash/screen.html
- # * mdadm cheatsheet - http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/
- # * http://forum.buffalo.nas-central.org/viewtopic.php?f=73&t=25941#p159615
- # * http://buffalo.nas-central.org/wiki/Debian_Squeeze_on_LS-WXL
- # Update 2013-04-13: Fan control works! See here: http://pastebin.com/ch7TuxED
- # ---
- # Preperation
- # -----------
- # I can suggest you set your router so that your NAS always gets the same IP address. This way,
- # it shouldn't get lost. I never lost my NAS this way.
- # Step 1: Root access
- # -------------------
- # Before we can start, you need root access to the NAS. If you don't have it, you can flash
- # Shonk's LS Series 1.64 mod1a firmware (here: http://forum.buffalo.nas-central.org/viewtopic.php?f=68&t=23603)
- # It is possible that you cannot enter the webinterface. I did not manage to reset the LS-WVL
- # to factory settings. I used an official Buffalo tool called LSRecovery.exe. After this, you can
- # login to the Buffalo Webinterface using admin/password.
- # Check if you have SSH. If not, telnet in. username: admin. password: password
- su
- passwd # change root password
- vi /etc/melco/info # Google for a guide on vi for linux.
- # Scroll down, find
- # TELNET=on
- # SSH=off
- # Change SSH=off to SSH=on save and
- reboot
- # Check if you can SSH the NAS using root (and the password you just changed). If all works, carry on!
- # Step 2: Configure RAID
- # ----------------------
- # Use the Buffalo Webinterface to setup the RAID. Login (admin/password), go to System -> Storage.
- # I am assuming we are using RAID1, if not do your homework because partitions will change.
- # Here is the trick. It takes around 980 minutes to sync RAID1. If I had to wait 980 minutes each time I
- # bricked my NAS, it would've taken me YEARS. So, we are going to interrupt the sync process:
- # Make sure the RAID is configured (The orange LED is blinking indicating it is rebuilding the array)
- # * Turn off the NAS using the switch on the back
- # * Remove drive 2
- # * Turn on the NAS using the powerswitch
- # The NAS will boot, the red error light will blink and the red bay light will turn on. This is good.
- # We now have a degraded array: it's missing one drive, but the /dev/md0 device exists but is only
- # addressing one drive (/dev/sda or /dev/sdb). Once we have the NAS up and running we will
- # use mdadm to add the second drive back to the array and let it rebuild.
- # more on this here: http://forum.buffalo.nas-central.org/viewtopic.php?f=77&t=28559&p=168261#p168261
- # Step 3: Prepare Debian Squeeze root filesystem (http://buffalo.nas-central.org/wiki/Debian_Squeeze_on_LS-WXL)
- # ----------------------------------------------
- # SSH to the NAS. Login as root, and you can stay in ~/
- wget http://ftp.us.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.46_all.deb
- dpkg -i debootstrap_1.0.46_all.deb
- which ar >/dev/null || ln -s /bin/busybox /usr/bin/ar # fix ar link
- mkdir debian-armel-rootfs
- debootstrap --verbose --arch armel squeeze debian-armel-rootfs http://ftp.us.debian.org/debian
- # This will take some time. When you see
- # I: Base system installed successfully.
- # debootstrap is done.
- # Copy kernel modules from stock kernel:
- cp /boot/initrd.buffalo debian-armel-rootfs/tmp/
- LANG=C chroot debian-armel-rootfs/ /bin/bash
- cd /tmp
- dd if=initrd.buffalo of=initrd.gz ibs=64 skip=1
- gunzip initrd.gz
- mkdir INITRD
- mount -t ext2 -o loop initrd INITRD
- cp -R INITRD/lib/modules/* /lib/modules/
- umount INITRD
- rmdir INITRD
- rm initrd*
- # Adding missing devices
- apt-get install makedev
- ln -s /sbin/makedev /dev/MAKEDEV
- mount -t proc proc /proc
- cd /dev
- mv .udev .oldudev
- MAKEDEV generic
- MAKEDEV md
- mv .oldudev .udev
- umount /proc
- # Edit /etc/apt/sources.list
- nano /etc/apt/sources.list
- deb http://ftp.us.debian.org/debian squeeze main
- deb http://security.debian.org/ squeeze/updates main contrib
- # Save and exit nano
- apt-get update
- # Install mdadm
- apt-get --no-install-recommends install mdadm
- # Ignore any errors. Update mdadm.conf
- exit # exit from chroot
- cp /etc/mdadm.conf debian-armel-rootfs/etc/mdadm/
- LANG=C chroot debian-armel-rootfs/ /bin/bash # back again
- # Configure locales
- apt-get install locales
- dpkg-reconfigure locales
- # Create /etc/fstab
- cat >/etc/fstab <<EOF
- # /etc/fstab: static file system information.
- #
- # file system mount point type options dump pass
- /dev/md2 / xfs defaults,noatime 0 1
- /dev/md0 /boot ext3 rw,nosuid,nodev 0 2
- /dev/md10 none swap sw 0 0
- proc /proc proc defaults 0 0
- EOF
- # Network: Edit /etc/network/interfaces to match your LAN configuration:
- # (We are assigning both eth0 and eth1, my NAS used eth1, but other NAS use eth0
- # and I am not able to figure out which one uses which one. AFAIK, it is indicated
- # in the Buffalo Web Interface on the left. Unable to check now, I already am at Squeeze)
- nano /etc/network/interfaces
- # We always want the loopback interface.
- auto lo
- iface lo inet loopback
- # DHCP for Ethernet connection
- auto eth0
- iface eth0 inet dhcp
- auto eth1
- iface eth1 inet dhcp
- # Example static IP setup: (broadcast and gateway are optional)
- # auto eth0
- # iface eth0 inet static
- # address 192.168.0.42
- # network 192.168.0.0
- # netmask 255.255.255.0
- # broadcast 192.168.0.255
- # gateway 192.168.0.1
- # Save file and exit nano
- echo "hostname" > /etc/hostname # Change hostname to something sensible (NAS for example)
- # Install SSHD
- apt-get install openssh-server
- passwd root
- mkdir ~/.ssh
- exit
- cp /root/.ssh/au* debian-armel-rootfs/root/.ssh/
- LANG=C chroot debian-armel-rootfs/ /bin/bash # back again
- nano /etc/ssh/sshd_config # Check that PermitRootLogin yes is uncommented
- # Prepare rootfs archive
- aptitude clean
- exit
- tar zcvf squeeze-armel-rootfs.tgz -C debian-armel-rootfs .
- # Now you have a complete rootfs for Debian squeeze armel. Put a copy of squeeze-armel-rootfs.tgz on
- # your computer (for example in nas/debian)
- # Step 4: Create an INITRD
- # ------------------------
- # These steps are literally copied and pasted from the 'Debian Squeeze on LS-WXL', they are just here
- # for the record.
- chroot debian-armel-rootfs/ /bin/bash
- apt-get install busybox
- apt-get install uboot-mkimage
- cd /tmp
- dd if=/dev/zero of=initrd bs=1k count=0 seek=3K
- mke2fs -F -m 0 -b 1024 initrd
- tune2fs -c0 -i0 initrd
- mkdir INITRD
- mount -o loop initrd INITRD
- mkdir -p INITRD/{bin,lib,dev,etc/mdadm,proc,sbin}
- cp -a /dev/{null,console,tty,sd{a,b,c,d}?,md*} INITRD/dev/
- cp /bin/busybox INITRD/bin/
- cp /sbin/mdadm INITRD/sbin
- cp /lib/{libm.so.6,libc.so.6,libgcc_s.so.1,ld-linux.so.3} INITRD/lib
- cat > INITRD/linuxrc <<EOF
- #!/bin/busybox sh
- # Mount the /proc and /sys filesystems.
- mount -t proc none /proc
- mount -t sysfs none /sys
- echo 'DEVICE /dev/sd??*' > /etc/mdadm/mdadm.conf
- mdadm -Eb /dev/sd??* >> /etc/mdadm/mdadm.conf
- mdadm -As --force
- # use /dev/md1 as root
- # echo "0x901" > /proc/sys/kernel/real-root-dev
- # use /dev/md2 as root
- echo "0x902" > /proc/sys/kernel/real-root-dev
- # use /dev/sda6 as root
- # echo "0x806" > /proc/sys/kernel/real-root-dev
- # use /dev/sdb6 as root
- # echo "0x822" > /proc/sys/kernel/real-root-dev
- # Clean up.
- umount /proc
- umount /sys
- EOF
- chmod +x INITRD/linuxrc
- umount INITRD
- gzip initrd
- mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n initrd -d initrd.gz initrd.buffalo
- gunzip initrd.gz
- mount -o loop initrd INITRD
- nano INITRD/linuxrc
- # Comment echo "0x902" > /proc/sys/kernel/real-root-dev
- # Uncomment # echo "0x901" > /proc/sys/kernel/real-root-dev
- # Save and quit
- umount INITRD
- gzip initrd
- mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n initrd -d initrd.gz initrd.buffalo.final
- rmdir INITRD
- # Exit the chrooted environment.
- exit
- # We have now created two initrd files:
- # initrd.buffalo - Temporary initrd
- # initrd.buffalo.final - Final initrd (Will be used forever!)
- # Make a copy of these two files on your computer! See next paragraph why
- # IMPORTANT
- # Make sure you have a copy of initrd.buffalo, initrd.buffalo.final and squeeze-armel-rootfs.tgz
- # on your computer. If you brick the NAS from here on, you will only have to do these steps:
- # * Unbrick your nas using TFTP: http://pastebin.com/5sY24CTQ
- # * Open the NAS (Enable SSH: Step 1)
- # * Copy initrd.buffalo, initrd.buffalo.final and squeeze-armel-rootfs.tgz to ~/
- # * Continue with Step 5!
- # If you do not perform these three steps, and your NAS bricks you have to prepare the whole
- # chroot again, and create the initrds again. Make a backup, and you can just use the
- # ones you just created :)
- # Step 5: Installation
- # --------------------
- # See here: http://pastebin.com/6nXswgf3
- # Step 6: Compiling the kernel
- # ----------------------------
- # See here: http://pastebin.com/9aKT3z3i
- # Step 7: Post-installation setup
- # -------------------------------
- # Now you have Debian Squeeze with 3.8.3 kernel. Last things:
- apt-get install ntp # NTP (keeps the clock in sync)
- dpkg-reconfigure tzdata # Configure timezone
- apt-get install sudo less usbutils bzip2 mc linuxlogo psmisc # Useful packages
- # Webmin
- wget http://prdownloads.sourceforge.net/webadmin/webmin_1.620_all.deb
- apt-get install libnet-ssleay-perl openssl libauthen-pam-perl libio-pty-perl apt-show-versions libapt-pkg-perl
- dpkg -i webmin_1.620_all.deb # On my NAS, this took nearly 10 minutes
- # For more information, see http://buffalo.nas-central.org/wiki/Webmin_to_remotely_administer_your_LinkStation
- # Cleaning up (You can choose to keep or move these files yourself)
- rm lswvl_config_by_hato.config # kernel .config file
- rm lswvl_support_and_mv-cesa_dma_3.8*.patch # lswvl patch for kernel 3.8
- rm webmin_1.620_all.deb # if you installed webmin, you don't need this anymore
- # Step 7: Recontructing the RAID array
- # ------------------------------------
- # Last thing we have to do, get the RAID array back together.
- # See here: http://pastebin.com/pWWrkzQB
- # Final notes:
- # ------------
- # This guide was created by VolleMelk. As stated before, I only gathered all the guides and information
- # I used for my own NAS. Credits where credits are due. Any questions? I can recommend
- # http://http://forum.buffalo.nas-central.org/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement