Renovating an old media PC
· 4 min read · August 28, 2020 · #old #linux #rescueSome notes from my first attempt to renovate an old media PC that had a SYSLINUX install without any package management, and a crufty BIOS. Probably outdated now, but I may go back to it one day…
First, some background links:
- https://en.wikipedia.org/wiki/Cylinder-head-sector
- https://en.wikipedia.org/wiki/FAT_boot_sector
- https://en.wikipedia.org/wiki/Logical_Block_Addressing#CHS_conversion
- https://en.wikipedia.org/wiki/Master_Boot_Record
- https://en.wikipedia.org/wiki/Volume_boot_record
- https://wiki.archlinux.org/index.php/Syslinux
- https://wiki.syslinux.org/wiki/index.php?title=Common_Problems#Failed_to_load_ldlinux
- https://wiki.syslinux.org/wiki/index.php?title=Hardware_Compatibility#USB_related_problems
- https://wiki.syslinux.org/wiki/index.php?title=Hdt_(Hardware_Detection_Tool)
I explored two ways forward: SYSLINUX and GRUB.
SYSLINUX
I found that getting SYSLINUX working required moving the partition to 0/1/1 – using sectors per track of 63 or 32, and heads per cylinder or 16 or 64 with appropriate cylinder values simply didn’t help.
Diagnosed by observing that console displayed only CRLF but no banner – SYSLINUX code ends up with the banner to be displayed just falling into the second sector on the disk, so it can’t be read unless the geometry is correct. Don’t ask why old fashioned whirling metal disk geometry needs to be set for a USB stick, you’ll be sad.
Formatting the USB stick
Some runes, use at your own risk.
One exciting gotcha: the fdisk utility in the util-linux package didn’t work – but the one in busybox did!
Putting MBR in place
Obtaining and installing memtest86
Putting locally built SYSLINUX in place
Unfortunately, getting hdt working required rebuilding as the Alpine package version doesn’t appear to statically link against libupload.a from SYSLINUX tree so doesn’t work. Fixing required make bios in the SYSLINUX tree after installing dependencies including:
GRUB
Similar behaviour: GRUB2 displayed the GRUB message and nothing else, The Ubuntu wiki says this is the “can’t find MBR or euqivalent” information. In fact, it’s the same issue: subsequent progress requires reading the second sector, but I had a CHS/LBA mismatch meant it wasn’t reading from the right sector and so hanging.
To wipe the stick
To partition the stick
In this case, to be bootable with a single ext4 partition
…or alternatively, possibly
To format the partition, and install grub and the master boot record
At this point, booting off the stick will bring htpc to GRUB error stage, indicating GRUB has loaded but doesn’t know anything about how to continue.
Install memtest
Install Alpine ISO for booting
Add the following stanza to GRUB config, above:
Miscellaneous cribs
I did of course forget that the
Bluetooth keyboard requires a dongle to be plugged in which is stored inside the battery compartment. Doh. Making a note so I don’t forget again.
Adding internal hard-disk
Required partitioning and formatting:
- find where disk is mounted:
sudo lshw -C disk -shortassume new disk is/dev/sdX, flash disk is/dev/sdF - partition disk:
sudo parted /dev/sdX mkpart primary ext4 1 -1 - format disk:
sudo mkfs.ext4 -m0 /dev/sdX1 - label disk:
sudo e2label /dev/sdX1 Harddisk - remount flash disk rw:
mount -o remount,rw /dev/sdF - edit
/boot/extlinux.confso APPEND line reads:APPEND boot=LABEL=System disk=LABEL=Harddisk quiet
I screwed up the first time by not correctly labelling the disk so had to make an Ubuntu rescue USB stick. Couldn’t get this to work using MacOS, though didn’t try putting GRUB on via MacOS.
- download ISO: http://ubuntu-rescue-remix.org/
- boot
ubuntu-rescue-remix-12-04.isovia virtualbox - mount USB stick on
/dev/sdXat/mnt:mount /dev/sdX /mnt - format the stick:
mkfs.vfat -n multiboot /dev/sdX1 cd /mnt && mkdir boot isogrub-install --force --no-floppy --boot-directory=/mnt/boot /dev/sdX- create ISO from mounted cd:
dd if=/dev/cdrom of=/mnt/iso/ubuntu-rescue-remix-12-04.iso - create
/boot/grub/grub.cfgwith
where N is partition number, typically 1.
Finally, for backup purposes, addons are stored in /storage/.xbmc/addons/packages, and the following Alpine packages were useful to install for some of the above, diagnostics, etc: