AArch64 on Raspberry Pi 2 (rev 1.2), 3B, 3B+

I just successfully installed the 64-bit Xubuntu OS on my pi, thank you so much for your help!

Thank you SOOOOOOOOOO much for your awesome work!

Iā€™m using the armfh image, which works amazingly awesome. And I think this could be the only working ubuntu image on the whole internet after so many days searching around.

You saved my life. Thanks again, sincerely!

Sorry to bother, but I want to know how do i resize the filesystem so that I can use my full sdcard storage? This is the only one question I want to know. Thanks a lot!

I found it!

sudo fdisk /dev/mmcblk0
p # list the partitions, read the ā€œstartā€ section of the second partition, remember it
d # delete the last ( second ) partition
n # re-create the second partition
2 # use the same parition number: 2
270336 # this is the start section of your second partition, 270336 is the value in my codition
# press enter, use all spaces left
w # save the partition table

sudo resize2fs /dev/mmcblk0p2

Done!

If you follow the armhf link I included instructions for how to use growpart to do this. Seems easier than fdisk, but ultimately they do the same thing!

Iā€™m very pleased you found the image useful!

With a win10, is it possible to create a partition on a sd card ?

Thanks

From an administrator account search for disk management.

If anybody is interested in a 32 bit armhf version of Xubuntu 18.04 to compare with the 64 bit version, then you can download an image of Xubuntu-core here:

(this is the same file as previously linked earlier in the thread)

(Unofficial) Xubuntu-core armhf - https://1drv.ms/u/s!AvHY_kl4hMB4gQIR4CLRKQzh-GP0

Sha256sum - eb68ba83ccf9ea2974e3a3399c3e08cec819f71a2184efe133640c0796bddd81 xubuntu-core-18.04-preinstalled-desktop-armhf+raspi2.img.xz

Unlike the above arm64 installer it is a disk image like Raspbian/Ubuntu-Mate. Follow generic Pi instructions to write the image to SD card/USB drive. Should work on the 2, 3B and 3B+.

EDIT: I recommend on first boot you donā€™t have an Ethernet cable connected so it doesnā€™t download and install updates automatically. Itā€™s best to expand the filesystem firstā€¦

On first boot youā€™ll be asked to enter a username, location etc. Once in the desktop youā€™ll want to resize the root partition to fill the remainder of the disk. The easiest way to do this is probably with growpart (here mmcblk0 is the SD card):

sudo apt update
sudo apt install cloud-guest-utils
sudo growpart /dev/mmcblk0 2
sudo resize2fs /dev/mmcblk0p2

Xubuntu-core is a minimal set of applications. There is no browser or text editor! To get a more standard xubuntu desktop:

sudo apt install ^xubuntu-desktop

Firefox armhf is working in 18.04!

Is /boot/config.txt missing or just in a different location (for the 32-bit armhf image)?

Hi Zacherl, yes config.txt is in /boot/firmware for armhf and arm64. More info here https://wiki.ubuntu.com/ARM/RaspberryPi#Raspberry_Pi_packages

Raspbian and (current versions of) Ubuntu-mate mount the fat partition as /boot, but that requires a few hacks to overcome debian packaging restrictions. It is not a very good thing to do. For this reason debian and Ubuntu server mount the fat partition as /boot/firmware. This is consistent with how things are done on other architectures. For example, efi partitions are mounted at /boot/efi.

Ahh thank you :slight_smile: found it. You seem to have some experience with the custom ubuntu distros for raspi. May I ask you what steps exactly you performed to get from the official image to the 32-bit armhf version you linked?

Did you just exactly follow this guide:
https://wiki.ubuntu.com/ARM/RaspberryPi#Booting_the_official_Pi_2_image_on_the_Pi_3B.2F3B.2B-

Your image works fine on my 3b+ but I want to replace xubuntu with lubuntu (and I do not trust the system to completely remove the old desktop with the commands you posted some answers above).

Yes I booted my 3B following those instructions. Once I had a working environment I then built the installer in a similar way to https://wiki.ubuntu.com/ARM/RaspberryPi#Building_Raspberry_Pi_3_images . To make the armhf image I did an extra step of an oem install.

If you are just doing this for yourself, then you can start with the server, remove the cloud image stuff (slows boot time) and install lubuntu-desktop.

