Saturday, January 5, 2013

Howto: Setup a Sylvania SYNET07 Netbook with Linux


I recently picked up the Sylvania SYNET07 ARM-based 7" netbook from DailySteals for $40.  This is the same netbook that CVS as well as other convenience stores sell for $70-$100.  It came with Windows CE, although it is available with Android as well.  I figured that for $40, I could throw Linux on it, and use it as a portable, pocket sized hack laptop. Some people seemed to have some success getting Linux on it.  I can't afford a MacBook Air right now, so this will have to do for uberportable hackbox.  I ordered the red one, because why not.

I first decided to try out the latest Windows CE and Android on it before sticking with Linux. Windows CE booted super fast, but it was mostly unusable.  IE was sluggish, YouTube app didn't work at all. Android took longer to boot, and seemed to work ok, but the marketplace was empty for it, so no additional apps could be added, which made it kinda useless.

Next, it was Linux time!  Most of this follows this procedure, but with some additional changes.

Card Setup

The first thing to be done was to prep the SD card.  I had spun up a Linux box recently, so I'll be using that to prep the SD card.  I plugged it in and noticed from dmesg that it showed up as /dev/sdb.  I used "fdisk" to create two partitions on the card.  First is a 250 meg FAT-16 partition, then a 7.5 gig (? whatever filled the rest of the card) Linux/EXT3 partition.  I then formatted the partitions:

    sudo mkfs.msdos -F 16 -n FAT250 /dev/sdb1
    sudo mkfs -t ext3 /dev/sdb2

Then mounted them in /mnt:

    cd /mnt
    sudo mkdir fat
    sudo mkdir linux
    sudo mount /dev/sdb1 fat
    sudo mount /dev/sdb2/ linux

I had downloaded the two files provided at the above link, which I've mirrored here:  [fatpart.tgz] [extpart.tgz]  I then extracted these to the newly formatted SD card:

    cd /mnt/fat
    sudo tar -zxvf ~/fatpart.tgz
    cd /mnt/linux
    sudo tar -zxvf ~/extpart.tgz

The card is now bootable in the Sylvania netbook.  I like to make a few tweaks from here though; namely changing the hostname, and prepping the pacakge system to actually work as expected.

   cd /mnt/linux/etc/apt
   sudo vi sources.list  -- change "ftp.au.debian.org" to "ftp.debian.org"

   sudo echo "newHostName" > /mnt/linux/etc/hostname


   sudo mkdir /mnt/linux/var/log/apt/


Now, we'll disconnect the SD card:

    cd /mnt
    sudo umount fat
    sudo umount linux

First Boot, Package Installation

Next, put the SD card into the netbook, and press the power button to turn it on.  It will boot to a linux prompt.  Log in as root, no password.  Plug the netbook into a network connection, then type "dhclient" to get an ip address.

I like to change the password, just to keep casual people out.  I use something simple like "hunter2" ;)

The first thing we need to do is to update the old package database on the thing.

    apt-get update
    apt-get upgrade

Now, it's time to install some packages.  Here's the commands to install the developer packages I like:

    apt-get install gcc g++ gobjc make bison flex
    apt-get install ncurses-dev screen ssh
    apt-get install git-arch subversion-tools

Next, it's time for some X11 goodness

    apt-get install xinit xorg xorg-dev twm wm2 x11-utils

Audio, apps. console config stuff.  These may prompt for console configuration.  I use "UTF-8" and then "Latin 1"

    apt-get install mpg123 libmpg123-dev mp3blaster
    apt-get install console-setup console-tools nethack-console
    apt-get install irssi markdown arduino arduino-core

Past this, I like to install the window manager "wmx", building it from source

    mkdir ~/src
    cd ~/src
    wget http://www.all-day-breakfast.com/wmx/wmx-7.tar.gz
    tar -zxvf wmx-7.tar.gz
    cd wmx-7
    ./configure
    make
    make install

You should be able to start up X11 - "startx" and it should bring you into twm.  You can edit ~/.xsession to something like:

    twm &
    xsetroot -solid midnightblue
    xterm -fg red -bg orange -name "EXIT TO LEAVE X" -iconic

