Sunday, November 30, 2008

Arch linux resurrects ancient Desktop Part 1

Those of us that have worked on computers for a while invariably end up with other people's discards. It was my luck to come into possession of an old Gateway ---. It's a pentium 2, with a 450 mhz processor and 64 megs of ram. It also comes with a 24x cd-rom (dead on arrival), a ten gig hard drive, and a standard floppy. It came with a voodoo banshee 8 meg agp card, but the vid card is dead (hence the reason for my coming into possession of this box).


I figured that it was time to pimp this bad boy out and put it back to work, and my niece was in need of her own computer... So I scrounged around and decided to add the following .A 32 meg matrox g450 to handle the video duties. A soundblaster live! (emu10k1) sound card will handle audio (as the onboard audio is crap). An additional 10 gig western digital hard drive, slaved to the 10 gig matrox for storage... An addition 192 mb of pc100 ram, in the form of another 64 mb stick, and a 128 mb stick. Standard ps2 keyboard and mouse, and a 4.8x Toshiba DVD drive to replace the cd-rom. I also wanted wireless, so I threw in an old atheros wireless card that I had recently resoldered. A 15” packard bell monitor, and some old stereo pc speakers round out the hardware, and it's on to choosing an operating system to power this machine.


There are many possible choices here, and a good case could be made for many, but at the end of the day, I chose Arch Linux to power this machine. The reason being, I'm very familiar with Arch, and I've been running Arch on my main desktop (a core 2 duo 4300 @ 2.4 ghz) for quite some time. I also knew that I would be building the OS from the ground up, and I would choose EXACTLY what was going to run on this machine.


I followed the excellent instructions from the beginner's guide located at http://wiki.archlinux.org/index.php/Beginners_Guide


For my installation media, I burned the current core iso, as an ftp install could be a pain as I'd have to get wireless up and running first.


I entered /arch/setup and started on my way. I ignored the section on networking at the start for now. The current kernel has both the ath5k module and the ath_pci module available so I knew I was going to have to deal with this in rc.conf, which I'll cover later.


I decided to set up a one gig swap at the beginning sector of the first hard disk (sda1). I probably could have gotten away with a 512 mb swap, as hard disk thrashing could slow things down considerably on an old machine like this, but I wanted to ensure that my niece's computer was rock stable.


Normally, I like to have a separate /boot partition to house grub as my boot manager, but as this was going to be the only operating system on this computer, I didn't feel the need to do this. So I simply made a root (/) partition for the remainder of the first hard disk (sda2).


The second hard disk houses home (/home), and I used the entire 2nd hard disk for the user and her files.


The installer wanted a reboot at this point so after entering /arch/setup once again I was back on track.


It's time to select and install packages! The only things I really had to look out for in choosing packages was to make sure that I selected the madwifi packages, wireless tools and wpa_supplicant. If I forgot anything else right now, at least with these packages installed, I can access the net later and install them.


I didn't need to customize anything else with the kernel, and then selected nano as my text editor, which I would need to edit the config files next. Vim is great, but I tend to be a tad lazy sometimes and nano is just too easy.


Next up was editing rc.conf. There were a couple of things I wanted to take care of here. First off, I changed the timezone to “US/Central”. Next up, I checked out the modules. Sure enough, both ath5k and ath_pci were listed, so I placed a ! in front of ath5k to let rc.conf know not to load it. The ath5k module has come a long way, but it's still not at the functional level of ath_pci at this point, and since I'm going to be connecting to a wpa2 network ath_pci is simply a better choice at this time.


Commenting out the eth0 portion was my next step, and then I added a line under that one so that my atheros wireless card could access dhcp. (ath0=”dhcp”)


Heading on down to the daemons section of rc.conf, I placed a @ in front network, so that the machine wouldn't wait for network to come up before fully booting. Ctrl X and I was done with rc.conf


I verified /etc/fstab and found it to be populated correctly. Since I'm going to be using hal to mount my dvd drive, I placed a # in front of that entry to comment it out, so that hal will handle the drive.


The next file I had to look at was /etc/hosts. /etc/mkinitcpio and /etc/modprobe.conf didn't need any editing. In /etc/hosts I added the hostname for the computer like so

127.0.0.1   localhost.localdomain   localhost yourhostname   She's not going to be using ssh, so /etc/hosts.deny and /etc/hosts.allow can be left in their default state.  On to /etc/locale.gen.  Upon perusing the file, I ensured that en_US ISO-8859-1 and en_US.UTF-8  were uncommented.  Ctrl X out of this file and locale.gen generated my locales.  Setting a root password and selecting a local pacman mirror were done.  I had to edit one line in grub to set root to hd0,1. Saved the file and I was ready to reboot!  I rebooted into my new arch system and decided my next step was to get wireless running.  A quick lsmod showed me that ath_pci was loaded.  The iwconfig command verified that I had a usable interface (ath0).  Next was activating the device which was done with “ifconfig ath0 up”. I then typed “iwconfig ath0 essid MyNetwork” to associate with my network.  It was now time to configure wpa_supplicant.  I typed “mv /etc/wpa_supplicant.conf /etc/wpa_supplicant.conf.original” to back up the wpa_supplicant file in case I somehow managed to hose it.  Then I had to generate the code that wpa_supplicant would use to access my network “wpa_passphrase myssid mypassphrase > /etc/wpa_supplicant.conf” where myssid is the name of my network and mypassphrase is the name of my password to access the network.  “nano /etc/wpa_supplicant.conf” and verified the files and success!  It's time to activate wpa_supplicant “wpa_supplicant -B -Dwext -i ath0 -c /etc/wpa_supplicant.conf”. And then “dhcpcd ath0”. “ifconfig ath0” verified that I was indeed connected to my router and net access was attained!  “pacman -Syu” was my next step to fully update the system to current.  The wireless needed to come up with the machine and automatically connect, so I selected the package known as “autowifi”. I also wanted dhcp to be used so I selected dhclient as well.pacman -S autowifi dhclient Following the arch wiki http://wiki.archlinux.org/index.php/Autowifi , I added this to the begining of /etc/wpa_supplicant.conf “ # general options # Don't change this path to something else: ctrl_interface=/var/run/wpa_supplicant # Give everyone in the group "users" access to the control interface # required if you want to dynamically configure the network via wpa_cli or wpa_gui # without being root ctrl_interface_group=users eapol_version=1 ap_scan=1 fast_reauth=1 Then I edited the file /etc/conf.d/autowifi to access my ath0 module and not the default wlan0.INTERblsp-spelling-error" id="SPELLING_ERROR_40">ath0" CONFIG="/etc/wpa_supplicant.conf" “

