Computers‎ > ‎Linux‎ > ‎

Starting out

Created 10 December 2006; last updated 29 March 2008

Hindsight

Most of this was written "at the time" but I have tweaked it to improve the English and (usually in brackets) to clarify bits which have become clearer to me with hindsight :)

I began playing with linux in December 2006 and gradually switched to using free software (firefox, thunderbird, open office) during 2007. I finally made the complete switch to linux a year later during Christmas of 2007.

It's worth noting that despite the complexity of what I described below, my recent experience of installing slackware 13 on my ASUS eee pc was very straightforward, not just because my knowledge had improved but linux kernel support for all kinds of hardware is really quite impressive these days.

Introduction

This document is a description of my experiences setting up Linux on a Packard Bell EasyNote R0422 laptop. I bought the laptop with windows XP already installed on it as a quick, cheap (£399.99) replacement for my previous laptop which drank too much coffee and died. At the time I bought it I had no intention of installing linux on it.

I am quite experienced with computers. I can program in C, Java, PHP and have even done some assembly (long ago). I am used to Unix-like environments and have used Suns and linux during my PhD and subsequent academic career. These days I run a small educational software company and have been using Windows 2000 or XP on PCs. I started experimenting with linux to see if I could use it instead of microsoft products (I could!).

Which distro?

The first question I was faced with - and it would be the first of many - was which distribution? A bit of surfing on the web didn't produce any obvious choices, so for no compelling reason I chose Debian. However, my Dad had a Slackware 11 DVD to hand, so Slackware 11 is what I ultimately chose. Also Slackware - I forget which version (probably 3.0) - is what I used for many years in academia as a desktop and number-cruncher at work. That machine was on most of the time and never crashed - it only went down when I told it to.

Desktop was easy

My laptop is essential for my day-to-day work, so I didn't want to risk harming it. Also, I felt that installing linux on my less-essential home desktop machine would probably be less problematic - which turned out to be correct.

For reasons I won't go into, I had 35 Gb of unallocated space on my desktop's 120 Gb hard drive. So running in windows 2000, I used partition magic to create 33.5 Gb of a linux ext2 parition and 1.5 Gb of linux swap space (probably too much). This was incredibly easy and took little time.

I then inserted the slackware 11 DVD in the drive, rebooted and the setup procedure began. The "curses" sort-of-graphic user interface seemed very anachronistic, especially compared to the windows xp equivalent (which I've become too well acquainted with recently), but was perfectly adequate. I followed the prompts and answered some questions which were not too taxing and the copying of files began. I chose the "full" option which meant I could just leave it to install everything without any prompting.

Unfortunately, something went wrong and I was told that an essential file could not be copied. It must have been a freak error reading the DVD because my second attempt at installation, without doing anything different, went without a hitch.

It's been ages since I last logged on to a unix-like prompt, so I felt a bit lost sitting at the command prompt after logging on as root. However, I remembered the basic unix commands (ls, cd, mv, cp etc.) which was enough to start me wandering about the filesystem, looking at what had been installed.

I was able to ping the router, so the network setup for dhcp seemed to have worked. I then started lynx and began browsing the internet. I never used lynx much, but within a few seconds I was rejecting cookies and looking at news.bbc.co.uk. I was impressed that this all worked first time with no effort on my part.

I then wanted to start X windows, but couldn't remember what command to type. Then suddenly it popped into my mind. I typed startx and lots of messages scrolled past, then there was a blank screen for a few seconds and then the little X in the middle of the screen. KDE started up and once again, I found myself being very impressed at how easily it all worked.

I hadn't used linux since 2003. Back then I had redhat (can't remember which version) with Gnome. I didn't really get on with Gnome; it was a bit ugly and many of the configuration options either didn't work or were a bit flakey. I quickly returned to the command line for everything but web-browsing and graphics manipulation.

I warmed to KDE. It looked clean and simple and didn't look like it was trying to impersonate windows (although it shares features of Windows that I like, e.g. the "Start" button). The screen was 1024x768, which is a bit chunky on my 19" CRT monitor and the 60Hz was rather flickery; definitely not for reading novels online. I didn't try to reconfigure it as I was more interested in turning my attentions to my laptop.

Laptops can be tricky

The laptop

I'm using a Packard bell Easynote R0422 that came with Windows XP pre-installed. It has a Sempron 3100 processor, 512 Mb (later upgraded to 1.5 Gb), 50 Gb hard drive, ATI Radeon XPress 200M, WXGA (1280x800) display, Ali m5455 sound and Ralink RT2500 wireless card.

