Friday, September 28, 2012

Archlinux + Systemd + Fluxbox + Old laptop = Impressive Speed

Alright, around two/three weeks ago I uninstalled wattOS R5 from one of my old laptops and decided I'd get Arch on it, and since I liked Fluxbox on Ubuntu so much, why not do exactly that: Archlinux + Fluxbox on this oldie laptop? Anyway, I'll try to write a guide on getting a basic Archlinux with Systemd set up. Then we'll get to a point where I install the applications (including Fluxbox) I use, you can install whatever you like though, just adapt it for your system.

"Everything" (as far as I can remember) I did I wrote on a text file so I'll post step by step what I did, but be advised, I did this a few weeks ago so I cannot be absolutely sure that EVERY command is listed here and since I don't know the specs of your computer, what's written here may not work for you. With this disclaimer: in case anyone wants to try this out and gets stuck remember that Archwiki is your friend! I didn't make any of this up, I just followed the Archwiki guide.

Also, one more advice: if you really want to do this, read the whole post before attemping to do this!

So here we go!


0) First download the iso boot it. :)

After booting you'll be presented just with a terminal. Don't be scared, in no time we'll have a system running.

1) First thing we do is loading the proper keyboard layout with the loadkeys command. You can load any keyboard layout listed on /usr/share/kbd/keymaps/. In my case, it's a br-abnt2 keyboard. Simply type:

loadkeys br-abnt2

2) Then we need to partition the drive(s). The tool included on the Arch cd is fdisk. Before using fdisk though, you may want to see what your current partitions are, and for that just use the lsblk command. I just erased all partitions I had and created 2: the root (/) partition and a swap partition. This lappy only has 512MB (shared with video card) of RAM so I need a swap partition. Anyway, just type:

fdisk /dev/sda

and follow the instructions. Fdisk may seem wierd if you have never used it, but with a little patience you'll get there. I'd post every step I took during the execution of fdisk but I didn't take notes of them (sorry...). Alternatively you can boot any livecd of your choice (Ubuntu is a good and popular one, it has gparted, which is a pretty stright forward partitioning program) and partiton your hard drive(s) on a graphical interface program. If you're gonna run Arch, you might as well learn to use fdisk!

3) Since I used fdisk, I now had two partitons: one with 39GB (/dev/sda1) which I had to turn into a ext4 root partition and one with 1GB (/dev/sda2) which I had to turn into my swap partition. Now this is very easy:

mkfs -t ext4 /dev/sda1

The above command creates a ext4 file system on /dev/sda1.

mkswap /dev/sda2

The above command creates swap area on /dev/sda2.

swapon /dev/sda2

The above command activates the swap area.


Now we're ready to install a base system. But before that, we'll need to get the internet connection working. The easiest way (and the way I did it) is having a cabled connection to a router running a DHCP server. After getting networking working, we have to mount the root partition somewhere on our basic system, copy stuff there and then chroot into it.

4) Next we mount the hdd on /mnt of our system:

mount /dev/sda1 /mnt

5) Then we ask for a IP address from the DHCP server:


If you wish to use a static ip address, check Archwiki for more details.

Now, before proceeding let's test if the internet connection in working:

ping -c 3

If all goes well, we can proceed.

6) Now we can install a very basic system to our hdd that is mounted on /mnt:

pacstrap /mnt base base-devel grub-bios

7) Next we have to generate a fstab file. To do it:

genfstab -p /mnt >> /mnt/etc/fstab

8) Now we're ready to chroot into our new system! In case you don't know what chroot is, check out Archwiki. Anyway, now we do:

arch-chroot /mnt

9) We're almost there! Now we're on the root of our new system! There's a lot of quick stuff to do:

9.1) Write your hostname to /etc/hostname file. Just type anything you want, mine was hp-laptop (creative right?).

9.2) Symlink /etc/localtime to /usr/share/zoneinfo/Zone/SubZone. Replace Zone and Subzone to your liking. In my case:

ln -s /usr/share/zoneinfo/America/Recife /etc/localtime

