20190310

Odroid U2: From Ubuntu 16.04 minimal to Ubuntu 18.04 Desktop — a Tutorial

Intro

A while ago, I mean, quite a while, in 2012, I bought an Odroid U2 from Hardkernel. I liked the feature set and also the form factor, which reminded me of a mini NeXTcube. So my original plan was to get FreeBSD and then GNUstep for that thingie, not knowing at that time that every SoC (in this case the Samsung Exynos 4412) needed a special port to be supported by an OS (I thought ARMv7 support to be generic, like Darwin 1.4.1 x86 did run on my AMD Box in the days, when Mac OS X for Intel was still far away). However, this never became a reality, despite asking several times on the FreeBSD-Arm mailing list. So I lost interest in this and the poor Odroid settled dust buried somewhere in my stowage …


… until lately. Something reminded me that I still had an Odroid. I wanted to play with it and scrambled my whole stowage until I found it. It came with some rather vintage Android installed on it's microSD card (hence the name Odroid), which I didn't like from the beginning. I needed something more recent, like let's say Ubuntu 18.04. Here I have to mention that the Odroid U2 is EOLed for quite a while now and Hardkernels support has never been the best. But I still had hope an finally found this thread, however, the offered minimal Ubuntu 18.04 image did not work for me (and others). So, after a while browsing the Odroid forum, I found this post, which inspired me to try the same.

How I did this

Download the minimal Ubuntu 16.04 image and install it

#!/bin/bash

fdisk_first() {
        p2_start=`fdisk -l /dev/mmcblk0 | grep mmcblk0p2 | awk '{print $2}'`
        echo "Found the start point of mmcblk0p2: $p2_start"
        fdisk /dev/mmcblk0 << __EOF__ >> /dev/null
d
2
n
p
2
$p2_start

p
w
__EOF__

        sync
        touch /root/.resize
        echo "Ok, Partition resized, please reboot now"
        echo "Once the reboot is completed please run this script again"
}

resize_fs() {
    echo "Activating the new size"
    resize2fs /dev/mmcblk0p2 >> /dev/null
    echo "Done!"
    echo "Enjoy your new space!"
    rm -rf /root/.resize
}


if [ -f /root/.resize ]; then
    resize_fs
else
    fdisk_first
fi
  • log in onto your odroid using ssh root@ from your Laptop/Desktop and then paste the above script into vi,nano or whatever editor you prefer. Save the script as resize.sh
  • then run the script before and after a reboot:
chmod +x resize.sh
./resize.sh
reboot
./resize.sh

Upgrade to Ubuntu 18.04

sudo apt install ubuntu-release-upgrader-core

sudo apt update

sudo apt upgrade

sudo reboot

sudo do-release-upgrade -d

sudo reboot

From Server to Desktop

(see also: https://askubuntu.com/questions/322122/switching-from-server-to-desktop)

sudo apt-get update

sudo apt-get install tasksel

sudo tasksel

sudo reboot

Some additional things

For some reasons unknown to me gnome-terminal is not working, it crashes on launch. To solve this problem I just installed xterm:

sudo apt-get install xterm

When examining the first image I created in a hex editor, I found that a lot of clutter from deleted Android files was still there (which probably was a leftover of the original Odroid Android from the 16.04 image I downloaded) So I decided to remove this by first defragmenting the disk and then wiping the free disk space:

sudo apt-get install e2fsprogs
sudo apt-get install secure-delete

sudo e4defrag -c /
sudo e4defrag -v /

sudo sfill -llz -v /
sudo sfill -llz -v /media/boot

This also resulted in a smaller xz compressed image file since free space is so much easier to compress … :)



Some things for you to do

  • Download a readymade Ubuntu 18.04 Desktop Odroid U2 / U3 Image for a 128GB microSDXC card here.
  • It is strongly recommended to disable remote ssh login for the user root since this makes remote attacks much harder! ssh login for root came in handy during the installation process and is enabled in the minimal Ubuntu 16.04 image I used as a starting point.
  • You might want to pin the MAC address of your Odroid to a fixed value so you don't get always a new IP address after each reboot. I found this: https://forum.odroid.com/viewtopic.php?f=77&t=30654#p245732 a working solution (the way like the first solution offered in this thread (post 11) did not work for me)
  • When you created the image file yourself (instead of using mine) you might experience a file system damage on the minimal Ubuntu 16.04 image. The boot partition (FAT16) had a damage, which I later repaired (the downloadable image should be fine). You can repair such images using a second SD-Card to boot from and then plug in an the SD-Card you want to repair using an USB-Adapter.
  • Report back to me whether this image works on a Odroid U3 or X2.
  • Have fun!