Deployment of Ubuntu Server 16.04 on Raspberry Pi 3 B+

Hi everyone,

I’m new to mender tool and I’m having a problem using mender-convert tool when it comes generating a mender image (.sdimg) from “golden image” Ubuntu Server 16.04 and which is running properly on Raspberry Pi 3 B+.

I have runned the following commands in order to do this:

sudo ./docker-mender-convert raw-disk-image-shrink-rootfs --raw-disk-image input/golden-image-1.img --storage-total-size-mb 8000

sudo ./docker-mender-convert from-raw-disk-image --raw-disk-image “input/golden-image-1.img” --mender-disk-image /home/integrasys/mender-convert/output/golden-image-1.sdimg --device-type “raspberrypi3” --artifact-name “golden-image-1” --bootloader-toolchain arm-buildroot-linux-gnueabihf --server-url “docker.mender.io” --demo --server-cert “./server.crt” --storage-total-size-mb 8000

The output is the following:

*** Data partition size set to default value: 128MB ***
1/10 Shrinking raw disk image root filesystem...
dumpe2fs 1.44.1 (24-Mar-2018)
resize2fs 1.44.1 (24-Mar-2018)
	Root filesystem size:       
	minimal: 2473947136         
	aligned: 2474639360       
	sectors: 4833280
	Raw disk image new endsector: 5103615
	New root filesystem size (sectors): 4833280
2/10 Repartitioning raw disk image...
	Detected raw disk image with 2 partition(s).
	Calculating partitions' sizes of the Mender image.
	Adjust Mender disk image size to the total storage size (8000MB).
	Additional space for rootfs partitions not aligned.         
	Final image will be smaller than 8000MB
	Extracting boot partition from raw disk image.
	Storing data in boot.vfat.
	Extracting root filesystem partition from raw disk image.
	Storing data in rootfs.img.
	Creating blank Mender disk image:       
		image size: 8384413696 bytes       
		boot partition size: 134217728 bytes       
		root filesystem size: 4051697664 bytes       
		data partition size: 134217728 bytes
	Changes in partition table applied.
3/10 Formatting repartitioned raw disk image...
	Creating MS-DOS filesystem for 'boot' partition.
	Creating ext4 filesystem for 'primary' partition.
	Creating ext4 filesystem for 'secondary' partition.
	Creating ext4 filesystem for 'data' partition.
4/10 Setting boot partition...
	Done.
5/10 Setting root filesystem partition...
	Done.
6/10 Setting file system table...
	Done.
7/10 Cleaning intermediate files...
	Partition mappings cleaned.
8/10 Installing Mender to Mender disk image...
	Downloading demo server certificate.
	Installing files.
3install -m 755 -d /mender-convert/output/sdimg/primary/usr/bin
install -m 755 mender /mender-convert/output/sdimg/primary/usr/bin/
install -m 755 -d /mender-convert/output/sdimg/primary/etc/mender
install -m 644 mender.conf.production /mender-convert/output/sdimg/primary/etc/mender/mender.conf.production
install -m 644 mender.conf.production /mender-convert/output/sdimg/primary/etc/mender/mender.conf
install -m 644 mender.conf.demo /mender-convert/output/sdimg/primary/etc/mender/mender.conf.demo
echo "artifact_name=unknown" > /mender-convert/output/sdimg/primary/etc/mender/artifact_info
install -m 755 -d /mender-convert/output/sdimg/primary/usr/share/mender
install -m 755 -d /mender-convert/output/sdimg/primary/usr/share/mender/identity
install -m 755 support/mender-device-identity /mender-convert/output/sdimg/primary/usr/share/mender/identity/
install -m 755 -d /mender-convert/output/sdimg/primary/usr/share/mender/inventory
install -m 755 support/mender-inventory-bootloader-integration support/mender-inventory-hostinfo support/mender-inventory-network support/mender-inventory-os support/mender-inventory-rootfs-type /mender-convert/output/sdimg/primary/usr/share/mender/inventory/
install -m 755 -d /mender-convert/output/sdimg/primary/usr/share/mender/modules/v3
install -m 755 support/modules/deb support/modules/docker support/modules/directory support/modules/single-file support/modules/rpm support/modules/script /mender-convert/output/sdimg/primary/usr/share/mender/modules/v3/
install -m 755 -d /mender-convert/output/sdimg/primary/lib/systemd/system
install -m 0644 support/mender.service /mender-convert/output/sdimg/primary/lib/systemd/system/
	Done.