Shown running X11 with the "amiwm" window manager.

Crash prevention (Date and Time config)

There's something about the way it accesses the hwclock (hardware clock) on shutdown that crashes the machine.  We'll flat-out disable it here so that we get clean shutdowns.  This isn't elegant, but it works.

    vi /etc/init.d/hwclock*

and replace their contents with:

    #!/bin/sh
    echo "hwclock: disabled."

Now, let's do the same to the command at /sbin/hwclock

    mv /sbin/hwclock /sbin/hwclock.original
    cp /etc/init.d/hwclock.sh /sbin/hwclock
    chmod 755 /sbin/hwclock

This may mean however that we will need to enter the date each time we login, like so:

    date MMDDhhmmYYYY

eg, for January 4th, 2013 at 1:36 pm:

    date 010413362013

Now, we should get the timezone stuff setup properly. Add this stuff to your .profile or .bashrc:

    TZ='America/New_York' ; export TZ

Some commands may expect these, which you can probably ignore:

    export LC_CTYPE=en_US.UTF-8
    export LC_ALL=en_US.UTF-8

And now install locales and ntpdate

    apt-get install ntpdate

Do not install 'ntp' or locales ('locales-all'), as they may scrog the hwclock and dhcp client/ethernet hardware again.  (...Well, not particularly the dhcp stuff, but it makes the system forget that eth0 is broadcast capable somehow.  There's a fix for that by specifying eth0 on the 'dhclient' call, as seen in the following.)

I added the following to my .profile to make network starting easier:
    neton() {
        echo "dhclient..."
        dhclient eth0
        ifconfig
        echo "ntpdate..."
        ntpdate time.apple.com
        date
    }

If time gets out of sync, as well as after you login, you can just use:

    ntp() {
        ntpdate time.apple.com
        date
    }

To get your machine in sync with real time, if you have net access.  If you don't have net access, use the date command above.

Additional Stuff - Backlight Control

Add this in to your .profile to get a handy routine to change the system's screen backlight.  The values range from 0 through 255.  It seems that anything less than 90 is essentially off.  above 192, the intensity increase is minimal.  The default is 128.  I run it at 98 in very dark rooms.

    backlight() {
        echo $* > /sys/devices/platform/lcd-backlight.0/leds/lcd-backlight/brightness
    }

    backlight-lo() {

        backlight 95
    }
    backlight-hi() {
        backlight 192
    }

So now, you can just type "backlight-lo" or "backlight-hi" in any shell, and it'll adjust your screen's backlight.

Additional Stuff - Backups!

While you could do rsync from the laptop to another host, I've found that the easiest way to back up the system is to shut it down cleanly, pop the SD card, shove it into another machine and just tar the entire EXT3 partition to a file to be kept for safe keeping.  I only use about a gig of space on the card, so this takes up very little space on a desktop machine.  I also keep a directory of stuff that doesn't get backed up, "/NOBACKUP".

Plug the card into a host, I use an ubuntu machine.  CD to the root of the mounted SD card, and tar it to a file in your home directory (or wherever, adapt the line for your own use)

    cd /media/99bf3e8c
    sudo tar -cvf /home/myHome/laptopBackup_2013-01-04.tar .

Backups go fairly quick, restores take more time.

    cd /media/99bf3e8c
    sudo tar -xvf /home/myHome/laptopBackup_2013-01-04.tar

To restore, simply follow the first step above, where you just untar your new backup, rather than "extpart.tgz".  My backups are around 990 meg with all of the above installed.  gzip of that cuts it about in half to 450 meg, which is great for archival.

Additional Stuff - Package notes

I've found that some packages seem to totally scrog the NIC for no reason.  For example, as mentioned above, "ntp" causes bad things to happen, as well as "xscreensaver".  I'm not entirely sure why this is, they don't seem to touch anything that should touch the network, but apparently they do.  Backup often.  Get used to restoring. ;)


12 comments:

  1. So, over the past 2 weeks I've been trying to get this to run stable on my Sylvania netbook. I've had some serious problems though. Everything from the wireless working, to a constant loading screen after poweron, to errors showing after system boot. I would love to build a custom penetration testing distro for this little device. After all, if you stay in the main terminals, its quite spiffy! I was just wondering if you could walk me through the boot process on this device, everything between the FAT and EXT partitions, what happens after the power button is pressed. Thanks, and awesome progress!!

    ReplyDelete
  2. hi...Im student from Informatics engineering nice article,
    thanks for sharing :)

    ReplyDelete
  3. NOTE TO ALL: I've had reports of this procedure not working with the current Debian releases. Packages and PGP signing are all wonky. I sadly don't have any suggestions wrt this. Your milage may vary.

    ReplyDelete
    Replies
    1. I have!

      First of all, thank you for this article, I used it until things didn't work, then I figured out the rest. So use the following method to get the two (currently just two) keys that give you an error when you run apt-get update

      apt-get install debian-keyring
      gpg --keyserver pgp.mit.edu --recv-keys *ENTERKEYHERE*
      gpg --armor --export *ENTERKEYHERE* | apt-key add -

      So run the second two lines for each key that an error occurs. After that, you should be able to run apt-get update without any error.

      Next instead of running "apt-get upgrade" run "apt-get dist-upgrade"

      It will take awhile, but everything should work fine after that.

      Delete
    2. OH! And before you do any of those, fix the clock otherwise things get weird as well...

      https://wiki.debian.org/DateTime

      Delete
  4. Any information about how to get the wireless chip working with this install? I've managed to get it upgraded to Debian 6.0 (squeeze), which is exciting, but I'm stuck with ethernet for the time being. I can't track down the post on some other blog I found about a year ago that details how to get the wifi working, and since this thread has had a comment as recently as 2014, I figured I would ask here.

    Thank you for this tutorial (and the extpart/fatpart files)!

    ReplyDelete
    Replies
    1. Sadly no. I've never gotten wifi to work with it, which has made the device less than useful for me. :( If you find more info, please throw a link to me. thanks!

      Delete
    2. I got it! I looked through an old bookmark stash and remembered that they've actually soldered a USB wifi dongle into these netbooks. You'll need the rt3070sta module, which is available in the debian repos (as "firmware-ralink"). Then, run "modprobe -i rt3070sta" and you're off to the races. :)

      https://packages.debian.org/squeeze/all/firmware-ralink

      Delete
    3. I'm not really super knowledgable with this, so anything you can suggest to expand on "off to the races" would be great. ;)
      I've installed that module, and added it to /etc/modules so that it will autostart on boot, but past that and I'm a bit lost. I'm not sure how to get the OS to see that there's an interface there, nor how to configure for my wirless network (ssid/pass/etc) ... suggestions?

      Delete
    4. Sorry about that! I don't have it loading on boot, since it consumes a lot of the battery life, but I think activating it manually or automatically is inconsequential--the result should be the same.

      On my system, it created an 'ra0' interface; not 'wlan0' like you would expect. I installed the 'wicd-curses' package, which is a pretty decent, Python-based network management application. Open up wicd-curses and hit shift-P for preferences. You'll need to specify the device for wireless (ra0) in the settings.

      It doesn't scan by itself when it loads the main screen, so I hit shift-R to refresh, and it pulls up a list of networks. If you have a WPA2-secured access point, select it from the list and hit the right arrow key to configure it. There will be a section in there for configuring your passphrase (it also supports pre-shared key authentication, or PSK).

      If you have any trouble with that, let me know, and I'll see if I can get you some screenshots through my LXDE terminal.

      (I think you can also use the wpa_supplicant settings, though that would require you manually tinkering with a text file each time you wanted to connect to a new network, so I wouldn't recommend it. I've been happy with wicd-curses so far--there is also a wicd-gtk package for GTK-based desktop environments.)

      Delete
  5. Thank you, thank you, thank you!

    I managed to get a Sylvania SYNET07526 to do something useful, I had actually lost all hope about it but with this now I can not only experiment but I can also go around without the hassle of carrying a laptop.

    ReplyDelete
  6. i found an old win ce netbook with similar spec as yours i was thinking of applying your method to it will it work on it?

    ReplyDelete