Notice (2020-01-02): In version 19.10, Ubuntu included native support for Raspberry Pi, which makes most of this post obsolete for any Ubuntu release after 19.04.
Over the last two years I got used to have small server at home. The first time I connected my old Pine64 to the net it was just because I wanted to see if I was able to do it. Later on came this web site, my private Gogs repository, and some other fun projects that I have been missing for the last months. Finally, I could not resist longer, and I ordered a new SoC to play with: a Raspberry Pi 3 B+.
The RasPi 3 B+ came out last march, but, despite more than three months have passed, the only Linux distributions that can be run on a RasPi 3 B+ out of the box are NOOBS and Raspbian, which are maintained by the Raspberry Pi.
But I wanted something more general to run on my new RasPi. And, coincidentally, a few days ago, Ubuntu 18.04.1, the first dot update for this LTS release… but still without official support for the RasPi 3 B+. Ubuntu also released the corresponding version of its Server flavor, which in my opinion is just wonderful to run on a RasPi.
Fortunately, there is a page on the Ubuntu website (https://wiki.ubuntu.com/ARM/RaspberryPi) on which it is explained how to adapt a “Classic” official build for the Raspberry Pi 2 B to run on the RasPi 3 B and the 3 B+. Unfortunately, these instructions seem not to be accurate enough: at least, I was not able to get my RasPi to boot by following them. So I started researching, trying, and finally, after a long while, I was able to get it to work (it would probably have taken less time and effort if I was not running the RasPi headless, only through an Ethernet cable, without a monitor or keyboard).
The instructions on how to get it done are the following:
Grab the official build for the RasPi 2 B. I guess the contributed one for the RasPi 3 B would also do, but I wanted to start from an official release.
- Go to http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/ and grab all the
.debset of files corresponding to the latest date available, and also the matching firmware
.tar.gz(or you can just click the links below). For me, those were:
Write the Ubuntu Server 18.04.01 image to a micro SD card. Remember that you will need one that is at least 8 Gb!
Mount the SD card on your favorite linux distro. You will see two partitions:
Delete everything except
system-bootpartition. Yes, do it, do not worry.
Extract all the files in the
system-bootpartition of your micro SD.
dtoverlay=vc4-kms-v3dline to your
config.txtto enable the VideoCore4 (
vc4) kernel module and enable hardware graphics acceleration. Also, you might also want to add a
gpu_mem=128line to increase the memory available to the GPU (I haven’t done it).
Copy all the
.debfiles to the
/rootdirectory of your RasPi (you will need root privileges!).
Unmount the micro SD and put it into the RasPi.
Connect your RasPi either your monitor and keyboard, or Ethernet cable (make sure you have a DHCP server sunning on the other end!). Be warned: wireless will not be working yet, mostly, because the drivers are still not installed. But we will come to it.
Be patient! The first time it boots, the RasPi may need some time to set some things up before you can access it. If you plugged it into a monitor, you will probably be able to see progress. Else, if you are hardcore and are running it headless, your only indication is the green led: it might pause for some seconds, but it should be lit most of the time during the first 30 seconds or one minute. Also, you can monitor the logs of your DHCP server, and see when the RasPi grabs an IP address, and from there on, ping it and scan port 22 to see when it opens.
If after a couple of minutes your RasPi has not booted, you can try to turn it on and remount the micro SD on your computer. If it managed past U-Boot and booted into Ubuntu, you will find
journalctl’s logs under
/[mount point]/cloudimg-rootfs/var/log/journal/. In this directory you will find another one, whose name consists in a long string of letters and digits. Go inside and use
journalctl -D .to see the log. Hopefully, you will find something that tells you what went wrong.
Uninstall all packages related with the RasPi 2 B. First of all,
sudo -sto become root, then, use
dpkg -l | grep raspi2to see which ones are installed, and then,
Install all the
.debs that you downloaded a while ago. Still being root,
cd /root, and then
dpkg -i *.deb(I think this last comment was like that… if not Google it!).
- Finally, the wireless. Just do as the Ubuntu page says. Or copy and paste these lines into your terminal:
mkdir wifi-firmware cd wifi-firmware wget https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm/brcmfmac43455-sdio.bin wget https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm/brcmfmac43455-sdio.clm_blob wget https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm/brcmfmac43455-sdio.txt sudo cp *sdio* /lib/firmware/brcm/ cd ..
Now your RasPi is almost ready to be used. You just need to customize the configuration to your liking. I would recommend:
- Set your RasPi’s hostname, both in
/etc/hosts(do not forget to add your hostname to the localhost line!).
- Configuring your ethernet and wireless networking under
- Setting your time zone and locales:
wireless-toolsto manage the wireless interface.
command-not-found… that thing makes me nervous!
- Disable some services that you are not going to use:
systemctl disable snapd.service,
- Install the minimal build tools:
apt install build-essential bison flex
- Am I forgetting something? Recommendations? Leave a comment!
Enjoy your RasPi!