9/10 Installing Bootloader to Mender disk image...
	Building U-Boot related files.
	Installing U-Boot related files.
cp: cannot stat '/mender-convert/output/sdimg/boot/kernel7.img': No such file or directory
install: cannot create regular file '/mender-convert/output/sdimg/primary/usr/lib/raspi-config/init_resize.sh': No such file or directory
unlink: cannot unlink '/mender-convert/output/sdimg/primary/etc/rc3.d/S01resize2fs_once': No such file or directory
rm: cannot remove '/mender-convert/output/sdimg/primary/etc/init.d/resize2fs_once': No such file or directory
	Done.
10/10 Creating Mender Artifact...
	Rootfs partition id not set - 'primary' will be used by default.
	Storing data in golden-image-1.ext4.
	Writing Mender artifact to: /mender-convert/output/golden-image-1.mender
	This may take 10-20 minutes (using LZMA)...
	Creating Mender Artifact succeeded.
Conversion complete!
The Mender disk image you can provision your device storage with is at:         
	/mender-convert/output/golden-image-1.sdimg
The Mender root file system partition is at:
	/mender-convert/output/golden-image-1.ext4
The Mender Artifact you can upload to your Mender server to deploy to your devices is at:         
	/mender-convert/output/golden-image-1.mender*

Then I have flashed this generated image into the microSD but unsucess when I put it on the raspberry, it does not boot giving the following errors that appears in the capture:

Anyone has any suggestion about this issue?

Thanks in advance, I will appreciate any help because I am quite stucked with this. It’s possible to do this?

Best reagards.

Edit: @mirzak: formatting

I believe this is the same problem reported in a different thread (see my comments there),

Also welcome to the Mender community. I hope you will have a pleasant experience :slight_smile:

Okay, thank you very much, I will try to try ubuntu 18 32-bit although the image I used was this:

ubuntu-16.04-preinstalled-server-armhf+raspi3.img

and it is 32 bit I think.

Best regards.

Then it might something else if you are already using a 32-bit image. I will give it a quick run trough as well

Ah, see what the problem is. The content of boot partition on the Ubuntu image is slightly different compared to Raspbian,

bcm2710-rpi-3-b.dtb  bootcode.bin  boot.scr  cmdline.txt  config.txt  fixup_cd.dat  fixup.dat  fixup_db.dat  fixup_x.dat  initrd.img  start_cd.elf  start_db.elf  start.elf  start_x.elf  uboot.bin  vmlinuz

So this will not work with the current mender-convert version.

Problem is the assumptions made in this part of the code,

So what could be the solution to this fault?, is it not possible to use mender-convert with ubuntu server?

I’m testing with the following image:

ubuntu-18.04.3-preinstalled-server-armhf+raspi3.img

What do you suggest I can do?.

Thank you very much.

Current statement would be that Ubuntu server images are not supported by mender-convert. We have never tested those before and have primarily tested with Raspbian images.

What do you suggest I can do?.

You could give it a go an try to resolve it on your own, would be my best suggestion.

I pointed you to the faulty code, the problem is not hard to fix but currently it has hard to prioritize this. You can see that we are trying to move files around, and on Ubuntu images they are named differently hence the problems and why it does not work.

Hi mirzak,

First of all, thank you very much for the proposed solutions. We still have problems converting from ubuntu image, the kernel.img file is not found in the ubuntu boot.
Any solution you tell us will be welcome.
Thank you,
Greetings