Partitioning

Before installing linux I used partition magic in windows to create a 20 Gb linux ext2 partition and a 1.5 Gb linux swap partition. Both of these were logical partitions inside an extended partition.

Next, I tried to install boot magic, but this failed because it wouldn't install into the partition containing windows XP because it was NTFS. So, I created a FAT16 primary partition and installed boot magic into that. (Mr hindsight says: learn to use cfdisk to partition and lilo as the boot manager).

Installing linux

I put the DVD in the machine, rebooted and tapped away at F8 to bring up the boot menu and selected boot from CD/DVD. Everything was the same as for the desktop except that I chose to install it as a "newbie" so I could take a closer look at the packages as they are installed. This was interesting but it took ages and I had to sit with it and keep hitting keys which was a bit boring. Despite this, it installed without a problem.

I rebooted and, as I expected, boot magic didn't know about linux; why should it? Once winxp was running I tried to reconfigure boot magic so it discovered linux, but here was the first big problem: the boot magic utility couldn't access the FAT16 partition. Hmm.

OK, I thought, I've got an idea: go into partition magic and yes, indeed, the boot magic partition was hidden. So I unhide it - but this doesn't work. After quite a bit of searching on the internet I found a guy who had the same problem and in response someone had kindly described a solution. This involved going into the disk management utilities that come with windows and using it to unhide the partition and assign a drive letter. I was then able to run the boot magic utility and let it find linux and install the relevant boot option. (Want to know exactly how I did this and the internet links? So do I - I haven't been able to unhide that bloody partition since. I'll plucked up the courage to install lilo to the MBR soon enough.)

Booting linux for the first time

I powered on, chose Linux at the boot magic prompt and was then given the Lilo prompt at which I again chose linux. The reason for having to select linux twice was that I installed Lilo in the linux partition and not in the master boot record. This seems a bit redundant, but using the MBR carried the slight risk of Win XP becoming unbootable - which would be very inconvenient. Also, it turned out to be handy later on when I started fiddling around with kernels (Mr Hindsight says this is daft, you can use lilo to boot xp just fine and switch between kernels easily).

Linux booted up successfully. Only two things caught my attention during all the boot messages that flew past: the ALSA sound interface warned that its mixer may be muted [this happened with my desktop machine too]; the gpm mouse utility for cutting and pasting in virtual terminals couldn't find /dev/mouse.

Next, I tried startx and now I hit my second problem: X would not start. I assumed it was the video, but after reading the error messages more carefully it seemed that it could be the mouse. I ran mouseconfig (well I didn't think to do that immediately, but after a while I figured it out somehow) and selected ps2 rather than usb. This brought the track pad to life, but didn't help to get the usb mouse to work (my laptop doesn't have a ps2 socket). The USB is another story that will come later.

Getting wireless networking

I know my laptop can connect to my wireless network because I use it in windows all the time. I've had a few fights with wireless networks in windows; one of them I lost to such a degree that I went out and bought a new network card. So I wondered what linux would be like.

Clearly, netconfig in slackware wasn't going to help me as I could see no trace of any wireless networking device. I then checked the web (on my desktop machine) and found that I had to use something called iwconfig.

iwconfig is a utility that lets you configure your wireless hardware for use with your wireless network: you can tell it the ESSID (same thing as SSID - the human readable name that identifies your wireless network), the encryption method and key, and much more besides. However, it did nothing at all for me.

I soon figured out that I needed a driver for the Ralink RT2500 wireless hardware in my laptop (this is now supported in the linux kernel). This I found and downloaded after a quick google. I unzipped the files, read the readme in the Module dir of the downloaded files and soon I had compiled and installed the module. [In the readme info for the driver I found a nice acknowledgment to a chap called Alan Flavell. He was a colleague of my Dad's at Glasgow Uni and had recently died. This was the second time I'd found an acknowledgment to him on the web - a good, fitting and understated tribute.]

Now I tried typing iwconfig ra0, ra0 being the name of my wireless device in linux. Now I could see some details on ra0, but any attempt at telling it my ESSID or encryption key seemed to result in failure: I couldn't even ping the wireless router.

At this point I came across the iwlist command. Typing iwlist ra0 scan showed me the details of my wireless etwork, so I felt there was some hope. I turned off all the encryption in the router and tried again - success! I could now ping the router. So it seemed to be the encryption that was causing the problem. I later discovered that I was supplying the key to iwconfig as a text string, but it seems that supplying the key in hex code is more reliable. Unfortunately, I didn't know my key in hex code (Mr Hindsight says running wpa_passphrase as root helps with this).

I read some more of the documentation that came with the RT2500 driver. I had three methods of configuring my wireless hardware: iwconfig which didn't work; using a utility that came with the driver; or creating a config file. The utility seemed promising, but its GUI was confusing and seemed to mirror troubles like those I'd seen with iwconfig. The config file method worked though and soon I was able to connect to the wireless network using these commands:

insmod rt2500.o (Mr Hindsight says use modprobe instead of insmod)
ifconfig ra0 up
dhcpcd

The file /etc/Wireless/RT2500STA.dat contains all the config details (e.g. SSID) needed by the rt2500 driver module which it reads on being loaded. You can see the details of my file here, though I've removed my SSID name and key for obvious reasons.

Configuring scripts in rc.d

Setting up the wireless connection manually wasn't good enough for me - I wanted it there automatically when I booted up the laptop. I figured out a clumsy way to do this - call a script from my .login - but soon realised that the more elegant solution is to edit the .conf files in the /etc/rc.d directory. I fiddled around with them a bit before realising that the only one I needed to change was rc.inet1.conf - click the link to see the very simple settings for ra0. Also, the line:

alias ra0 rt2500

appears in my /etc/modules.conf and /etc/modprobe.conf [I think only one of these is necessary, but I'm not sure which one.]

Getting WXGA 1280x800 resolution

Typing startx got me into X with KDE, though there were some corrupt screens during the startup process. Also, I was stuck with 1024x768 and my requests for 1280x800 at 24bpp in xorg.conf for my widescreen laptop were ignored.

I tried to find drivers for the ATI radeon XPress 200M on the web, but kept finding tales of woe regarding ATI. However, I noticed that these tales of woe tended to come from folk who wanted to do 3d/accelerated things, like play Quake 3.

There turned out to be an easy fix: edit xorg.conf and replace the Driver "vesa" with Driver "ati" - the generic ati driver. (Again, I spent ages trying more complicated things before hitting on this simple solution.)

Slow "Looking up..." in firefox (DNS)

Firefox spent ages loading pages with "Lookup up..." appearing for about 5 seconds at the bottom left of the browser window. It seemed that Konqueror also suffered from this problem, but didn't give me such an obvious message.

From the command line typing commands like:

nslookup google.com

took ages first time and then were near-immediate on subsequent attempts. So my internet was working, but waiting 5 seconds on first visiting a site turns surfing the web into a painful exercise in nose-hair removal.

After some reading around on the web (which took ages), I realised I should look at resolv.conf - which looked like this:

# Generated by dhcpcd for interface ra0
search nalu
nameserver 192.168.2.1
nameserver 194.168.4.100
nameserver 194.168.8.100

These settings come from the DHCP setup - the process whereby your ISP or router or other server dishes out an IP address to you. It also tells you what nameservers you can use, hence the 3 lines in resolv.conf. In my case, I have a wireless router with IP 192.168.2.1 that most often dishes out the address 192.168.2.2 to my laptop. According to resolv.conf, it then specifies itself as a nameserver and also adds the two from my ISP.

After some experimentation I discovered that specifying the router as a nameserver was the problem. I commented out this line and my slow dns problems disappeared:

# Generated by dhcpcd for interface ra0
search nalu
#nameserver 192.168.2.1
nameserver 194.168.4.100
nameserver 194.168.8.100

This is only a temporary fix because resolv.conf will get rewritten every time the dhcp transaction occurs - most usually at startup. To prevent this you could hunt down dhcpcd in /etc/rc.d/rc.inet1 and manually insert -R, which will stop resolv.conf from being overwritten. However, although a common suggestion on forums, this is an inelegant solution. In my case, the better way to achieve the same result was to add a line to set DHCP_KEEPRESOLV to "yes" in /etc/rc.d/rc.inet1.conf.

There was an added complication in that my laptop uses the wireless connection at home and a wired connection at work. This means keeping the same resolv.conf caused me problems. In the short term I just kept two copies of resolv.conf and manually copied the appropriate one. (Later I stumbled across the solution of reconfiguring my home network to be 192.168.1.*. For reasons I don't undersand, this fixed the dns lookup delay and allowed me to let the DHCP process write resolv.conf each time.)

En route to solving the slow dns problem, I also disabled the use of ipv6 by including these lines in /etc/modprobe.conf:

alias net-pf-10 off
alias ipv6 off

(Later, in slackware 12 I just had to insert an entry in the /etc/modprobe.d/blacklist file to blacklist the ipv6 module.)

Another thing I tried, that worked for other folk, even on windows, was to type about:config into firefox's URL bar, then enter ipv6 into the filter and set the disableipv6 parameter to true.

Changing window manager

This is nice and easy. Create a symlink from .xinitrc to the one you want in /usr/X11R6/lib/X11/xinit/, for example:

ln -s /usr/X11R6/lib/X11/xinit/xinitrc.fluxbox xinitrc

Alternatively, you can su to root and run xwmconfig, which you probably last saw when you installed slackware.

Compiling my kernel

I painlessly upgraded my Slackware 11 install to have my own compiled 2.6 kernel. Alas, I didn't keep detailed notes on this, but this is probably because I carefully followed the instructions in the text files that came on the Slackware DVD and on pages such as this thread.

These instructions relate to the 2.6 kernel, which is slightly different to the process for the 2.4 kernel. The kernel source lives in /usr/src/linux, which is a symlink to linux-2.6.17.13 (or whatever version you're using). I followed the steps as set out in www.slackbook.org. In summary, the steps are:

  • cd /usr/src/linux
  • make mrproper
  • make menuconfig
  • make bzImage V=1
  • make modules
  • cat arch/i386/boot/bzImage > /boot/vmlinuz-mynewkernel
  • cp System.map /boot/System.map-mynewkernel
  • cp .config /boot/config-mynewkernel
  • make modules_install

Note that "make mrproper" will wipe the .config file in /usr/src/linux. The idea is that you'll then go through and laboriously set all the options with make menuconfig. In practice, especially if you just want to tweak one or two settings, you should reinstate a previous (or one from /boot shipped  with slackware) .config file to tweak - something like this:

  • cd /usr/src/linux
  • cp .config .config-bak
  • make mrproper
  • cp .config-bak .config
  • make menuconfig
  • then the same as above...

(If you're switching to a more recent kernel version then you need to use make oldconfig so that you set new kernel config options.)

I do differ from slackbook's procedure slightly in that I symlink vmlinuz, System.map and config in /boot to the -mynewkernel ones. (I believe that make install does this for you, but I prefer to do this manually). This lets me switch between kernels more easily and keep track of the config files that generated them. I also put several entries in lilo.conf so I can switch between known good kernels easily.

Once I've done all this, I've then got to rebuild my ati driver and driver for my ralink wireless adapter. I also have to rebuild alsa from sources to get the sound working, but I've got a feeling this might not be necessary most of the time if I remembered the last step above [make modules_install], which I always forget!

Getting the USB mouse to work

I had real problems getting the USB mouse to work. After bashing my head against a brick wall editing xorg.conf, I realised that USB support wasn't compiled into my kernel or its modules.

Oops, how did that happen? I think this goes back to a mistake I made in compiling the kernel: I did make mrproper, which wipes the .config file, and then forgot to copy back my old .config file and then didn't notice the mistake in using make menuconfig and ended up with loads of things missing from my kernel.

Once I realised what had happened, I recompiled the kernel with the relevant USB options. The USB mouse then worked right away - not even an edit of /etc/X11/xorg.conf was needed.

This lead me to understand a golden rule of linux (that most advanced users think is so obvious that it doesn't need mentioned!):

If you're doing what the docs say and what everyone says should work in forums, then check support for the feature is compiled into the kernel or available as module that is getting loaded correctly.

Better resolution/font on the console, outside X

This seemed very simple: just add a line vga= in lilo.conf and then run lilo and reboot. Alas no, it didn't work at all - the vga parameter was completely ignored.

This turned out to be another case of the golden rule: I hadn't got support for this in the kernel. I recompiled with the appropriate kernel settings [in device drivers->graphics support] and then it worked. See man lilo.conf for details on vga settings.

ċ
RT2500STA.dat
(0k)
Andrew Conway,
9 Jan 2010, 09:21
ċ
lilo.conf
(1k)
Andrew Conway,
9 Jan 2010, 09:21
ċ
rc.inet1.conf
(1k)
Andrew Conway,
9 Jan 2010, 09:21
Comments