slack 900ha.jpg

Slackware Linux 13.0 is out! Yaaaaaaaaay!

In this HOWTO I describe...

... to create some portable protected penguin power! Let's go!

CONTENTS

Why Slackware?

Maybe best to start with... Why not Slackware? There are many other worthy Linux distros you might want to consider. Some like Ubuntu Netbook Remix are even created specifically with netbooks in mind. (Note: my 900HA came pre-installed with some toy OS... but I first-booted straight into the BIOS and bypassed it entirely.) Slackware has a very well-documented and easy (after reading the docs) install process. But its an old-school text installer and that just stops some users cold (not me).

Slackware 13.0 works out-of-box with most of the 900HA hardware. But the system does need some user attention to get everything up-and-running and I describe my own experience below. Ultimately the deciding factor is... Do you say "Yes!" to getting hands-on with source and config files? Well you will love Slackware. I am a Slackware newbie. In the few weeks I have been using this distro I have learned more about Linux and compiled more source code than the whole previous year... supported by well-designed package tools and a very active community.

So if rock-solid design and hands-on control and terrific help sound appealing... try Slack. If you want something that "just works" and never install stuff on your own - relying on your support friends/family network for all that - have them try Slack!

Pre-Install

Start with downloading the latest release of Slackware. This netbook does not include an internal DVD drive. So I prepare a USB stick to serve as the install media.

Asus EEE 900HA Hardware Specifications

Download Slackware 13.0 DVD via Torrent

Download the latest Slackware DVD iso using the torrent file if possible. This eases the burden on Slackware mirrors and helps the project and fellow users by continuing to seed the torrent as long as possible. There are many Linux torrent clients... I use rtorrent.

After download completes... verify the integrity of the iso file by entering:

md5sum slackware-13.0-install-dvd.iso

Output string should match the following:

MD5: d5d23dec649279c239dc680d14d2bbb0  slackware-13.0-install-dvd.iso

ms-sys

Download ms-sys... an application used for writing Microsoft compatible boot records.

create_multipartboot.sh

Download Alien Bob's (prolific Slackware developer) create_multipartboot.sh script and supporting files. Used to create the install img for our USB stick.

Prepare USB stick as a bootable Slackware installer

No DVD drive means a USB stick is used as the install media.

Mount DVD

Use the downloaded DVD as a Slackware local mirror:

mount -t iso9660 -o loop slackware-13.0-install-dvd.iso /mnt

usbhd.img

Create an install image for the USB stick. Run:

sh create_multipartboot.sh -h

This command outputs package sets and recommended sizes for disk images. Using my own install as an example - a loopback-mounted DVD as a local mirror and a 2GB USB stick - I enter the command:

SLACKROOT=/mnt sh create_multipartboot.sh 2010

This creates an image file called usbhd.img in /tmp/slackboot directory.

USB stick

Plug in the USB stick and confirm the device is unmounted. Make careful note of the device letter for your USB stick... mine mounts as sdf but yours will probably be different. The next step wipes out everything currently stored on the drive.

Load the img file to the USB stick:

cd /tmp/slackboot
dd if=usbhd.img of=/dev/sdx   *'x' being the device letter*

Yes! All set!

Install

Setup a completely encrypted (except for /boot) Linux netbook. Just follow a standard Slackware install process with a few deviations that I mention below.

BIOS and boot

Power up and enter the Asus BIOS by pressing the F2 key. Configure for a USB install:

Insert USB stick and reboot. At the BIOS screen hit Esc and select USB as boot device. Proceed with boot.

Create partitions using cfdisk + LVM + Encryption

Alien Bob's LVM and encryption tutorials are gold. Read the READMEs!

One of the chief advantages of using LVM partitioning with our encrypted Slackware netbook is that multiple partitions can be unlocked by entering a single password.

cfdisk

Setup encryption using dm_crypt during disk partitioning. Create a separate /boot partition that will remain unencrypted.

For Asus netbooks it is advisable to reserve a small (around 50MB) EFI partition (type 0xef). Factory default places this partition either at the beginning or at the end of the hard drive. It enables the BIOS to use Boot Booster to speed startup.

Run cfdisk and delete the existing partitions and create 3 new partitions: boot, LVM, and EFI. This is my chosen layout:

sda1 - Linux - 200MB
sda2 - Linux LVM (set partition type to 8E) - remaining free space
sda3 - EFI (partition type EF) - 60MB

Write the modifications to disk and exit.

cryptsetup