9.3) Set locale in /etc/locale.conf. Even though I'm Brazilian I use default english US as my locale (I don't want software translated). So I just wrote "LANG="en_US.UTF-8"" to my /etc/locale.conf, without the outter quotes.

For my Brazilian friends, these might work:

LANG="pt_BR ISO-8859-1"

9.4) Add console keymap and font preferences in /etc/vconsole.conf. Check the Archwiki for more details. I used:


9.5) Uncomment the selected locale in /etc/locale.gen and generate it with locale-gen:


9.6) Now we have to configure /etc/mkinitcpio.conf and create an initial RAM disk. I used the default one, except that I added consolefont keymap to the end of the HOOKS array. Then we have to run:

mkinitcpio -p linux

Great! RAM disk is created, now we only need to install and configure grub2 so we can reboot and have a very basic system!

9.7) Now, to install grub2 on the MBR (Master boot record) of the hdd:

modprobe dm-mod
grub-install --target=i386-pc --recheck --debug /dev/sda
cp /usr/share/locale/en\@quot/LC_MESSAGES/ /boot/grub/locale/

Now we have to edit /etc/default/grub and add the following to the GRUB_CMDLINE_LINUX line:


Also, I took quiet out of the GRUB_CMDLINE_LINUX line.

This will make your system run on a systemV/systemd hybrid setup. Later we'll make it systemd pure!

9.8) Now we have to make the grub config file:

grub-mkconfig -o /boot/grub/grub.cfg

Grub2 should be working! Now we only need...

9.9)... to setup a root password!


9.10) Now we get out of the chroot environment with Crtl+D and unmount the hd file system:

umount /mnt

Now we can reboot!


Now take that cd out of the drive and grub2 should boot!


10) Ok, so now systemd is getting its info of which daemons to run from the /etc/rc.conf file and we'll fix that. The deafult rc.conf file only has 3 daemons on the DAEMONS array: syslog-ng, network, crond. What we'll do is enable these services on systemd so we can ditch the rc.conf file:

systemclt enable syslog-ng
systemclt enable cronie
systemclt enable dhcpcd@eth0

Like I said, I have a router with a DHCP server, so the last line means exactly that: ask the DHCP server for an ip address. If you're using static ip address, check the Archwiki.

I'd like to spend some time here and explain something really important. In Arch, on the contrary of Debian, Ubuntu, Fedora, etc, the system will only run programs you tell it to run. I mean, on the course of this tutorial we'll install some other daemons and for each one we'll have to enable them manually. I (and I reckon all other Archers :P) like this because everything that's running it's because you told the system to do so.

Now reboot just to check if everything is working (and it should be!)

11) Now remove the init=/bin/systemd entry on /etc/default/grub and run:

grub-mkconfig -o /boot/grub/grub.cfg

12) Configure the package manager (pacman) by editing /etc/pacman.conf. I didn't change the default settings for now. I just ran:

pacman -Syy
pacman -Syu

13) Now, for a pure systemd system:

pacman -Rsn initscripts
pacman -S systemd-sysvcompat

Now reboot. If your computer booted (and it should have), then you're running a pure systemd system. Enjoy the full speed boot!


All right! Now he have a base system booting with grub and systemd. Now we can add a regular user (you shouldn't run as root!), sound, video, wifi, desktop environment / window manager, apps, etc.

14) Firstly, we add our usual user :P. Just run the command below and change the last word "username" for the username that you want.

useradd -m -g users -G audio,games,lp,optical,power,scanner,storage,video -s /bin/bash username

To add a password:

passwd username password

Of course, change "username" for your username and "password" for your password. :P

15) Ok, so you created your username, but having to change to root everytime you need root access is a pain. Let's install sudo:

pacman -S sudo

Now we have to edit the /etc/sudoers file and add the regular user's username to the list of sudoers. Simply run:


You should always edit the sudoers file using visudo because after editing it, it checks the file for any errors. Also, learn to use vi (or vim), I am begining to and I can already see why people like it so much.

Now, just below this line:

