NSLU2-Linux
view · edit · print · history

Using OpenSlug

After loading the flash image into your NSLU2 the box will reboot. Eventually the ready/status LED will be solid green. At this point you can log in using ssh (this is the only way of logging in initially.) You must log in as root. The default name of the NSLU2 is on the MAC Address label on the bottom of the box. Of course you can also use the IP address. The initial password is opeNSLUg.

Note: If not using Windows, you can ping -b 192.168.1.255 to determine the device's new IP address. Alternatively, check your DHCP server's client table. Installation over stock firmware will use DHCP if available, otherwise defaulting to 192.168.1.77

When OpenSlug is first booted a small amount of initialisation is required. Simply follow the instructions displayed when you first log in. These instructions say to run the command turnup init - this command prompts for information and setups up the root password and network. If you have a DHCP server on your network you may use dhcp as the boot protocol, not static (which is the default). Static has the advantage that you are always very sure about the IP address (which might be handy if things are not working). DHCP is convenient if your slug moves from network to network or if your network is big. With some DHCP servers you can make a reservation and make sure that a specific MAC address always gets the same IP address. DHCP servers in simple routers sometimes do not support this feature.

Note: OpenSlug 3.10 and later versions will correctly detect the MAC address, so the following observations are no longer true. Note: The MAC address of the Slug may change after flashing. If you are using the above DHCP reservation technique you will have to determine the new MAC address in order to make the reservation work again after flashing. It seems that the first three octets of the MAC address (the Organizationally Unique Identifier - OUI) change from the Linksys identifier to something new (reserved by the OpenSlug team???). If you do use reservations, make sure that you also have leases available so that the re-flashed Slug will get a new IP from your DHCP server. You should then be able to either check your DHCP server lease file or ping your gateway to determine the new Slug IP address. You will then need to update the MAC address in your DHCP reservation to get the Slug back to the IP address you want it on. Note that if you put the Slug into upgrade mode again it seems to revert to the original Linksys MAC address. If you are using reservations and think that you may be reflashing your Slug frequently using upgrade mode, it may be prudent to assign each MAC address to a unique IP address in your DHCP configuration file. The above behaviour was observed in flashing the OpenSlug-2.7-beta binary. Note: The MAC address change is performed each reboot from /etc/network/interfaces, which explains why upgrade mode still use the original MAC address.

Further initialisation is optional - it depends very much on what you want to do with OpenSlug. turnup help gives some help. Some of the steps you can follow are:

  1. Run turnup init to set the new root password and confirm network setup. After that, do a turnup preserve to save your new configuration.
  2. You will need an external hard disk or flash card for OpenSlug. Plug in your disk, check that it was recognized looking at the kernel messages with dmesg and use fdisk to create a partition on your destination disk. Consider making a swap partition as well. See InitialisingDisks if you are not familiar with fdisk on a Linux machine. After creating your new partitions you must reboot the slug before trying to initialize the new partitions. Use shutdown -r now to reboot and remember to login using the new root password you set with turnup init.
  3. If you created a swap partition, prepare it with mkswap <SWAP PARTITION> and start using it with swapon <SWAP PARTITION>.
  4. Format the new root partition using mke2fs -j <DEVICE> to create an ext3 filesystem on it.
  5. Run turnup disk -i <DEVICE> -t ext3 to create a root filesystem on the external disk. (Or turnup memstick -i <DEVICE> -t ext3 if you are using a flash disk.)
  6. Reboot to the new disk partition.
  7. Install packages and configure the NSLU2.

Please note that <DEVICE> should be /dev/sda1 (first partition from the disk connected to USB port 1) or /dev/sdb1 (first partition from the disk connected to USB port 2). The <SWAP PARTITION> will probably be /dev/sda2 or /dev/sdb2.

Of course you can also use an existing disk. E.g. if you used your disk before with unslung you could create an additional root partition (probably after resizing the existing partition first). That way you can skip the formatting step (5). There is no need that the partition is /dev/sda1. However the current version only supports minor numbers up to and including 4. E.g. using /dev/sda5 does not work in 2.5beta. This will probably be fixed in a later release.

