Frank Ridderbusch


About things, that are of interest to me (in English and in German).


Odroid Kernel Update with root on disk

TL;DR

How to update the kernel on an Odroid C1, which is running off an USB hard disk as root-fs.

Intro

At home I’m running a small Odroid C1 with Arch Linux. The main applications on this little board are OwnCloud for all my cloud storage needs, tt-rss as my main news feedreader and finally a Git repository. I’ve been running OwnCloud and tt-rss on a Synology one bay home NAS, but since the NAS is only equipped with a 700Mhz single core Marvel ARM CPU this became painfully slow. Therefore I offloaded these applications to the Odroid. With 4 cores running @1.5Ghz this board is quite a bit more powerful than the Raspberry PI in all its incarnations.

The cable TV provider connects me to the internet with 50Mbit down- and 2.5Mbit upstream. 2.5Mbit upstream is not much, but for my needs in cloud storage (in particular syncing notes managed with Emacs, Org-Mode and Deft-Mode) this is working quite nicely. tt-rss is also frugal in terms of bandwidth.

By default the Odroid uses an eMMC or a standard µSDHC card for the installation of the operating system. I originally used a 32Gb µSDHC for the installation of the Arch Arm Linux distribution. The Odroid runs 24/7 and not really a system for playing any more, but actually a real production system. Maybe I’m a bit paranoid, but I would think, that µSDHC don’t measure up to real SSDs intended for usage in computers and servers in terms of reliability. And since I had an unused 2" disk lying around from updating a laptop to SSD and with the addition of a powered USB-hub and a SATA-to-USB adapter I moved the operating system from the µSDHC card to the hard drive.

Here are pointer into my link collection about the process to move the root-fs to a hard disk and also some information about powered USB-Hubs

Procedure

I don’t generally update the kernel, once a new kernel appears in the ARCH repository. Over time there where 1 or 2 kernels, which were causing a bit of trouble for me. Then I normally proceed with the update process by running the command

# pacman -Suy --ignore linux-odroid-c1

to update everything except the kernel. Once the kernel version stays static for a period of 2 or 3 weeks, I’m going to update to that kernel version as well.

Since the Odroid C1 does not boot via the USB connected hard drive, the boot process must continue to work with the µSDHC card. Therefore the kernel must be updated in both locations, on the hard drive and on the µSDHC card.

So first I’m updating the kernel on the hard drive by executing

# pacman -Suy linux-odroid-c1

Next step is to update the µSDHC card. I’m mount the root-fs on the card to /mnt and shadow- or bind-mount /mnt/boot and /mnt/lib/modules to the same directories on the disk.

# mount /dev/mmcblk0p1 /mnt
# mount -o bind /mnt/lib/modules /lib/modules
# mount -o bind /mnt/boot /boot

Then I’m re-installing the kernel once again.

# pacman -Suy linux-odroid-c1

Finally the directories from the µSDHC can be unmounted and the Odroid rebooted.

# unmount /lib/modules
# unmount /boot
# unmount /mnt

That’s it. I’ve found this to be the safest way to update the kernel without accidently overwriting the configuration in /boot/boot.ini, which is modified to select the USB hard drive for the root-fs.

Afterthought

I choose the approach to simply move the whole of the µSDHC to the hard disk and switch the root-fs in the boot.ini file. Because of this I need to remember to update the kernel on µSDHC every time I install a new kernel.

Another option would be to keep the /boot directory permanently on the µSDHC in a partition of its own and have it mounted below the /boot directory on the hard disk. This would have been a little more effort at the point of switching the root-fs, but might have been easier in the long run.

But since the above listed command lines are basically permanently available in the shells history buffer, it doesn’t really matter.