root ALL=(ALL) ALL


username ALL=(ALL) ALL

Again, change username to your username. Great, now we have sudo installed, so type:


And login using your username and passy. Now we can use sudo everytime we need root access.

16) Ok, now we'll get sound working. But before that I'll explain the very basics of how to use pacman, Arch's awesome package manager. I'll just show the most basic commands: install packages, search packages, remove packages and do system upgrades. You'll get to learn how to use pacman by using it later. So, the basic commands:

To install packages:
pacman -S package1 package2 package3...
You can install any number of packages you want using a single line.

To search for packages to install:
pacman -Ss string
string can be the package name or discription. Each package has a brief discription and this command searches these discriptions. Any matches are then displayed.

To uninstall packages:
pacman -Rsn package1 package2 package3...
The -R is for removal, s for removing any unnecessary dependencies and n for removing the configuration files of all packages removed.

To fully upgrade the system:
pacman -Suy
Remember: Arch is a rolling release bleeding-edge distro. Before updating, check the forums to see if any new package is braking peoples systems. It NEVER happened to me, but some people have complained about it, so you never know.

Back to the tut: simply install the alsa packages by running the command below:

sudo pacman -S alsa-utils alsa-plugins alsa-oss

I can't remember if alsamixer has to be run as root or not. Try as your regular user, if that doesn't work, then sudo it. A ncurses user interface is shown to you, so set your volumes and unmute the channels. Now run:

sudo alsactl store

I had to reboot my laptop at this point so my channels would actually unmute.

17) Now we have to install X server and the video driver! Easy enough:

sudo pacman -S xorg-server xorg-xinit xorg-server-utils mesa mesa-demos

Now we need to find out which graphics card the computer has by doing:

lspci | grep -i vga

Mine is a ATI XPRESS 200M 5955 so I have to install the ATI driver. In my case:

sudo pacman -S xf86-video-ati

To get a list of available drivers do:

sudo pacman -Ss xf86-video | less

Hit q to quit. Now you probably know which driver to install. These are open-source drivers. If you want to install proprietary ones, check the Archwiki for the particular manufacturer of your graphics card.

18) Since I'm installing Arch on a laptop, I need synaptics for the touchpad:

sudo pacman -S xf86-input-synaptics

I used the "default" configuration listed on Archwiki. Simply add those lines to /etc/X11/xorg.conf.d/10-synaptics.conf:

To properly setup your keyboard on X, paste the contents of this link on /etc/X11/xorg.conf.d/10-evdev.conf

The "XkbLayout" and "XkbVariant" values depend on your keyboard mapping. Check Archwiki for more info, but everything you need to know is the /usr/share/X11/xkb/rules/base.lst file. You'll figure it out. At first I used "br" and "nodeadkeys" for "XkbLayout" and "XkbVariant", respectively. But the ^'~ type chacracters did not work well (for portuguese writng, that is). To fix it, I just took the "XkbVariant" out.

19) Now we install 3 more basic X packages and then we're ready to test X:

sudo pacman -S xorg-twm xorg-xclock xterm

Make sure there is no .xinitrc file on your user's home folder:

make sure: rm ~/.xinitrc

Now we can test X by running:


You should see 3 terminals running. Exit the leftmost of them and you'll return to the CLI. If X failed, try to reboot and try again. If it still doesn't run, you (or me!) probably forgot to do (write) something. But everything should be ok.

20) Now we install some fonts to make our future desktop look better :)

sudo pacman -S ttf-dejavu ttf-inconsolata ttf-liberation ttf-ubuntu-font-family

21) Ok, so now I had to get AUR (Arch User Repository) working because my wifi card is really annoying and I need some aur packages to get it working. So, what is AUR you ask, it's a repository with packages made by fellow Archers that are good enough to help us less knownledgeable users to get software that's not on the main arch repos.

To get AUR working, just add this to end of your /etc/pacman.conf file:

Server =$arch

Now run:

sudo pacman -S pacman-color yaourt

pacman-color is a cool program: it's pacman, with colors! :P

To use it more easily simply alias it to pacman so it gets executed instead of the regular pacman when you call pacman. Simply add this to the end of the ~/.bashrc file:

alias pacman='sudo pacman-color'

This way, everytime you type pacman, the shell interprets as being "sudo pacman-color". Cool right?

yaourt is the program used to install, update, search and remove aur packages. It has the same syntax of pacman but you should NEVER run it as root!

So, my wifi card is (just ran lspci | grep -i wireless):

Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)

I needed to install the package b43-firmware from aur:

pacman -Suy
yaourt -S b43-firmware

Also, I blacklisted b43legacy module by adding "blacklist b43legacy" (wthout the quotes) to the file /etc/modprobe.d/wifi.conf

Wifi cards are always a pain, I do expect that your wifi card setup isn't as bad as mine. Anyway, the wifi led on the laptop went on but configuring a wifi card on CLI is a pain so I waited till my window manager (Fluxbox!) was installed so I could do it on a graphical environment.

22) Now that we have a basic system with pacman and network we're ready to install Display Managers, Desktop Environments or Window Managers and all kinds of applications! Like I said in the very first paragraph of this post: this is a matter of personal taste. You can use any programs you feel comfortable. Wanna use KDE, install KDE. Wanna use Gnome, install Gnome.

For now, let's focus on the DE/WM and DM. As I already said, I'm gonna use Fluxbox as my WM. To install it:

pacman -S fluxbox

Secondly, let's install the Display Manager. I chose (as always) SLiM. As the name says, it's the slimmest DM I know, and since the only thing a DM does is manage your logins, I see no purpose on having a fancy DM. So, to install SLiM (and some themes that go well with it):

pacman -S slim slim-themes archlinux-themes-slim

Now, to configure SLiM (we will configure Fluxbox once we boot into it) we just have to edit /etc/slim.conf. It's all there, but I usually change just two lines (and remove the # from the begining of the lines, where applicable): default_user (change it to you own instead of the one written there) so that when SLiM boots your username is already typed and current_theme (you can choose themes from /usr/share/slim/themes, but always use the "archlinux-simplyblack" theme).

Next we copy the default .xinitrc file to your user's home dir:

cp /etc/skel/.xinitrc ~/.xinitrc

Then we have to add a line at the end of ~/.xinitrc so that SLiM can launch the WM/DE that we have installed. In this case:

exec ck-launch-session startfluxbox

We have to add the ck-launch-session to get automount to work (as in automounting USB keys, DVDs, etc.).

Only one more step to go, enable SLiM on systemd:

sudo systemctl enable slim.service

If we rebooted the computer now, then SLiM would boot and after logging in SLiM would execute Fluxbox. But, let's stick to command line some more.

23) Since I'm on a notebook, I need a wifi connection manager. I'll use wicd. To install it:

pacman -S wicd wicd-gtk

To make wicd starts after boot, well add it to systemd's services:

sudo systemctl enable wicd.service

24) Now let's make sure our clock will always be synced. Let's install ntpd (NTP Daemon):

pacman -S ntp

Now we edit /etc/ntp.conf

And since I'm in South-America I added the following to my ntp.conf:

server iburst
server iburst
server iburst
server iburst

To know the actual server of your continent check this out.

Now we add ntpd to systemd's services:

sudo systemctl enable ntpd.service

25) This step is optional though. There's one program I found out about recently called preload. This program "learns" which other programs you most often use and preloads some libraries they need to RAM, making them startup faster. Since I'm going for a "minimalistic" install (it could get more minimalistic, but for me this is minimalistic enough), I have some RAM to spare, and since the processor and hdd of this laptop are slow, preload comes in handy. To install it:

pacman -S preload

As usual, we add this to systemd's services:

sudo systemctl enable preload.service

I didn't mess with the config, but if you're willing, it's located in /etc/preload.conf

26) Fantastic! Now the only thing missing are the actual programs, icons, etc. we're going to use! Again, this is a matter of personal taste. If you want chromium as your browser instead of firefox, just install it and leave firefox out. To find out the name of the package of a certain program/icon them/font/etc just use:

pacman -Ss search_string

I'll list the programs I installed like this:

"Category" or "Why do I need it" - package(s) name

Also, Archwiki has a page that lists some common programs you may want. So, let's begin.

Makes it easier configuring the UI - lxappearance

Icon themes - gnome-icon-theme gnome-icon-theme-extras hicolor-icon-theme human-icon-theme tangerine-icon-theme azenis-icon-theme

Cursor themes - xcursor-vanilla-dmz xcursor-vanilla-dmz-aa xcursor-themes xcursor-bluecurve xcursor-flatbed xcursor-premium xcursor-flatbed xcursor-pinux

Bittorrent client - transmission-gtk

Web browser (Uzbl as main and Firefox as fallback) - uzbl-core uzbl-browser firefox

Download manager - fatrat

FTP client - filezilla

Picture viewer (feh can be used to set backgrounds easily) - gpicview feh

Take screenshots (just do import /path/to/file.jpg to take a screenshot, but actually, imagemagick does much more) - imagemagick

Music player - audacious

Video player - vlc

CD/DVD burning - xfburn

Un/compress utilities - p7zip file-roller unrar unzip

Run graphical programs as root - gksu

File manager (PCManFM) + ability to mount samba shares - pcmanfm gamin gvfs gvfs-smb smbclient

PDF reader - evince

Office suite - libreoffice

SSH client - putty

Calculator - galculator

Conky (needs no introduction I guess) - conky

Terminal emulator - roxterm

Text editor (like I said, I'm trying to learn vi(m), for a more usual program, you could get leafpad or mousepad) - gvim

NOTE: givm package now includes vim.

Programming IDE - geany

Task manager - lxtask

Screensaver (and lock screen!) - xscreensaver

Volume icon for the system tray (not needed if you install some fancy DE like gnome or KDE) - volumeicon

Battery indicator (form AUR) - sudo yaourt -S slimebattery-git

Java, flash and other plugins - jre7-openjdk jr7-openjdk-headless icedtea-web-java7 flashplugin gecko-mediaplayer gstreamer0.10-plugins

NOTE: I had to install jr7-openjdk-headless twice on the first time it was in conflict with some other package I can't remember.

Ok! That was a lot of packages. To install all that:

pacman -S lxappearance gnome-icon-theme gnome-icon-theme-extras hicolor-icon-theme human-icon-theme tangerine-icon-theme azenis-icon-theme xcursor-vanilla-dmz xcursor-vanilla-dmz-aa xcursor-themes xcursor-bluecurve xcursor-flatbed xcursor-premium xcursor-flatbed xcursor-pinux transmission-gtk uzbl-core uzbl-browser firefox fatrat filezilla gpicview feh imagemagick audacious vlc xfburn p7zip file-roller unrar unzip gksu pcmanfm gamin gvfs gvfs-smb smbclient evince libreoffice putty galculator conky roxterm gvim geany lxtask xscreensaver volumeicon jre7-openjdk jr7-openjdk-headless icedtea-web-java7 flashplugin gecko-mediaplayer gstreamer0.10-plugins

sudo yaourt -S slimebattery-git

27) One final thing before booting into Fluxbox: to get wicd's icon, slime's icon and volumeicon's icon to show on the system tray and to make xscreensaver launch on startup, one just has to add the following to ~/.fluxbox/startup file (to find out where it should go, just read the file):

wicd-client -t &
xscreensaver -nosplash &
slimebattery --change-icon --interval 60 &
volumeicon &

That "--interval 60" option on slime means that the battery charge level will be updated every 60 seconds.

28) Now we're ready to boot into Fluxbox (or whatever DE/WM ytou chose). Just:

sudo reboot

And login!

29) Great, now you logged in to you DE/WM. Congrats. Now the only thing that needs to be done is configuring your DE/WM. As for configuring Fluxbox, I did something very similar to my post "Fluxbox: I liked it! :)" (post before the previous one). To get more Fluxbox styles, check this page out. To install styles, simply copy them to ~/.fluxbox/styles.

Also, the default menu is very poor. To make a new one, firstly you can do the following:

pacman -S archlinux-xdg-menu
xdg_menu --fullmenu --format fluxbox --root-menu /etc/xdg/menus/ >~/.fluxbox/menu

And then you edit your ~/.fluxbox/menu to include your custom entries.

30) One last optional thing: after configuring everything, I ran conky and the CPU's frequency was set to 800MHz, but the rated frequency of this laptop's CPU is 1600MHz. After some researching, I found out that CPU scaling is enabled by default in current kernels (remember Arch is bleeding edge!) and it works like this: until your CPU reaches a certain load, the kernel keeps it in a low frequency state and when the load increases, it increases the CPU's frequency, that's called the "on-demand" governor, and that's the default setting set by the kernel. I'm ok with that, since lower frequency means less energy spent. But I wanted to have a way to fix it anyway, I wanted to find a way to set my governor to "performance" (rated frequency at all times). All details are here. So I just needed to install the cpupower daemon and make sure that systemd was told to run it as startup. So, here are the commands:

sudo pacman -S cpupower
sudo systemclt enable cpupower.service

And to switch between "on-demand" and "performance" governors I just added the following to my ~/.fluxbox/keys file.

Mod4 p :ToggleCmd {Exec sudo cpupower frequency-set -g ondemand} {Exec sudo cpupower frequency-set -g performance}

That means that pressing the super key + p switches between the "on-demand" and "performance" governors. Of course, I had to add to add the following to my sudoers file:

myusername ALL=NOPASSWD:/sbin/shutdown,/sbin/reboot,/usr/bin/cpupower

Or else I'd have to keep inputting my password. The shutdown and reboot commands are there also so I can use those commands on Fluxbox's menu without supplying password (see my "Fluxbox: I liked it! :)" post)

31) One final tip: it's possible to issue Fluxbox commands through bash shell using the fluxbox-remote command. I used on a script that sets my VGA-out. Everytime I returned to the native resolution of my LCD screen Fluxbox would display the task bar in the middle of the screen. It can be easily set it back to it's right place by issuing the Reconfigure command on Fluxbox's menu, but I wanted to include this on the script so it would be done automatically. Anyway, here's the command I used on the script:

fluxbox-remote Reconfigure

It took me a while to find this command. I found it on the Arch Forum but I could not find it on the Fluxbox documentation.

32) I think that's it. That's the longest post I ever did, it took me around 4 nights (kinda) to get it done and I hope it helps someone. If you have any doubts about this "tutorial" (it's a lot of info!) you can drop a comment and I'll try to help.

In the end, here's my clean desktop :P

Arch is indeed fast. Not because it's actually faster than other distros, it's just because it runs what you tell it to run, no more, no less. Just so we can get a rough figure, on my post "Fluxbox: I liked it! :)" I wrote the RAM used just after logging in on Xubuntu and on my "Xubuntu turned Fluxbox" lappy. Just so you know, here are the number again:

Xubuntu (with compositing disabled) - 165.1 MB
"Xubuntu turned Fluxbox" - 95.8 MB
Archlinux with Fluxbox described above (and with preload running) - 69.3 MB

This old lappy is blazing fast again. :)

PS: I know that I said I was gonna try Slackware, and I was really gonna, but when I looked it up on the web, I found out that the Slackware team is already almost launching Slackware 14 (rememebr that was two-three weeks ago. Funny though, TODAY, Slackware 14 was released.


  1. I hope you do realize this shitload of info does not represent a n00b in any case. It's very detailed and well written and thanks for taking the time and effort, it just isn't written by a n00b. Best regards ^_^

  2. Actually I think I'm still a n00b. To write all that took some research and some reading through the Arch Wiki. I did not come up with that myself, you know. :P

  3. Great experiment!
    I want try too..
    But worrying about configure Arch, look like very difficult.
    If you're a noob, then I must be ultra-noob.
    I don't even able to handle my Ubuntu.