Note: in OpenSlug 3.10 beta the disk leds do not turn on or flash when there is a disk attached. No lights. Just the power and ethernet leds work.

Most of these steps are standard administration operations. Those which use turnup, however, are NSLU2 specific. turnup exists to capture NSLU2 specific aspects of system setup in one place. It's a shell script, you can load it into an editor and see what it does. It even contains comments. Further details on using turnup are on the OpenSlug.OpenSlugTurnUp page.

Note that the basic OpenSlug install includes the vi editor.

Further details

At present this page is incomplete. No one really knows how OpenSlug will be used, so the information required for the typical user is difficult to determine. The rest of this wiki contains a vast amount of information relevant to OpenSlug. Much of the information gained from Unslung has relevance for OpenSlug.

What follows is basic information about how to configure an NSLU2 before turnup disk - in other words what can be, what should be, and what should not be done to the flash file system.

The flash file system is both a recovery file system - it works even if something goes wrong with the root file system on the disk - and a prototype file system. What is on the flash is copied to a new rootfs by turnup - so stuff necessary to be able to boot into a different root file system should be on the flash file system.

Avoiding turnup init

If you wish to set up the password and network yourself the message displayed on log in can be eliminated by removing /etc/motd. turnup init will do this when it is run. Network setup is concentrated in /etc/network/interfaces, but there is a hand-crafted script for udhcpc which ensures that the network is set up with the default (Linksys) static address 192.168.1.77 if DHCP fails.

Other options to turnup

The root file system doesn't have to be on a disk.

  • turnup nfs instead of turnup disk will allow you to run the machine without a disk, using an NFS export on another machine (see turnup help). It just works, but you need to know how to set up the NFS export correctly, using the rw,no_root_squash options. If you have any problems you can insert the line 'exec 2>>/boot.log >&2' into /boot/nfs and check /boot.log the next time it comes up. If it shows something like SIOCSIFNETMASK: Invalid argument, you probably have wrong subnetmask which results in broadcast failures and thus a nonworking nfs-root. With such a misconfiguration the nslu2 might hang while booting and showing a solid amber led.
  • turnup memstick is very similar to disk but it retains the RAM file systems to avoid putting frequently changing files on a USB flash device.

Package installation

It is essential to change the root file system before doing any package installation. There is insufficient space on the flash file system for any significant amount of package installation.

It is possible to install one or two very small packages - such as ntp - and it may be necessary to install some packages (such as openldap) to make the NSLU2 work properly in your network. Be very careful if you choose to do this - be prepared for package installation to fail.

If you have to run ipkg update to install files try to delete the downloaded information afterward. It is better to install the packages you require by copying them to /tmp and using ipkg install <file>. This avoids the overhead of downloading all the package information.

If you want to use your NSLU2 as a fileserver for Windows machines, probably one of the first things you want to do after initialising is to install and configure Samba. If you are not very familiar in that area consult GettingStartedWithSamba.

Gaining space on the flash file system

If you reboot the system when the flash is full or close to full the NSLU2 will not be able to boot at all and you will have to reflash the image using UpSlug.

Once initialisation is complete you should remove /boot/zImage* from the flash file system. This removes the kernel image which releases about 800kbytes in the flash partition. This provides some extra space to ensure that the system will be able to reboot. Actually this is only an issue if your root filesystem is very small (e.g. because it is on a memory stick)

NOTE: (teg update) If you want to delete anything from the internal flash filesystem, you must "remount" it as "read/write" using the following command:

 'mount -t jffs2 -o remount,rw /dev/mtdblock4 /initrd'

Then you can:

 'rm /initrd/boot/zImage*'

Remounting "RW" is also necessary if you accidentally run ""ipkg"" without an external root filesystem, and want to remove the files ipkg created, e.g. the big ones in ""/initrd/usr/lib/ipkg/""

Page last modified on February 04, 2008, at 07:24 PM