Getting error during artefacts creation from Ubuntu 18.04 x64 image using mender-convert-next

Hello,

With ubuntu test image. i have “.sdimg” and “.mender” files But I am getting error below with Ubuntu 18.04.3 LTS (Bionic beaver) Desktop image after execute mender-convert using mender-convert-next repo.

I have followed the steps as below.

  1. Download Ubuntu 18.04.3 LTS (Bionic beaver) Desktop iso image.
    http://releases.ubuntu.com/18.04/

    $ fdisk -l -u ubuntu-18.04.3-desktop-amd64.iso
    Disk ubuntu-18.04.3-desktop-amd64.iso: 2 GiB, 2082816000 bytes, 4068000 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x5092863d

    Device Boot Start End Sectors Size Id Type
    ubuntu-18.04.3-desktop-amd64.iso1 * 0 4067999 4068000 2G 0 Empty
    ubuntu-18.04.3-desktop-amd64.iso2 3989132 3994059 4928 2.4M ef EFI (FAT-12/16/32)

  2. Could you please assist me, what is the right way to convert iso file into .img file for mender?

    I have tried iso to img conversion as below.

    a. Convert using dd command as below

     sudo dd if=ubuntu-18.04.3-desktop-amd64.iso of=ubuntu-18.04.3-desktop-amd64_withdd.img bs=1M status=progress conv=fdatasync
    

    $ fdisk -l -u ubuntu-18.04.3-desktop-amd64_withdd.img
    Disk ubuntu-18.04.3-desktop-amd64_withdd.img: 2 GiB, 2082816000 bytes, 4068000 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x5092863d

    Device Boot Start End Sectors Size Id Type
    ubuntu-18.04.3-desktop-amd64_withdd.img1 * 0 4067999 4068000 2G 0 Empty
    ubuntu-18.04.3-desktop-amd64_withdd.img2 3989132 3994059 4928 2.4M ef EFI (FAT-12/16/32)

    Here .img image booted successfully on X86 m/c.

    b. Just rename XXX.iso into XXX.img

    $ fdisk -l -u ubuntu-18.04.3-desktop-amd64_rename.img
    Disk ubuntu-18.04.3-desktop-amd64_rename.img: 1.8 GiB, 1875902464 bytes, 3663872 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x5092863d

    Device Boot Start End Sectors Size Id Type
    ubuntu-18.04.3-desktop-amd64_rename.img1 * 0 4067999 4068000 2G 0 Empty
    ubuntu-18.04.3-desktop-amd64_rename.img2 3989132 3994059 4928 2.4M ef EFI (FAT-12/16/32)

    Here also .img image booted successfully on X86 m/c.

    c. Burn iso image into sdcard (.iso booted successfully on X86 m/c.) then copy sdcard image into .img using dd command and then boot again on X86 m/c successfully.

Note: Here all three above ways .img successfully booted on X86 m/c.

  1. Download mender-convert source code
    git clone -b next https://github.com/mendersoftware/mender-convert.git

  2. copy .img under input folder
    cd mender-convert
    mkdir -p input
    #Copy the .img file under input folder

  3. Execute below commands

    ./scripts/bootstrap-rootfs-overlay-demo-server.sh --output-dir ${PWD}/rootfs_overlay_demo --server-ip 10.77.164.6
    sudo su
    ./docker-build

    MENDER_ARTIFACT_NAME=release-1 ./docker-mender-convert --disk-image input/ubuntu-18.04.3-desktop-amd64.img --overlay rootfs_overlay_demo --config configs/qemux86-64_config

Terminal Output 7 Error:

2019-12-02 05:56:53 [INFO] [mender-convert-extract] Using configuration file: configs/mender_convert_config
2019-12-02 05:56:53 [INFO] [mender-convert-extract] Using configuration file: configs/qemux86-64_config
2019-12-02 05:56:53 [INFO] [mender-convert-extract] Validating disk image
2019-12-02 05:56:53 [INFO] [mender-convert-extract] Disk parsed succesfully
2019-12-02 05:56:53 [INFO] [mender-convert-extract] NUMBER OF PARTS: 2 TYPE: dos
2019-12-02 05:56:53 [INFO] [mender-convert-extract] PART 1: SIZE: 2G TYPE: 0x0
2019-12-02 05:56:53 [INFO] [mender-convert-extract] PART 1: extracting to work/part-1.fs
2019-12-02 05:57:48 [INFO] [mender-convert-extract] PART 2: SIZE: 2.4M TYPE: 0xef
2019-12-02 05:57:48 [INFO] [mender-convert-extract] PART 2: extracting to work/part-2.fs
dd: invalid number: '-1’

Anyone assist me to resolve error during create artifacts from Ubuntu 18.04 x64 desktop image using mender-convert-next repo.

can anyone please replicate same above and guide me if i missed something.

Hi @Rohita83,

I don’t think mender-convert will function on the ISO files directly. That could certainly be added but it would not be terribly useful since that is the Ubuntu installer image and on an “installed” Ubuntu. I think the best approach is to boot this ISO in a machine (a VM is fine), do the installation, and then use “dd” to make an image of the installed partition.

Drew

@drewmoseley, Thanks for the quick informative response.

if possible, Could you please share the steps or docs to make an iso image (mender compatible) from ubuntu18.04 desktop iso through VM.

I didn’t actually validate these instructions but this wiki looks pretty helpful for doing the actual installation of Ubuntu into Virtualbox. Basically, just create a new VirtualBox machine from the “Machine” menu, make sure to add a disk (VDI mode); then edit the machine settings and add the Ubuntu ISO to the IDE Storage controller as a CDROM device. Then boot the machine and select the “Install Ubuntu” option. Once that completes, power off the virtual machine.

Now you need to convert the VDI image to raw format. Note that this will create a file as large as you specified the disk to be, so make sure you have sufficient disk space. On my Ubuntu Laptop, the disk image is stored in “/home/dmoseley/Documents/VirtualBox/Ubuntu 18/Ubuntu 18.vdi”. It may be different in your case:

$ VBoxManage clonehd ~/Documents/VirtualBox/Ubuntu\ 18/Ubuntu\ 18.vdi /work/dmoseley/scratch/foo.img --format raw

This foo.img file should be usable with mender-convert however please note that we have not added support for Ubuntu/X86 in mender-convert yet so you will likely have further development to do to get this to work.

HTH,
Drew

I have tried the same as above and created a mender image (sdimg.gz 5.55 GB) successfully.
But failed during flashing.

After that, I have checked SD Card in GParted. It shows 2 partitions of 100 GB and another 3 partitions.

Is there any specific configuration to create .vdi (VirtualBox image) or with mender?

@drewmoseley, Thanks so much for suggesting the right steps. The steps given is working fine for qemux86_64 emulator.
Is it possible to convert for x86_64 generic hardware machine?.

Supporting a generic X86 machine is possible but will likely require some customization in mender-convert. We have not tested that machine type yet and would love a pull request implementing it.

Hi @sandiprakhasiya, welcome to Mender Hub.
I’m not quite sure what you are asking here. Mender convert will output a multiple partition image with the SDIMG suffix. You may need to run either qemu-img or VBoxManage to convert that to something directly usable by VirtualBox but I’ve not tried that.

Drew

Yes I will love to implement for ubuntu generic x86_64. Can you please guide from where i can start? Ubuntu working for qemux86_64 nice one and Thanks for the steps.

The docs are in the process of being updated. Take a look here for details: https://github.com/mendersoftware/mender-docs/blob/62d9b1cba2130f0162f96902a504149be1d3507a/04.Artifacts/02.Debian-family/02.image-configuration/docs.md

Drew