An even cleaner way is to boot the armhf mini iso. There are several ways you can do this, but probably the simplest is to take the raspi2 kernel vmlinuz and use the mini isoā€™s initramfs. I can give more instructions if this is something you want to pursue and canā€™t figure it out.

[quote=ā€œstillwinter, post:35, topic:16853ā€]There are several ways you can do this, but probably the simplest is to take the raspi2 kernel vmlinuz and use the mini isoā€™s initramfs. I can give more instructions if this is something you want to pursue and canā€™t figure it out.
[/quote]

This sounds interesting. Would love to get more instructions.

These are very rough instructions still. It is possible to script this rather nicely, taking advantage of debianā€™s preseeding to automate the install. The following has been written for armhf, but you can easily adapt it for arm64.

First download the latest kernel packages from Launchpad https://launchpad.net/ubuntu/+source/linux-raspi2/ e.g.

wget https://launchpad.net/~canonical-kernel-security-team/+archive/ubuntu/ppa/+build/15482714/+files/linux-image-4.15.0-1024-raspi2_4.15.0-1024.26_armhf.deb
wget https://launchpad.net/~canonical-kernel-security-team/+archive/ubuntu/ppa/+build/15482714/+files/linux-modules-4.15.0-1024-raspi2_4.15.0-1024.26_armhf.deb

Next, create a working directory and extract vmlinuz and the dtb files

dpkg-deb -x linux-image-[0-9]*raspi2*.deb /tmp/pi-kernel
dpkg-deb -x linux-modules-[0-9]*raspi2*.deb /tmp/pi-kernel
mkdir pi-installer
cd pi-installer
RASPI_VER="$(ls /tmp/pi-kernel/boot/vmlinuz* | sed 's,^\/tmp\/pi-kernel\/boot\/vmlinuz-,,g')"
# Note, in arm64 device tree files are in a broadcom folder
cp /tmp/pi-kernel/lib/firmware/$RASPI_VER/device-tree/bcm2710*.dtb .
cp /tmp/pi-kernel/boot/vmlinuz-$RASPI_VER vmlinuz
# Copy the device-tree overlays too if you need them

Download the Piā€™s bootloader files - https://wiki.ubuntu.com/ARM/RaspberryPi#Updating_the_Pi_GPU_firmware_and_bootloader_files - and save to pi-installer

Create a cmdline.txt with your favourite text editor. Paste in:

grub-installer/skip=true partman-swapfile/size=1024 partman-swapfile/percentage=10 --- quiet net.ifnames=0 dwc_otg.lpm_enable=0 modprobe.blacklist=sdhci_iproc

Create a config.txt with the contents:

# boot in AArch64 (64-bit) mode
#arm_64bit=1

# Kernel and initramfs
kernel=vmlinuz
initramfs initrd.img followkernel

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

Download the initrd for the mini/netboot installer

wget http://ports.ubuntu.com/dists/bionic/main/installer-armhf/current/images/generic-lpae/netboot/initrd.gz

Iā€™ll assume you have an Ethernet connection you can use, but if you want to do this over wifi then you need the files for your machine https://wiki.ubuntu.com/ARM/RaspberryPi#WiFi and follow https://help.ubuntu.com/lts/installation-guide/armhf/ch06s04.html or maybe https://wiki.debian.org/DebianInstaller/NetbootFirmware

This is enough to get the installer started since the raspi2 kernel has a lot of modules built in. However, youā€™ll probably find you get stuck at the detecting disks stage. Iā€™m guessing this is due to missing modules.

The debian-installer doesnā€™t use standard deb packages, but expects everything to be packaged up as udebs. This includes lots of kernel udebs that include the modules. Unfortunately the raspi2 kernel doesnā€™t have any udeb module packages. A way around this is to copy all the kernel modules into the initrd:

# evbug spams the logs, get rid
rm /tmp/pi-kernel/lib/modules/$RASPI_VER/kernel/drivers/input/evbug.ko

# Generate modules.dep etc files
depmod -a -b /tmp/pi-kernel -F /tmp/pi-kernel/boot/System.map-$RASPI_VER $RASPI_VER

# Remove unneeded files
rm -r /tmp/pi-kernel/lib/modules/$RASPI_VER/initrd 
rm -r /tmp/pi-kernel/boot
rm -r /tmp/pi-kernel/usr
rm -r /tmp/pi-kernel/lib/firmware/$RASPI_VER

