Wednesday, January 10, 2018

Latitude D520 Arch install

Problem: your grandparent or a teacher's assistant needs a work-a-day laptop, but you're not a first responder, professional athlete, or an investment banker. As long as the thing will mostly sit on a table (5lbs), 2007 Latitude D520's are available on EBay for about $60. Load 'em up with 2 Gigs of RAM, Arch Linux and IceWM and the things can do the trick with an $80 budget.

base CLI (runlevel 2) configuration :: 20 mins

There's no UEFI or other boot complexities on older systems. The only real question is whether to make multiple partitions. The instructions below include multiple partitions. If multiple partitions aren't desired, just make two primary partitions in cfdisk: a linux (83) SDA1 and a linux swap (82) SDA2, and jump from the step mounting on /mnt to the step with mkdir /mnt/etc
# mkswap /dev/sdb3
# swapon /dev/sdb3
# free -m [check swap is on]
# mount -rw -t ext3 /dev/sdb2 /mnt
# mkdir /mnt/home
# mount -rw -t ext3 /dev/sda1 /mnt/home
# mkdir /mnt/boot
# mount -rw -t ext3 /dev/sdb1 /mnt/boot
# mkdir /mnt/etc/
# genfstab -p /mnt >> /mnt/etc/fstab
# pacstrap /mnt base
# arch-chroot /mnt
# ln -s /usr/share/zoneinfo/US/[zone]
# mkinitcpio -p linux
# passwd
# pacman -Syu grub
# grub-mkconfig -o /boot/grub/grub.cfg
# grub-install /dev/sda
# exit
# reboot

X install :: 20 mins

These Dells have the Intel integrated graphics 945GM; the correct xf86 driver is the Intel VA driver.
# pacman -S xf86-video-intel
This driver now uses DRI3 as the default Direct Rendering
Infrastructure. You can try falling back to DRI2 if you run
into trouble. To do so, save a file with the following
content as /etc/X11/xorg.conf.d/20-intel.conf :
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "DRI" "2" # DRI3 is now default
#Option "AccelMethod" "sna" # default
#Option "AccelMethod" "uxa" # fallback
EndSection
# pacman -S xorg-server xorg-apps xorg-xinit xorg-xrandr
If you scroll down this Arch page discussing Xorg, we can see that we'll want the mesa for Open GL and lib32-mesa for older apps. Also, Intel chips, as we know (scroll down to about item 13), do not support VDPAU, viz:
"Intel Embedded Graphics Drivers do not support VDPAU. VDPAU stands for video decode and presentation API for UNIX*. VDPAU is an open source library and API originally designed by NVIDIA that provides an interface to support hardware-accelerated video decode."
... and so Intel sez libVA is correct. More specific to Arch, there's additional information in their video acceleration page, if you like to read. The only problem with the VA-API is it can't decode MP4 and FLASH containers, but it does all other common formats, and all codecs, including H264 and the new VP8 and 9. I just use MKV and AVI containers and set the VLC codec to VA (instead of its default VDPAU). In spite of inefficiencies on the Intel hardware, some may wish to overlay VDPAU functionality onto their Intel chip, which is an installation beyond this post. If a person does that, any mistakes will defeat X working properly -- no harm, just revert to runlevel 2 and reconfigure until Xorg is working well. FYI, one of the tweaks I've seen for VIDPAU overlaid onto VA, is adding "export VDPAU_DRIVER=r600"in one's ~/.xinitrc file. Anyway, back to pure libVA...
# pacman -S libva libva-intel-driver libva-tools libva-mesa-driver
... then check the install with "$ vainfo".

window manager :: 10 mins

On an old system, I don't waste memory with display managers, instead I login and "startx" from runlevel 2. I like Ice Window Manager, a light interface with simple text configuration, wallpaper, and menu files (look inside ~/.icewm ). Efficient on older systems: perhaps 150M usage after logging-in, connecting to network, and starting X.
# pacman -S icewm
$ cp /etc/X11/xinit/xinitrc .xinitrc
$ nano .xinitrc
exec dbus-launch icewm-session
$ startx
I also looked here to get the names of additional drivers, for example to solve the pesky touchpad problem. I couldn't stop the Dell touchpad with synclient TouchPadOff=1 until I # pacman -S xf86-input-synaptics.

wifi digression :: 60 mins

Some of these old Latitudes have the dreaded Broadcom 43 series card. For example, if users run lspci and the wifi readout line is this or similar...
Network controller: Broadcom Limited BCM4311 802.11b/g WLAN (rev 01)
... then it's unlikely the typical fix for older cards, # pacman -S wireless_tools will have effect. It's also unlikely anything will appear in either of these two verification steps...
# iw dev
# cat /proc/net/wireless
If this is the case, the easiest move is installing yaourt and building a b43 driver, but take note:
"BCM4306 rev.3, BCM4311, BCM4312 and BCM4318 rev.2 have been noticed to experience problems with b43-firmware. Use b43-firmware-classicAUR for these cards instead."
During that b43-firmware-classicAUR install, the following warning was displayed...
Please add $VISUAL to your environment variables
for example:
export VISUAL="vim" (in ~/.bashrc)
(replace vim with your favorite editor)
...and you may also encounter
~/.config/aurvote must have username and password. Run: aurvote --configure
...if you installed the yaourt rating app but hadn't configured it. You can use any username and pass you like. Reboot after this install, and something like this is normal:
# iw dev
phy#0
Interface wlan0
ifindex 3
wdev 0x1
etc..

QT or Gtk

I try to stick with one or the other to keep a smaller install and shorter update. Sometimes both become necessary. I prefer GTK (except gvfs), but VLC requires QT. QT is about 400MB, and typically pulls in PyQT. But since I'm a fan of VLC ... QT became my baseline API.
# pacman -S qt4

sound

I avoid PulseAudio as much as I can. See my post from 2016. ALSA is now built-in, so that all that's required is alsamixer in order to control the sound levels (unmute, etc)
# pacman -S alsa-utils
Done.