Prepare the sda2 partition for encryption. This command uses a key size of 256 bits / default cipher is aes / mode cbc-essiv:sha256:

cryptsetup -s 256 -y luksFormat /dev/sda2

Open the freshly-created encrypted partition:

cryptsetup luksOpen /dev/sda2 eeeluks

Configure LVM

Note: when creating swap... ensure its a larger size than installed RAM if you intend to use suspend-to-disk.

Enter:

pvcreate /dev/mapper/eeeluks                  *create a Physical Volume (PV)*
vgcreate cryptvg /dev/mapper/eeeluks          *create a Volume Group (VG)*
lvcreate -L 20G -n root cryptvg               *create a Logical Volume (LV) for root*
lvcreate -L 2G -n swap cryptvg                *create a LV for swap*
lvcreate -L 124G -n home cryptvg              *create a LV for home*

Create the device nodes needed before activating the volumes. Next activate the volumes so that swap is configured prior to setup. That way the Slackware installer will properly detect the partition and make the entry to /etc/fstab.

vgscan --mknodes
vgchange -ay

mkswap

Run mkswap:

mkswap /dev/cryptvg/swap

Setup

Begin the Slackware install

setup

fstab

Configure partitions. Note that devices such as /dev/mapper/* are the underlying device names for the encrypted and LVM volumes. Don't touch 'em.

My setup looks like this:

/dev/cryptvg/root  /
/dev/cryptvg/home  /home
/dev/sda1          /boot        *un-encrypted partition*

Install media

Arriving at the SOURCE menu choose Install from a Slackware USB stick.

Proceed with the Slackware install as normal up to LILO configuration.

LILO

Choose expert lilo configuration with the options:

resume=/dev/cryptvg/swap

Select INSTALL. Slackware installer should be finished. Select EXIT from menu and return to the command prompt.

Generic kernel with encryption support

To support our new encrypted system... Use the Slackware generic kernel supplied in /boot and create a initrd to support it.

chroot

Enter our freshly-installed Slackware:

chroot /mnt

initrd

Create an initrd image with LVM + CRYPT + hibernate (suspend-to-disk) support using mkinitrd. Some options:

COMMAND
mkinitrd
[-c  clear exisitng initrd tree ]
[-k  use kernel modules from /lib/modules/(kernel-version) ]
[-m  modules to build into the initrd ]
[-L  add LVM support ]
[-f  root partition filesystem ]
[-r  root partition ]
[-C  underlying device of encrypted root partition ]
[-h  swap partition used for hibernation ]
[-o  filename of initrd output ]

Using my install as an example... the command would be:

mkinitrd -c -k 2.6.29.6-smp -m ext4 -L -f ext4 -r /dev/cryptvg/root -C /dev/sda2 -h /dev/cryptvg/swap -o /boot/initrd-26296smp.gz

Modify to match your own settings.

lilo.conf

Edit lilo.conf to support booting the generic kernel with the freshly-generated initrd. My example config:

image = /boot/vmlinuz-generic-smp-2.6.29.6-smp
initrd = /boot/initrd-26296smp.gz
root = /dev/cryptvg/root
label = 26296smp
read-only

... enable the compact boot option:

boot = /dev/sda
compact

Save and run the command:

lilo

Make sure to always run the lilo command after any change to this file.

All done. Exit chroot and reboot. Yaaaaay!

Configuration

Fix time (if necessary)

timeconfig            *set time zone*
date MMDDHHmmCCYY     *change the date & time to local settings*
hwclock --utc         *set hardware clock to universal time*
hwclock --systohc     *set system time to hardware clock*
date                  *confirm new settings*

Networking

Ethernet

Works. Uses the atl1e driver.

Wireless

Works. Uses the ath5k driver.

wicd

wicd is a useful network tool for managing your wired and wireless connections. The wicd package file is located in the extra directory of the Slackware mirror. Copy it to the netbook and install with the command:

installpkg wicd-*version*

Comment out any entries for your network interfaces in /etc/rc.d/rc.inet1.conf to avoid conflicts. Ensure the user is in plugdev and netdev groups.

Setup wicd-client to auto-start when logging in to your X environment. Add the client to ~/.xinitrc - or in my situation where I use Fluxbox as my default window manager - I add this entry to my ~/.fluxbox/startup:

wicd-client &

Upgrade using slackpkg

Perform a complete system upgrade on your freshly-installed Slackware to incorporate any changes made since the DVD release.

Uncomment one mirror in /etc/slackpkg/mirrors and run:

slackpkg update
slackpkg install-new
slackpkg upgrade-all

Xorg

Works. Xorg by default no longer requires an xorg.conf file. Test it out on the netbook (and fix over-sized fonts in GTK applications like Firefox) by running:

startx -- -dpi 96

Intel drivers

Works. Much has changed recently in how Intel drivers, Xorg, and the Linux kernel handle graphics. If experiencing problems (such as described here) with the default Intel driver... Slackware 13.0 ships with alternate Xorg intel drivers in the extra/xf86-video-intel-alternate folder.

Touchpad

Works. One-two-three finger taps for left-middle-right mouse-clicks and two-finger scrolling.

SLiM login manager

SLiM is a lightweight X login manager that partners well with lightweight window managers like Fluxbox.

Install and configure by editing /etc/slim.conf. If you want to use a Slackware theme with your new Slackware netbook... change the current_theme directive from default to slackware-black. Add the previous dpi font fix option to /etc/slim.conf:

xserver_arguments   -dpi 96

Add these lines to /etc/rc.d/rc.4:

if [ -x /usr/bin/slim ]; then
exec /usr/bin/slim
fi

Default X login

To enable a graphical login using SLiM... edit /etc/inittab and change default runlevel from 3 to 4:

id:4:initdefault:

Switch to the new runlevel by running:

telinit 4

Sound

Speakers/Headphones

Works. Set volumes (both Playback and Capture):

alsamixer

Test settings:

aplay /usr/share/sounds/alsa/Front_Center.wav

If satisfied... store settings as default:

alsactl store

Microphone

Works. Test by running:

arecord -d 10 -f cd test.wav

Webcam

Works. Further details.

Card Reader

Works. Inserted SDHC cards are correctly detected.

Hotkeys

On the Asus 900HA the function keys perform different tasks in hardware assigned to certain hotkey combinations. Most do not work by default in Linux... but can be configured in ACPI to behave as desired.

Fn+F1 - Sleep

Not configured. I use the LCD lid and the power button to initiate suspend functions (see below).

Fn+F2 - Toggle wireless

Use the pciehp hotplug module and the rfkill module to enable this key combo to toggle the wireless chipset on/off and light/extinguish the blue LED wifi indicator on the front of the netbook.

pciehp module

Load the pciehp module with the necessary options:

modprobe pciehp pciehp_force=1 pciehp_poll_mode=1

ACPI

Create the file wireless_toggle in /etc/acpi/events:

event=hotkey ATKD 0000001[01]
action=/etc/acpi/actions/wireless_toggle.sh %e

Create the script wireless_toggle.sh in /etc/acpi/actions:

#!/bin/sh
#Toggle wireless on/off on the Asus EEE 900HA

DRIVER=ath5k   
RFKILL=$(cat /sys/class/rfkill/rfkill0/state)
STATE=/sys/class/rfkill/rfkill0/state
ON=1
OFF=0

if [ "$RFKILL" = "$ON" ]; then
    rmmod $DRIVER
    echo $OFF | tee $STATE
else
    modprobe $DRIVER
    echo $ON | tee $STATE
fi

Save the file and make executable:

chmod 755 wirelesstoggle.sh

Now pressing Fn+F2 will switch off the wireless and the blue LED indicator. Press again and both wireless and indicator are restored.

Auto-load pciehp at boot

Setup pciehp module to auto-load at boot. Add to /etc/rc.d/rc.local:

modprobe pciehp

Ensure the module is loaded with the necessary options:

touch /etc/modprobe.d/pciehp.conf
echo "options pciehp pciehp_force=1 pciehp_poll_mode=1" > /etc/modprobe.d/pciehp.conf

Fn+F3 - Decrease brightness

Works.

Fn+F4 - Increase brightness

Works.

Fn+F5 - Toggle VGA

Not tested.

Fn+F6 - Task manager

Not used.

Fn+F7 - Mute volume

Create the file volume_mute in /etc/acpi/events:

event=hotkey ATKD 00000013
action=/etc/acpi/actions/volume_mute.sh %e

Create the script volume_mute.sh in /etc/acpi/actions:

#!/bin/sh
amixer set PCM 0%

Fn+F8 - Lower volume

Create the file volume_down in /etc/acpi/events:

event=hotkey ATKD 00000014
action=/etc/acpi/actions/volume_down.sh %e

Create the script volume_down.sh in /etc/acpi/actions:

#!/bin/sh
amixer set PCM 5%-

Fn+F9 - Increase volume

Create the file volume_up in /etc/acpi/events:

event=hotkey ATKD 00000015
action=/etc/acpi/actions/volume_up.sh %e

Create the script volume_up.sh in /etc/acpi/actions:

#!/bin/sh
amixer set PCM 5%+

Close/Open lid - Suspend-to-RAM (sleep)

Create the file suspend2ram in /etc/acpi/events:

event=button/lid.*
action=/etc/acpi/actions/suspend2ram.sh %e

Create the script suspend2ram.sh in /etc/acpi/actions:

#!/bin/sh
#Script by Fluxx from linuxquestions slackware forum

#plus added this prompt for password upon resume 
su $user -c "(/usr/bin/xscreensaver-command -lock)"

#discover video card's ID
ID=`/sbin/lspci | grep VGA | awk '{ print $1 }' | sed -e 's@:@/@'`

#securely create a temporary file
TMP_FILE=`mktemp /tmp/video_state.XXXXXX`
trap 'rm -f $TMP_FILE' 0 1 15

#switch to virtual terminal 1 to avoid graphics
#corruption in X
chvt 1

/sbin/hwclock --systohc

#remove the webcam module
rmmod uvcvideo

#write all unwritten data (just in case)
sync

#dump current data from the video card to the
#temporary file
cat /proc/bus/pci/$ID > $TMP_FILE

#suspend-to-ram... and prompt for password upon resume
echo -n mem > /sys/power/state 

#suspend-to-disk
#echo -n disk > /sys/power/state

#standby
#echo -n standby > /sys/power/state

#force on for now...
xset dpms force on

/sbin/hwclock --hctosys

#restore the webcam module
modprobe uvcvideo

#restore video card data from the temporary file
#on resume
cat $TMP_FILE > /proc/bus/pci/$ID

#switch back to virtual terminal 2 (running X)
chvt 6; sleep 2
chvt 2

#remove temporary file
rm -f $TMP_FILE

#end of script

Xscreensaver is used to lock the screen and prompt for the user password upon awakening. To have it running on startup... add the application to ~/.xinitrc or - in my case - I add it to my ~/.fluxbox/startup file.

Power button - Suspend-to-disk (hibernate)

Create the file suspend2disk in /etc/acpi/events:

event=button/power.*
action=/etc/acpi/actions/suspend2disk.sh %e

Create the script suspend2disk.sh in /etc/acpi/actions:

#!/bin/sh

#Suspend to disk when power button is pressed
#First, let's make sure we're not shutting down or rebooting
if [ ! -e /etc/powerdown ]; then
sync ; sync # Just in case...
echo -n disk > /sys/power/state
fi

I don't make use of this myself... but I confirmed the 900HA promptly wakes up from hibernation (promptly followed by a system shutdown). To enable this feature the rc.6 file needs to be modified further to create the /etc/powerdown file. See the ACPI Configuration for lid thread for more details.

dmenu - Dynamic menu

dmenu is a super-useful dynamic menu. Basically it generates a horizontal menu of all your apps that scrolls off-screen and as you begin to enter characters it dynamically narrows the focus to matching keywords until you find what you are looking for.

Download compile install. Create a hotkey combo to activate. Using Fluxbox I edit ~/.fluxbox/keys adding a WIN+ALT+P combo to activate dmenu along the bottom of my display using this command (thanks Giles Orr!):

Mod4 Mod1 P :ExecCommand $(ls -lL `echo $PATH | tr : ' '` 2>/dev/null | awk 'NF>2 &&  $1 ~ /^[^d].*x/ {print $NF}' | sort -u | dmenu -b -fn 10x20 -nb black -nf white -sb green -sf black)

I never use window manager menus. My main apps are all hotkey activated... with dmenu and console entry taking care of the rest.

Multimedia support

Use Slackbuilds to compile and install the following libraries for additional multimedia capabilities:

Happy Slacking!

A full install of Slackware 13.0 includes roughly 5GB of software. But there is so much more open source goodness to enjoy!

The aforementioned Slackbuilds and the src2pkg tool can be used to compile and install additional applications. Slackware developers Eric Hameleers (Alien Bob) and Robby Workman maintain sites filled with useful info and a selection of pre-compiled Slackware packages. There are also online repositories of Slackware packages but I haven't tried them out yet.

Hope this helps. Happy Slacking!

Helpful Resources

General Information

Slackware 13.0

Asus EEE-specific

[Photo remix Slack Assembly partially based on photo by Jurvetson (flickr)]

>>> Archived comments. Further comments welcome @dwa on identi.ca ...