‹ MacBook Pro restoration - Kitchen RadioBuilding SuperCollider for piCore Linux 2 ›

TiBook restoration - Offline Laptop

2021-12-10 21:04 other

Last autumn I spent time restoring my old computers. I wanted to start using them for various things again. One, a 20-years old Titanium PowerBook G4 667 MHz, was in good shape and didn't need much work. My idea was to have it as an offline laptop - a distraction-free machine for reading e-books and playing around with a BSD operating system.

offline laptop

I thoroughly cleaned the keyboard and removed dust from inside the fan and air vents. I also replaced the old thermal paste with new. That required some work because to get access to the CPU and heatsink on these models one need to unscrew and disconnect nearly everything inside. But it was interesting and worth the effort. This computer now runs cool and the fan hardly ever turns on. The good guide on iFixit was helpful.

In the process, I also replaced the hard disk with a 16 GB Asiproper mSATA SSD and an mSATA to 2,5" 44pin IDE adapter. That made the laptop faster overall and also made it run much quieter. The old spinning hard disk was quite noisy. There is now only a tiny vining sound during operation (from a coil I believe), but that does not bother me much.

The laptop battery was dead so I removed it and recycled the cells. It is a slight annoyance to have the laptop plugged in with the power adapter cable at all times. I might try to reconstruct the battery pack with new LiPo 18650 cells.
Another drawback with an old PPC machine like this is that its current consumption is fairly high - at least compared to how slow it computes. In use, this laptop draw 21-35 Watts depending on the screen brightness and what I do with the computer, and when completely powered off 3.8 Watts! So I make sure to always unplug it when I'm done using it.

The built-in speakers and the matte display are okay, the DVD player is working and the trackpad and keyboard are very nice to use. It is a joy to type on this laptop and without the battery, the machine doesn't weigh much.

The display hinges feel good but I take extra care not to twist or put stress on the lid as I know these can break on these PowerBook models.

There is 512 MB of RAM installed (2 x 256 modules). I thought of buying more and upgrading to the maximum of 1 GB, but these types of SO-DIMM memory modules are both hard to find and I feel I can't justify the cost as the operating system I'm running (see below) uses less than 70 MB.

Whenever I need to transfer files or get network access I connect an ethernet cable. There is no WiFi or Bluetooth. It should be inconvenient to get online - it's a feature.

OpenBSD

For the operating system, I picked OpenBSD. Mainly because I wanted to study and learn more about it, but also because it is still updated and supported for PPC 32-bit machines.
In the process, I also tried FreeBSD, MintPPC, VoidLinuxPPC, Debian and Adelie Linux but encountered various problems. Nothing worked as good and was as easy to install as OpenBSD. Mac OS9 or OSX (10.4 perhaps) would have been other options, but I already have several machines that run these systems.

The following instructions show how to set up OpenBSD version 7.0 on a macppc laptop using another laptop plus a USB stick to prepare the installer.

Note: The internal hard disk will be erased and overwritten.

Preparation

On another machine (here macOS):

  • download install70.iso for macppc
  • check that the iso file checksum compares with this SHA256 string
    sha256sum ~/Downloads/install70.iso
    
  • insert an empty USB stick and format it as FAT MBR (I used Disk Utility)
  • write the iso file to the USB stick
    WARNING: This is dangerous! Double-check that you are targeting the USB stick (here disk2) and not some other drive
    diskutil list #and take note of the disk number of the USB stick (here disk2)
    sudo diskutil umount /dev/disk2s1 #make sure disk2s1 the USB stick
    sudo dd if=~/Downloads/install70.iso of=/dev/rdisk2 bs=1m #make sure rdisk2 is the USB stick
    

Now move the USB stick over to the PowerBook for installation and...

  • power on while holding down the keys O+F+CMD+ALT. This should take you into Open Firmware
  • boot from the USB stick iso with the following command...
    boot usb0/disk:,ofwboot 7.0/macppc/bsd.rd
    

If that does not work try changing from usb0 to usb1 in the line above. Also, note the space after ofwboot and perhaps edit 7.0 to match the version you downloaded.

The laptop should now have booted and started the OpenBSD installer.

Installation

This is easy. Just answer some questions accepting the default answer for the most part. For this PowerBook, there were only two things I choose to do differently: said yes to start X window system by xenodm and said yes to continue without verification.

i #for Install
HOSTNAME #system hostname?
[gem0] #network interface
[autoconf] #IPv4 address
[none] #IPv6 address
[done]
PASSWORD #for root account
[yes] #start sshd by default?
yes #X window system started by xenodm?
[no] #change default console?
USERNAME #for user account
FULL NAME
PASSWORD
[no] #allow root ssh login?
[wd0] #wd0 is internal SSD disk, sd0 is USB
[MBR]
[yes]
[whole] #use whole disk
[a] #auto layout
[done]
disk #location of sets?
no #already mounted
[sd0] #which disk contains the install media?
[7.0/macppc] #pathname to the sets?
[done]
yes #continue without verification?
[done]
Europe/Berlin #enter a valid timezone
[done]
[reboot] #press and hold down O+F+CMD+ALT

