After installing Debian NSLU2 on usb thumbdrive, there are still a few things to do before I got a fully functional slug ready to be adapted to do whatever I wanted.
First boot
By default, the slug will beep three times to signal that the boot has been completed and the slug is ready for ssh login. However, sometimes the first boot might take longer than usual. If you don’t have the internal serial port hack, you might be left scratching your head what is taking the slug so long to be ready.
If you do have a serial port connected to a hyperterminal, you could observe the boot messages. Most likely, the real time clock (RTC) of the slug has been reset to default date. This could happen if you accidentally touch the wrong place on the slug board, while messing with the hardware. Since, the time stamp of the root partition is now far in the future compared to the system clock, fsck will automatically run. This is what caused the long boot time.
Therefore, the first order of business after first boot is to check and set the correct date. You would have to do this anyway before running apt-get update, else it will give you “gpg authentication error”.
The command to set the date is
sudo date [MMDDhhmm[[CC]YY][.ss]]
-
where
- MM is the month
- DD is the date
- hh is the hour
- mm is the minute
- CC is the century
- YY is the year
- ss is the second (optional)
E.g. to set the date to June 14, 12:23pm, 2008:
sudo date 061412232008
Also, check the time zone with this command.
sudo tzconfig
Note: during the Debian installation, you should be asked which authentication method to use. I chose sudo based authentication, rather than root user.
Before proceeding any further, update the slug
sudo apt-get update && sudo apt-get upgrade
Install NTP
If you are lazy like me and would like the slug to synchronize the time automatically, install ntp.
sudo apt-get install ntp
Debian/NSLU2 FAQ
This webpage gave a few excellent tips on what to do next.
First, dump the flash image to a file.
cat /dev/mtdblock* > image.bin
Then, copy the image from the slug to your local PC using scp command.
scp user@ipaddr:/dir/image.bin image.bin
-
where
- user is the username of the slug
- ippaddr is the IP address of the slug
- /dir/image.bin is the directory and filename of the image file
What can you do with this image file? For a while, I was confused about this, because I couldn’t find any good explanation for it. However, I did some experiments, and discovered this image file is the same file used by the upslug2 command.
Boot the slug into flash update mode. Then, in your local PC terminal, try this.
sudo upslug2 -v -i image.bin
This command compare the image file with the slug flash. The verification should succeed without error. Therefore, if you accidentally corrupt the flash contents, you can write this image file to the slug using upslug2 command to recover.
Change the power button behavior to shutdown
The other thing you might want to do is change the behavior of the power button to shutdown, instead of restart. This is also described in the Debian NSLU2 FAQ.

Comments 22
Thanks for the info about setting the time.
Posted 23 Nov 2008 at 5:39 am ¶I’m looking forward to reading posts on your future progress.
hi Allen
Posted 23 Nov 2008 at 8:50 am ¶Thanks for reading my blog and leaving a comment.
No problem

