User:Ratfactor

From ArchWiki

Hello! I'm new here. I'm running Arch on an old laptop. My website is: ratfactor.com.

My install/configure log

This is my experience installing and configuring an old laptop: HP Compaq Presario V5000 (p/n ET821UA#ABA.)

Booting the ISO

I booted the computer from a freshly-burned Arch ISO 2014.04.01 CD. I brought up the Arch Wiki Beginners' guide on my desktop computer and started following along.

A wired ethernet connection

Once the live CD version booted and I saw a command prompt, I checked for a net connection:

ping -c 3 www.google.com

Nothing. So I looked at the available interfaces:

ip link

The eth0 interface showed NO-CARRIER and the wireless device did not show up at all, so I connected a cat5 cable to the ethernet port and awkwardly balanced the laptop on poor choice of surface near my network switch. Getting the wired network working was easy:

ip link set eth0 up

Then:

dhcpcd eth0

And I was able to ping the outside world. I decided to fiddle with the wireless network after I'd installed Arch on the laptop.

Formatting the partition

The laptop already had a big partition (which I was willing to sacrifice to Arch) and a little partition for a Windows XP factory restore. I did not need to alter the partitions, so I was able to skip the partitioning steps and go straight to creating the filesystem for Linux. I checked my partition device names with:

fdisk -l

and then formatted the main (first and biggest) partition with:

mkfs.ext4 /dev/sda1

I checked the partition layout with:

lsblk -f

and mounted the new ext4 partition I just formatted with:

mount /dev/sda1 /mnt

Installing Arch

Now I was able to install the base system:

pacstrap -i /mnt base

I followed the fstab creation as directed:

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

And it looked fine, though I'm not sure I'm qualified to judge its correctness.

Chrooting and configuring

Now for the exciting part, I got to chroot to the new file system:

arch-chroot /mnt /bin/bash

I edited my locale file:

vi /etc/locale.gen

and uncommented the line with:

en_US.UTF-8 UTF-8

Then I ran:

locale-gen

Set the locale.conf:

echo LANG=en_US.UTF-8 > /etc/locale.conf

And exported the LANG variable:

export LANG=en_US.UTF-8

Then I located my timezone and set it with:

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

I set the hardware clock to use UTC:

hwclock --systohc --utc

I set the hostname:

echo archvile > /etc/hostname

And added the hostname to the hosts file:

vi /etc/hosts

Installing the b43 wireless firmware

Then it was time to try to get the wireless connection working. It took me about 2 hours to figure out how to do this for my Broadcom wireless device.

I checked for firmware in the kernel messages:

dmesg | grep firmware

and using lspci:

lspci -k

I determined that I had a Broadcom BCM4318 controller and that I would need the b43-firmware package from the AUR. Figuring out that I needed this package and how to install it from the AUR took the bulk of my time.

First, I needed to install the base-devel package to be able to make AUR packages:

pacman -S --needed base-devel

Then, I needed to use curl to download the b43-firmware tarball:

curl -O https://aur.archlinux.org/packages/b4/b43-firmware/b43-firmware.tar.gz

Then extract the ball-o-tar to a new builds dir:

mkdir builds
tar -xvzf b43-firmware.tar.gz -C ./builds

Make the package. I absolutely ran this as root (my only account, of course!) and crossed my fingers that no evil would come of it:

cd builds/b43-firmware
makepkg -s --asroot

Then installed the package:

pacman -U b43-firmware-5.100.138-2-any.pkg.tar.xz

I honestly can't remember if I rebooted at this point or what, but I know that running:

lspci -k

and

ip link

made it clear that my wireless device was working with the firmware driver. I was feeling good about that.

I was not able to scan for a wireless access point yet, so I decided to continue with the install and get back to wireless later.


Installing Syslinux bootloader

Anxious to be booting into my new install, I installed the Syslinux bootloader because I got the impression from the beginner's guide that it would be a simpler install than GRUB (and I have absolutely no need for something like a dual-boot scenario on this laptop):

pacman -S syslinux

I misunderstood the instructions and thought that the /boot/syslinux/syslinux.cfg file would be used by the installation to know where to write the boot record, so I first configured the .cfg file:

vi /boot/syslinux/syslinux.cfg

wherein I changed both entries with /dev/sda3 to /dev/sda1.

Then I installed the bootloader:

syslinux-install_update -i -a -m

I rebooted, removing the live CD media, and found myself at a login prompt with no way to login. Oops! I had skipped the step to create the password for the root account! So I booted back in from the CD, re-mounted the /dev/sda1 partition and chrooted to it and set a password for the root account:

passwd

Then I removed the live CD again and rebooted. From here on, I was booting from the hard drive (/dev/sda1 partition).


Creating a user account

The first thing I remember doing after booting from the hard drive, was creating a regular user account for myself:

useradd dave
passwd dave

My /home/dave directory wasn't created automatically, so I tried to create it myself with sudo:

sudo mkdir /home/dave

But I was surprised to find that I wasn't listed in the 'sudoers' file. I'm used to these things happening automatically with other distros. But that's okay, that's why I chose Arch this time around. It's about the learning experience. I figured out how to add myself:

man sudoers
visudo

I added

dave ALL=(ALL) ALL

underneath the existing entry for root ALL=(ALL) ALL. Wow, am I ever glad I invested some time in learning Vi a while back. It really is the default editor of *nix systems.

That worked.


Installing Vim, tmux, and ELinks

Vim

I installed vim because the default Vi was just too darned primitive (inserting a character and seeing the change shouldn't be quite THAT hard):

pacman -S vim

I made it an alias for 'vi' by editing bash.bashrc:

vi /etc/bash.bashrc

and adding the line:

alias vi=vim

so that Vim is the default vi for all users.

tmux

I also installed tmux

pacman -S tmux

and found it absolutely invaluable to be able to read man pages or write notes while also running commands. I only know a few essential commands:

Ctrl+B and then
% - splits screen left/right
" - splits screen top/bottom
Up/Down/Left/Right - set focus to a panel
; - set focus on last panel

ELinks

Finally, I installed the elinks browser

pacman -S elinks

and I like it quite a bit more than Lynx so far. The only shortcuts I've learned as of now:

g - go to a url (g g <search text> to do a Google search)
t - open a tab
c - close a tab
enter - edit a text field/submit form
q - exit

Scanning for a wireless network

At this point, I was still tethered to a short ethernet cable and wishing for some sweet wireless freedom.Learning how to scan for a network and authenticate with wpa_supplicant took about 3.5 hours.

My biggest problem was that running:

iw dev wlan0 scan

returned absolutely no results. I went down a dozen blind alleys before I decided to simply try to authenticate with my wireless router by creating a wpa_supplicant.conf file for it with:

wpa_passphrase <my router ssid> <my passphrase> > /etc/wpa_supplicant/myhome.conf

I double-checked it:

cat /etc/wpa_supplicant/myhome.conf

and using it to connect and authenticate:

wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/myhome.conf

After hours of trying to scan for networks, it was finally connected to my wireless router! Then I commanded DHCP to get me an IP address and such:

dhcpcd wlan0

now I was finally able to ping Google through the wireless network. Hooray!

ping www.google.com

It was after this that I actually realized that running a scan with the {ic|iw} command still would not return any results the first time it would run, but would return results on a second run...

# iw wlan0 scan | grep SSID
# iw wlan0 scan | grep SSID
... list of device SSIDs ...

This appears to have nothing at all to do with the wpa_supplicant authentication at all. I tested it againa and again after multiple reboots and it's quite consistant. First scan: nothing. Second scan: results. Who knows how much time I could have saved if I had only tried it twice in close succession much earlier! I'm not sure if the wireless chip goes to sleep and the first scan wakes it up or what...but I'm glad all of that's behind me. I hope someone else reads this someday and saves themselves some trouble.

Just to keep from having to re-connect manually every time I booted until I got my systemd script working, I created a bash script to connect automatically:

vi wifi

containing

#!/usr/bin/bash
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/gauerhome.conf -B
dhcpcd wlan0

and set it to executable

chmod +x wifi

so that I could run it at the command line after logging in with:

./wifi


Getting a wireless connection at boot

I used the instructions on the Wireless network configuration wiki page to create a systemd 'unit' file:

vi /etc/systemd/system/network-wireless@.service

And typed it almost verbatim from the example:

[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/ip link set dev %i up
ExecStart=/usr/bin/wpa_supplicant -B -i%i -c/etc/wpa_supplicant/myhome.conf
ExecStart=/usr/bin/dhcpcd %i
ExecStop=/usr/bin/ip link set dev %i down
[Install]
WantedBy=multi-user.target

It contains essentially the same commands as my wifi script, with the addition of the {ic|ip link up} command, which is probably good practice, and with the addition of the -B switch, which tells wpa_supplicant to run in the background so that it doesn't take over STDIN and STDOUT.

After fixing a few typos in the above, I got it to run without errors with:

systemctl start network-wireless@wlan0.service

And enabled it to run at boot with:

systemctl enable network-wireless@wlan0.service

Which was very exciting.

Finally, I rebooted to test the startup process. The first thing I did was

dmesg | grep wlan0

which returned:

[    3.935073] systemd[1]: Expecting device sys-subsystem-net-devices-wlan0.device...
[   14.050718] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   21.980740] wlan0: authenticate with d8:50:e6:95:d7:c6
[   21.993923] wlan0: send auth to d8:50:e6:95:d7:c6 (try 1/3)
[   21.995772] wlan0: authenticated
[   21.996761] wlan0: associate with d8:50:e6:95:d7:c6 (try 1/3)
[   21.999572] wlan0: RX AssocResp from d8:50:e6:95:d7:c6 (capab=0xc11 status=0 aid=2)
[   22.000092] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   22.000404] wlan0: associated

And the success was confirmed with

ping google.com

and

elinks http://google.com

Very exciting. Hopefully this concludes the difficult portions of the installation and configuration for me.


Next...

Well, my current hobby language is Tcl, so I immediately installed it. I also need to get some sort of network file transfer action going. I have a Synology NAS, so I plan to install NFS and configure it to connect to the NAS.