# Add raspi2 modules to the initrd and compress
gunzip initrd.gz
find /tmp/pi-kernel/.  | sed 's,^/tmp/pi-kernel\/,,g'| cpio -D /tmp/pi-kernel -R +0:+0 -H newc -o -A -F initrd
gzip initrd

We can save a few future steps if we change the name of initrd.gz to initrd.img

mv initrd.gz initrd.img

Format an SD card with MBR/msdos partition table. Create fat partition as partition 1. Create Linux partition as partition 2.

Copy everything you have in pi-installer to the fat partition. Stick it in the pi and turn on! There is a very long pause at the rainbow screen because the initrd is huge with all the kernel modules. You should eventually see the debian installer.

There will be a warning message about the lack of kernel modules. Skip it. Choose manual partitioning and give partition 1 the mount point /boot/firmware. Donā€™t format it. Give partitition 2 the mount point /

If Iā€™m installing a desktop then I choose the ā€œno automatic updatesā€ option.

Eventually the installer will hit an error at the ā€œMake system bootableā€ stage. Drop to a shell using the menu option.

Create a new cmdline.txt

# if you are installing to a usb drive use root=/dev/sda2
echo "root=/dev/mmcblk0p2 $(echo $(user-params)) elevator=deadline rootwait ro" > /target/boot/firmware/cmdline.txt

If you have a 3B+ then you need to add an entry to the flash-kernel database. See https://wiki.ubuntu.com/ARM/RaspberryPi#Update_flash-kernel_database for more details.

nano /target/etc/flash-kernel/db

Remove the installer initrd.img and vmlinuz just in case the fat partition is on the small side

rm /target/boot/firmware/initrd.img
rm /target/boot/firmware/vmlinuz

Currently the generic-lpae kernel is installed on the target system. We need to install the raspi2 kernel:

mount -o bind /dev /target/dev
#This next command turns the screen black.  Wait for the cursor to appear in the bottom left of the screen.
#Install linux-raspi2 if you need the header packages
apt-install linux-image-raspi2
umount /target/dev

If the above was successful there should be an initrd.img and vmlinuz on the fat partition:

ls /target/boot/firmware

Return to the menu by typing exit. Select the ā€œSkip bootloaderā€ option. Finish the install and reboot!

Once in the installed system, the final thing we need to do is remove the generic kernel:

OLD_KERNEL="$(readlink /boot/vmlinuz.old | sed 's,^vmlinuz-,,g')"
sudo apt-get --autoremove purge linux-generic-lpae linux-image-generic-lpae linux-headers-generic-lpae linux-image-$OLD_KERNEL linux-headers-$OLD_KERNEL linux-modules-$OLD_KERNEL linux-modules-extra-$OLD_KERNEL

Thatā€™s it! Phew!

1 Like

Thank you for creating this. Iā€™m new to raspberry pi and ubuntu so this has been helpful. I used the xubuntu-core-18.04-preinstalled-desktop-armhf+raspi2.img.xz and when I power on my pi 3 b+ I get these messages

[ 2.840838] Error: Driver ā€˜sdhost-bcm2835ā€™ is already registered, abortingā€¦
[ 4.322842] hub 1-1.1.2:1.0: hub_ext_port_status failed (err = -71)
[ 4.323049] usb 1-1.1.2: Failed to suspend device, error -71
[ 5.310902] hub 1-1.1.2:1.0: hub_ext_port_status failed (err = -71)
[ 5.311136] usb 1-1.1.2: Failed to suspend device, error -71

Is there something I can do to fix this?

The sdhost error is nothing to worry about, but I did raise a bug about it. To my extreme annoyance they didnā€™t fix it, even though I submitted a patch to the kernel mailing list. I think it just looks really sloppy not to fix an obvious error. You could maybe get rid of it by creating a device tree overlay?..

The hub errorsā€¦no idea. Do you have a usb hub attached?

the usb hub was part of my keyboard. Iā€™ve got a command line (initramfs) is this where I enter my username, location, etc.?

Do you mean you havenā€™t booted to a graphical interface? Iā€™ll have to get my head around what could have gone wrongā€¦I created the image ages ago, havenā€™t used it much since then!

No itā€™s going right to a command line rather than a graphical interface, I get a blue screen with a xubuntu label a loading circle.

Any error messages other than what youā€™ve already written?

How did you write the image to disk?