Posted 24 Nov 2008 at 9:21 am ¶So far, I’ve had much success setting up my SLUG with Debian. I’ve managed to add 4 more drives (a total of 1700GB) and setup a SAMBA server for them. I’m not really amazed at the transfer rates (drive to drive averaged around 900k/sec – that doesnt seem right) however if I can get this to be a media server then i’ll be happy. I originally installed to a 40GB USB drive, but I just used Gparted in Ubuntu to copy the partitions over to a teeny-tiny 4GB microSD card with a USB reader that is about the size of the top of my pinky finger. I’ve reduced swappiness, and i’m currently looking to streamline the startup with rcconfig, but I can’t remember the website I originally saw the info on
Once I get the webserver setup, I’ll start posting my progresses to the web.
Thanks again for the info, looking forward to more!
Just going through debian install onto a 40GB laptop drive on USB2 port. Chose export mode, checked support for ATA drives (which I’m wondering if that was a mistake now) and it’s been many hours. Currently am on the “Configuring selinux-policy-default” screen. It’s been stuck at 81% over 4hrs. I’d hate to abandon it but am starting to seriously doubt it’s success. I realize it’s swapping to drive since there’s only 32MB mem. I’ve managed to get it to 266MHz . So, the question… do I go to bed and see what happened in the morning or is it in some loop ? The HD is definately working but am getting concerned it’ll “burn-out”
Help! Suggestions please.
Posted 07 Dec 2008 at 1:01 pm ¶Ok, finally. The patience paid off. I’m now at 87% – configuring nfs-kernel-server. Still, not sure why this install is this slow from what I’ve read out there. Wish me luck
Posted 07 Dec 2008 at 1:14 pm ¶hi Darko
Thanks for stopping by and commenting. Sorry I wasn’t watching the blog when you posted and did not respond promptly.
For future reference, this was what I found out about the speed of USB1, USB2 and USB3 ports. I monitored the speed by dumping 100MB into the external storage.
$ sudo apt-get install pv
$ dd if=/dev/zero | pv | dd of=test.img
The hardware (running Debian NSLU2) has been modified so that USB1 is an internal port, Disk1 is USB3 and Disk2 is USB2.
USB1 port:
USB thumbdrive: 903kB/s
USB2 port:
USB thumbdrive: 592kB/s
USB harddrive: 603kB/s
USB3 port:
USB thumbdrive: 919kB/s
USB harddrive: 942kB/s
Unfortunately, you were using USB2, which is the slower port on an already slow hardware.
Posted 07 Dec 2008 at 7:48 pm ¶No problem. Thanks for reply though. I thought/was under impression if I needed/wanted to add a usb hub with additional fat32/ntfs drives for media, I needed the main sys on usb2. I guess i need some direction now as I’d hate to start all over… objective:
main system on usb 2.5″ laptop drive (currently in usb2)
here’s my mounts:
cat /proc/mounts
rootfs / rootfs rw 0 0
none /sys sysfs rw,nosuid,nodev,noexec 0 0
none /proc proc rw,nosuid,nodev,noexec 0 0
udev /dev tmpfs rw,size=10240k,mode=755 0 0
/dev/sda2 / ext3 rw,noatime,errors=remount-ro,data=ordered 0 0
tmpfs /lib/init/rw tmpfs rw,nosuid,mode=755 0 0
usbfs /proc/bus/usb usbfs rw,nosuid,nodev,noexec 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,gid=5,mode=620 0 0
/dev/sda1 /boot ext2 rw,errors=continue 0 0
nfsd /proc/fs/nfsd nfsd rw 0 0
I’d like to add the usb hub (powered) to usb1 and try adding fat/ntfs (or ext2 if necessary) to hub but hate to cause a problem. I read somewhere where the order of usb assignments can be random and thus need to be “forced”/modified to prevent the randomness. Any help or pointers/suggestions are appreciated if you know.
Thanks
Posted 14 Dec 2008 at 2:39 am ¶Sorry, last comment… make that fat32. Actually, any recommendation on format for best performance and flexibility to interchange with windows..
Posted 14 Dec 2008 at 2:44 am ¶hi Darko
USB1 port has “higher” priority than USB2. So, if you were to put root partition in USB2, and reboot with another disk in USB1, the /dev/sda assignment will change for USB2 to /dev/sdb. The kernel would not be able to find the root partition at it’s original /dev/sda. In other words, it will not boot when there is a disk in USB1.
A way around that is to change from /dev/sda to UUID, though I don’t know offhand how that could be accomplished in Debian NSLU2 system.
As for data sharing with Windows, I always prefer FAT32, since it has been supported by Linux for many years. The only downside is it cannot store files larger than 4GB.
Posted 14 Dec 2008 at 3:01 am ¶One more thing. I don’t think you need to start over. Just move the disk you install on from USB2 to USB1. Then, it will always appeared as /dev/sda.
Posted 14 Dec 2008 at 3:07 am ¶Thanks again. I’m treading cautiously as the initial install took forever as I now know why. Then what you’re saying is switching my main sys from usb2 to usb1 should be plug’n'play ? Then if so, adding a usb hub with attached drives for my media storage would get lower priority and thus probably lower performance ?
Although your recommendation to use UUID sounds familiar to what I’ve read and may be able to keep the main boot sys on usb2 if my ultimate goal is to set this up as a media server with best possible performance.
Just a general question… am I wasting my time ? I thought with the low power consumption of nslu2, and because we can, this is a doable task. I like the thought of debian for reason outlined by others.. spindown and flexibility. Doesn’t cost much other than time
… and yes, also, because we can
Or are there better low power alternatives out there (keeping cost down) Also, now that i have the nslu2, I just want to max it usefulness.
Thanks.
Posted 14 Dec 2008 at 3:21 am ¶I think this is where I got my intial impression about usb1 vs usb2
http://www.nslu2-linux.org/wiki/Unslung/R63DiskBehaviour
although it’s unslung not debian
Posted 14 Dec 2008 at 3:26 am ¶Ok, I think this is what I need to do but was shy to try it without understanding it.
http://www.nslu2-linux.org/wiki/HowTo/MountDisksByLabel
Any experience with this ? What’s the worse that can happen ? I take a backup of my image and reflash it if necessary ? Right ?
Posted 14 Dec 2008 at 3:46 am ¶hi Darko
Yes, it should be “plug ‘n play”. If you are worried about reinstall issue, do what I did: keep a disk dump of the entire root partition. You can do this in a PC using “dd” command.
If you refer to my earlier post on this category, I made the hardware hack to use the additional internal USB3 port. This would be the best solution for you requirement, since you get two higher speed ports (USB1 and USB3). Though, I’m not sure whether you are confident in modifying the hardware.
Personally, I am using the slug as more of a “toy”, to play around a Debian system; I have yet to find a real use for it (unless you counted when I originally bought and used it for: as a home file server using the original Linksys firmware).
I am not really familiar with alternative device. But if you are really looking a workable low power alternative, a cheap netbook (e.g. eeePC) could easily fill that role. Perhaps, install Ubuntu on it; it’s a lot easier to work with.
I have not personally tried the UUID method. Looking at the howto you linked, it appeared to be non-trivial. Writing to the flash is always risky, but the risk would be minimised if you backup the flash, and perform a verification of the backup before proceeding.
Posted 14 Dec 2008 at 4:13 am ¶Thanks again for the prompt responses…
see here as well…
http://jbcobb.net/?p=43
good blog.
.. and yes, it is still somewhat as a toy
so I’m more in it for the education. eeePC’s are still more expensive toys for me at the moment but am keeping an eye on them.
So just did a reboot with my main / in usb1 and attached a powered usb hub into usb2 and noticed it providing power to my nslu2 so quickly unpowered the hub. Then powered on the nslu2…heard the beeps
saw all usb ports lit up…
Did the UUID method. All looks well. Seem to be able to interchange between usb1 and usb2. Am now using ntfs-3g to attach ntfs drives. Need to figure out security and userid mappings, etc..
Posted 14 Dec 2008 at 10:07 am ¶So I’m trying to figure out which usb port to use for my boot hd (20gb port 2.5″ drive) and the usb 2.0 hub for my media files. Doing dd read/write tests show boot drive on USB Disk 1 are approx 5x faster but the dd tests on attached ntfs-3g mounted 3.5″ 300gb drive are approx same with both usb ports… ie 15.6 MB/s on reads but only 1.4 MB/s on write on either USB1 or USB2 ports. I should verify that the hub isn’t getting in the way but ntfs-3g does seem to indicate poor write performances….. so, any way to same me some time here ? Should I scrap the ntfs and use ext2 on which usb port ? If you know, please advise. Thanks.
Posted 15 Dec 2008 at 12:01 am ¶hi Darko
Posted 15 Dec 2008 at 12:27 am ¶Sorry, I don’t use NTFS for at least a year now, since I switched completely from Windows to Linux. Can’t help you there.
I’m getting the sence to stay away from ntfs altogether for this device. Perhaps ext2 to avoid the overhead of ext3 ? Again, just trying to max the performance of what I can of this device. So, let me rephrase, assuming you know, … how would you config this device for max throughput having 1 20gb 2.5″ boot drive, 1 usb 2.0 hub and 1 or more external attached to usb hub drives (format ? – ext2, fat32, etc). Only consideration would be the desire to unplug external drives an mass load them once in a while from faster pc (win or linux – linux perhaps via vmware within vista (yeah, I know
) I still need windows in many ways.
So, 20 gb boot on usb 2?
hub on usb 1 ? External drive(s) – ext 2 to hub
Is that the best it can get ?
Thanks
Posted 15 Dec 2008 at 12:53 am ¶hi Darko
Again, my apologies since I have never been too concern about disk I/O on the slug, and have not run extensive testing on it. In my own speed test of sequential write to disk (dd command write to a blank disk), USB1 appeared to be faster than USB2. That’s as far as I went, and I did not test read speed as well.
However, if I am faced with the same doubt, I would let the data disks I/O be as fast as possible. The root partition would only be sparingly used after the device has booted up, so it won’t be a bottleneck in overall speed.
In other words, do the test with a ext2 or ext3 formatted disks for read and write to compare USB1 and USB2. Even so, I am not sure how representative the results would be in practice.
See here for an example of some attempt to benchmark file systems.
http://linuxgazette.net/102/piszcz.html
http://www.debian-administration.org/articles/388
If I am reading these pages correctly, the answer to which file system is faster is… it depends.
Posted 15 Dec 2008 at 1:46 am ¶Do you have your swap running on your pen drive?
Probably a bad idea if you do — You probably know already, but for those reading this page who don’t, writes are limited on flash media and will shorten life-span. Admittedly, max number of writes is high, but if you’re going to swap all the time, as you’re likely to do on a slug, it’s not healthy.
Just pondering a re-install of my slug to Lenny running on a pen drive. Currently got it going on a 20Gb hard drive but there’s no point given that it’s only doing DNS, DHCP and acting as an SSH tunnel to get in from work.
Posted 08 Feb 2009 at 12:53 am ¶hi Andrew, thanks for the reminder.
I did have the swap in the thumbdrive. However, I provided a link in “Debian NSLU2 post-install part 2″ (see related posts, above) on how to change the “swappiness”; essentially reduce the tendency for memory swapping to occur.
Posted 08 Feb 2009 at 11:15 am ¶Use port 1 for USB drive with /
Posted 18 Apr 2009 at 11:06 pm ¶Use port 2 with self-powered USB hub (now you do not need the ac power adaptor since the NSLU2 gets USB power)
Use UUIDs (not dev/sdx) in fstab and menu.lst and will never have a problem getting devices mixed up when puugging in additional drives and re-booting
Post a Comment