Back in Open Firmware set up a few environment variables (it also seem to work without these but for safety)...

printenv
setenv auto-boot? true
setenv skip-netboot? true #optional - speeds up booting a little bit
setenv boot-device hd:,ofwboot
shut-down #remove the USB stick, start again and log in as USER

Customisation

Now OpenBSD should be up and running. Here are a few things I did to set up and customise my system...

Allow doas, do not ask for password for reboot and shutdown:

Replace USER with your username from above...

su
echo 'permit persist keepenv USER' >> /etc/doas.conf
echo 'permit nopass USER as root cmd reboot' >> /etc/doas.conf
echo 'permit nopass USER as root cmd shutdown' >> /etc/doas.conf
exit

Save the SSD a bit by enabling TRIM:

doas cp /etc/fstab /etc/fstab.bak
doas sed -i 's/rw/rw,softdeb,noatime/g' /etc/fstab

Update the system:

This requires internet access.

doas fw_update -a #optional: install non-free firmware (I didn't)
doas syspatch #patch the system
doas pkg_add -Uuv #update apps and more
doas reboot

Install suckless window manager, terminal, status and launch menus:

It is also possible to skip this section and instead install a more traditional desktop environment like Xfce.

doas pkg_add git nano

git clone https://git.suckless.org/dwm
git clone https://git.suckless.org/dmenu
git clone https://git.suckless.org/st
git clone https://git.suckless.org/slstatus

cd ~/dwm
nano config.mk #uncomment FREETYPEINC = $(X11INC)/freetype2
ftp https://dwm.suckless.org/patches/functionalgaps/dwm-functionalgaps-6.2.diff
git apply dwm-functionalgaps-6.2.diff #optional: patch dwm to use gaps
cp config.def.h config.h
nano config.h #edit the resizemouse line to use SHIFT+ALT+MOUSE for resizing windows
  { ClkClientWin, MODKEY|ShiftMask, Button1, resizemouse, {0} },
make
doas make install

cd ~/dmenu
nano config.mk #uncomment FREETYPEINC = $(X11INC)/freetype2
cp config.def.h config.h
nano config.h #optional: edit number of lines in launcher...
  static unsigned int lines = 12
make
doas make install

cd ~/st
nano config.mk #uncomment CPPFLAGS etc. (4 lines)
ftp https://st.suckless.org/patches/alpha/st-alpha-0.8.2.diff
git apply st-alpha-0.8.2.diff #optinal: patch terminal for transparency
make
doas make install

cd ~/slstatus
nano config.mk #and add -lsndio where it says OpenBSD
cp config.def.h config.h
nano config.h #optional: edit status bar...
  { cpu_perc, " cpu: %s%% |", NULL },
  { ram_used, " mem: %s |", NULL },
  { datetime, "%s", "%F %T" },
make
doas make install

Unfortunately, slstatus does not work well on this old PowerBook. E.g. cpu_perc returns a constant of 100% and the sensor for temperature is not found.

Turn off additional console window at login:

doas sed -i 's/xconsole/#xconsole/' /etc/X11/xenodm/Xsetup_0

Switch to ZSH shell:

doas pkg_add zsh
chsh -s zsh

Set up the .xsession file:

Adapt en and US below to match your keyboard layout and preferred language.

nano ~/.xsession #and add the following

  export ENV=$HOME/.zshrc
  export LC_CTYPE=en_US.UTF-8
  setxkbmap us
  xidle -program "/usr/X11R6/bin/xlock -mode blank -lockdelay 10 -timeelapsed" -timeout 480 &
  xsetroot -solid black
  slstatus &
  exec dwm

Log out and in again to make the changes work.

Set a wallpaper:

Optional: with feh it is easy to set a desktop background. compton together with the alpha-patched st from above results in a semi-transparent terminal.

doas pkg_add compton feh
nano ~/.xsession #edit and replace xsetroot with the following two lines

  compton &
  ~/.fehbg &

mkdir -p ~/.config
ftp https://wallpapercave.com/wp/QjyrBg9.png #or some other png or jpg
mv QjyrBg9.png ~/.config/wallpaper.png
feh --bg-fill ~/.config/wallpaper.png

Install pdf and epub readers:

doas pkg_add zathura-pdf-poppler epr-reader

Reduce the boot time:

A bit of an annoyance is that OpenBSD takes a long time to boot. 1 minute 45 seconds in my case. This is mainly due to security features that for example shuffle around the address space layout at each boot (ASLR).
To save 25 seconds in boot time I turned off ASLR with the command...

doas rcctl disable library_aslr

This is of course not recommended, but for a machine like this that is mainly offline and for what I'm using it for, I believe it is alright.

Conclusion

All in all, I am very happy with this laptop and that it continues to function and be of use after 20 years.
The cost of fixing this up - the new mSATA SSD plus IDE adapter - was around €20.

‹ MacBook Pro restoration - Kitchen RadioBuilding SuperCollider for piCore Linux 2 ›