/etc/autowifi/networks/default had dhcp selected, so no modification was needed here.


I was sure to add dhclient to my daemons array in /etc/rc.conf and I backgrounded it to speed up bootup. Ie, added a @ in front of the dhclient entry. Then I added autowifi to my daemons in /etc/rc.conf file as well to ensure it would start at bootup as well.


It was now time to reboot the system as when updating the system, there was a new kernel and several other new files as well, and to take advantage of them a reboot was in order.


After the reboot it was time to set up a user account. Logged into root, and then issued the following:


useradd -m -G users,audio,lp,optical,storage,video,wheel,power,hal -s /bin/bash myuser 

This gave me a user with access to common functions, and ensured she would be able to access her external usb hard drive, and her ipod.


Sudo was the next item on my list to install, so I went ahead and typed “pacman -S sudo”.


As a side note, you can use nano to setup visudo (the sudo configuration file). I didn't bother as I'm familiar with vi, but for those that aren't you can start visudo with nano by issuing this command

EDITOR=nano visudo  In the section labeled User privelege specification add your user like so


# User privilege specification

root ALL=(ALL) ALL

myuser ALL=(ALL) ALL

Ctrl X to save in nano or :wq! In vi and you're set with sudo!


It's now time to install alsa for sound and xorg for a working graphical environment. The soundblaster live! and the matrox g450 are both well supported under linux, so this should prove no trouble..


sudo pacman -S alsa-utils

Then “sudo alsamixer” I set the volume and tick the soundblaster digital output jack. Escape to exit and then “sudo alsactl store” to save the settings.


I want alsa to start at boot so I add it to the daemons array in /etc/rc.conf


sudo pacman -S libgl

sudo pacman -S xorg

sudo pacman -S mesa”

sudo pacman -S xf86-video-mga


This will install an xorg environment for use with the mga matrox video driver.


There are several ways to detect your hardware in xorg. I prefer an application known as “hwd”.

sudo pacman -S hwd

sudo hwd -xa

This will populate xorg, and it does a pretty good job of this.

sudo nano /etc/X11/xorg.conf” to peruse the results. The little 15” monitor doesn't handle 1024x768 very well, so I removed those resolutions from the modes subsections of the screen section. Saved and exited.


With the limited resources of this box, I would have to choose a lightweight desktop environment to gain functionality. Since I promised my niece the use of this box once I'd fixed it up, it would also have to be easy enough for her to use with minimal intervention of my behalf.... so a straight openbox build was not going to be familiar enough for her. I narrowed it down to 2, IceWM and lxde. Seeing as lxde will auto populate the menus without outside intervention, and also the fact that I've never used it and I'm curious about it, lxde it is.


I want pmount to handle automounting of disks, and the filemanager pcmanfm handles this task nicely with pmount... which is a good thing as pcmanfm comes standard in an lxde install.

sudo pacman -S pmount

This pulls in hal and dbus as well.

Then I added hal to the daemons array in /etc/rc.conf to start at boot.


It's now time to install the DE.

sudo pacman -S lxde gamin”

This installs lxde along with gamin, which is a drop-in replacement for fam. Fam is default on arch, but I've always found it pretty buggy and much prefer gamin.

The lxde programs installed are gpicview, lxappearance, lxde-common, lxlauncher, lxpanel, lxrandr, lxsession-lite, lxtask, lxterminal and pcmanfm.


“As a note here, lxterminal segfaulted whenever I tried to run it. So I installed gnome-terminal instead. “sudo pacman -S gnome-terminal” gnome terminal does not require gnome to be running and pulled in no other dependencies.”


It's now time to set up my .xinitrc file to allow logging into X.

cp /etc/skel/.xinitrc ~/”

nano ~/.xinitrc

There is no default entry for lxde, so I added the following line

“exec startlxde

I made sure there was no # before it and that all other entries had a # before it. Saved and exited the file.


I figure it's time for some fonts so that the DE doesn't look like crap. =)

sudo pacman -S ttf-ms-fonts ttf-dejavu ttf-bitstream-vera


It's now time to see what we have.

startx


I've now booted into a nice shiny lxde installation and I must say that it looks good. It's laid out in a sane manner, with a nice menu.


That's all for today. Next up, I'm going to select lightweight software to run on this box and install the login manager “slim” to start at bootup.


Thanks for reading and if you have questions, feel free to drop me a line.

No comments: