Warning: include_once(/home/winit/hackedpotatoes.com/wp-content/plugins/wordsocial/wordsocial.php): failed to open stream: Permission denied in /home/winit/hackedpotatoes.com/wp-settings.php on line 303

Warning: include_once(): Failed opening '/home/winit/hackedpotatoes.com/wp-content/plugins/wordsocial/wordsocial.php' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/winit/hackedpotatoes.com/wp-settings.php on line 303

Warning: Cannot modify header information - headers already sent by (output started at /home/winit/hackedpotatoes.com/wp-settings.php:303) in /home/winit/hackedpotatoes.com/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 60
Flashing OpenWRT to the NSLU2 (Teh Slug) «
19Apr/115

Flashing OpenWRT to the NSLU2 (Teh Slug)

 

Need a small, silent Linux server that sips power? A friend of mine gave me a Linksys NSLU2, which was designed to be a simple NAS. They run Linux out of the box, and can be flashed with customized distributions. NSLU2-Linux is the home of everything, uh, NSLU2 Linux. I chose OpenWRT for mine, because it seemed simple and popular. More on flashing the Slug (Eww!) after the break!

First, download the image. The newest stable release right now is Backfire, 10.03. You can download it here. If you want to see what else is available, check out the downloads section on the OpenWRT website. Look for the "ixp4xx" subdirectory. The correct image is labelled openwrt-nslu2-squashfs.bin.

If you are using Ubuntu (yeah, I know, I like easy):

sudo apt-get install upslug2

For simplicity and reliability, I prefer to use a crossover cable and connect my netbook directly to Teh Slug. Get your computer into the same address range:

sudo ifconfig eth0 192.168.2.1

Now, you'll need a paperclip. Hold in the reset switch and the power button simultaneously. After a moment, the status led will alternate green and red, indicating that Teh Slug is in update mode. As soon as the light starts alternating, you can let go of both the power switch and the reset button. Flash your downloaded image:

cd Downloads #That's most likely where your image is

sudo upslug2 -i openwrt-nslu2-squashfs.bin #Don't forget to use Tab to autocomplete

Cross your fingers and watch the progress bar. I've reflashed multiple times and never had anything go wrong at this point. Now:

telnet 192.168.1.1

You should see a shell, as well as a recipe to mix a Backfire. Now, change the password for root.

passwd

This automagically disables Telnet (which is exceedingly insecure) and enables SSH. Close the Telnet session and SSH back in.

exit

ssh root@192.168.1.1

This is optional, but my guess is that you aren't using Teh Slug as a router, so you probably want to change your IP address to something that won't clash with your router. We don't have nano yet, so you'll have to use cat. Dun dun dun!

cat > /etc/config/network

config interface loopback

option ifname lo

option proto static

option ipaddr 127.0.0.1

option netmask 255.0.0.0

config interface lan

option ifname eth0

option proto static

option ipaddr 192.168.0.2

option netmask 255.255.255.0

option gateway 192.168.0.1

Every time you press enter to finish a line, you can't go back, so be careful. I never get it right the first time. Press Ctrl + D to close the file. Reboot Teh Slug.

reboot

exit #Rebooting doesn't automagically end your SSH session, so I like to rattle of this command real quick before it hangs

Give Teh Slug a moment, and SSH back in.

ssh root@192.168.0.2

The last thing I like to do is install nano, because I hate vi and cat. I like easy, remember?

opkg update

opkg install nano

As you can see, opkg works pretty much like apt-get. The biggest difference is you need to run opkg update after every reboot, if you want to make changes.

The last thing you need to know about OpenWRT is LuCI. Open up your favorite web browser, which really should be Google Chrome, and go to:

192.168.0.2

Just like a normal router or Teh Slug in stock form, you have a nice, web-based configuration page to work with. It's a bit geekier than usual, but it can save you some hassle if you aren't very familiar with the command line.

Congratulations, you  are done! You know have a silent Linux box that sips power. Coming soon, use Teh Slug as a DynDNS updater and mini-webserver!


  • Pingback: HackedPotatoes.com » Dynamic DNS on the NSLU2()

  • Cybercrawlspace

    Great post! I flashed my slug so I could (hopefully) install asterisk. I had success all the way up to doing the update. “opkg update”
    I get:

    Downloading http://downloads.openwrt.org/backfire/10.03/ixp4xx/packages/Packages.gz.
    wget: bad address ‘downloads.openwrt.org’
    Collected errors:
    * opkg_download: Failed to download http://downloads.openwrt.org/backfire/10.03/ixp4xx/packages/Packages.gz, wget returned 1.
    root@OpenWrt:~# opkg update

    I am guessing I need to change the source but don’t know how. I would like to have nano as well. I’m half a noob with linux.

    Thanks again!

    • Cybercrawlspace

      I am a noob. It cannot resolve outside of the network. How do I add DNS entries?

      • Cybercrawlspace

        I got it – I had to vi /etc/resolv.conf and add a nameserver. it doesn’t seem to stick long though. I did manage to install nano.

        • Badger32d

          Glad you got it working! dns seems to not stick around after reboots, so

          echo “nameserver 8.8.8.8” >> /etc/resolv.conf

          is always a good way to get it back. Remember that after each reboot you have to opkg update to refresh the db as well. Happy hacking! –@badger32d

  • http://profiles.google.com/echomrg echo mirage

    hi, sorry to bother you on such an hold post but i’ve trying to flash openwrt to a NSLU2 for the last couple of days and it’s starting to feel like i’m bashing my head on a wall 😉
    i think i managed to flash the openwrt firmware correctly (i’m using 10.3.1) but i can’t connect to the device:
    i tried both connecting the NSLU2 to a switch and directly to my computer. when i try to telnet (or ping) the device on 192.168.1.1 or 192.168.1.77 it doesn’t respond and when i connect it to the switch it doesn’t show up on the DHCP table.
    when i boot the NSLU2 it flashes al the leds and the shows only the ethernet led.

    any help would be REALLY appreciated!
    Thanks in advance!
    Marcello