Translate

Sunday, April 21, 2024

Ubuntu Core - run it on Virtualbox

Ubuntu Core is an OS designed for embedded machines, operates in different way than a standard Linux distribution.
This article explains how to install Ubuntu Core over a Virtual Machine (VM) using VirtualBox over a MacBook Pro Intel based, for development/experimentation purpose.

Ubuntu Core is not a standard distribution and cannot be installed directly over Virtualbox.
It is necessary to use a standard/normal Ubuntu distribution to be used as installer.

Prerequisites

This document refers to a MacBook Pro 2019 Intel as host, running macOS Sonoma 14.3 and VirtualBox vs. 7.0.14.
It is assumed VirtualBox to be installed and working without problems.

VirtualBox configuration

The instance for Ubuntu Core need to be configured not as default.

  • Create a new machine (Machine - New)

  • Assign 2 GB RAM - 2 CPU and enable EFI

    Note !
    In case JetBrain IntelliJ (or similar IDE) is used to be attached to the server, allocate AT LEAST 4 GB RAM !
    image-20240209-202042.png
  • Create a 10 GB disk, dynamic

Summary of the VM for Ubuntu Core



image-20240209-204720.png

At this point is possible to create the VM, clicking on Finish, a new VM named (as per the example) ubuntu-core-22 will be present.
On the Network setting change the Adapter 1 from NAT (default) to Bridge

Ubuntu Core installation

As mentioned at the beginning, Ubuntu Core cannot be installed directly on the VM.
On a real embedded card would be installed via snap or on a SD card.
On the VM is necessary to use a standard Linux distribution as installer.
From the Ubuntu website download the latest Ubuntu Desktop (at the article time 22.04 LTS) and then use that image to start the VM created in the previous paragraph.
Basically start the VM and since the first time nothing is assigned, select the downloaded Ubuntu desktop image

image-20240209-205547.png








Once the image starts, be sure to DON’T install it, just try it.

image-20240209-205757.png
Select Try or Install Ubuntu


image-20240209-205835.png

Click on Try Ubuntu







When the image starts, open Firefox in the image, NOT on the host, and go to the url : cdimage.ubuntu.com and navigate to find Ubuntu Core 22, specifically :


image-20240209-210820.png

and download the base image : ubuntu-core-22-amd64.img.xz

In order to install the downloaded image we need to open the terminal.

Remember that the VM is still running the “try Ubuntu” option and thus it could be extremely slow !

At this point is necessary to open a terminal in order to install the Ubuntu Core on the VM.

Once opened the terminal :

  • switch as root

    sudo -i
  • locate the disk where to install the image, is the 10 Gbyte one
    Using the fdisk command, see the partitions on the VM and identify the main one (the 10 Gbyte one), typically is the /dev/sda.

    fdisk -l
  • go to the directory where the Ubuntu Core image is downloaded

    cd /home/ubuntu/Downloads
  • extract the image on the VM disk using the dd command

    xzcat ubuntu-core-22-amd64.img.xz | dd of=/dev/sda bs=32M status=progress; sync


    image-20240209-212914.png
  • Reboot the VM

The first time Ubuntu Core is rebooting it can take some quite time and multiple restarts.
The boot is done by EFI.

Ubuntu Core usage

Once the VM is ready, it will ask for configuration



image-20240209-214112.png

Press Enter.



image-20240209-214222.png

Select the Configure the network and setup an administrator account on this all-snap Ubuntu Core system

Click OK and follow the menu.
Note, the setup will end up creating an ssh access to the machine using the settings present in the Ubuntu One website.
This means is necessary to have an Ubuntu One account.

On this account will be necessary to save the public key of the host/hosts able to access the image.
Typically the host is the one to run the VM, but actually any host in the network will be able to access the Ubuntu Core running on the VM via ssh, assumed it has the key stored in Ubuntu One.

Via ssh will be possible to access the Ubuntu Core machine.

 

Resources

  • https://www.youtube.com/watch?v=f2oOjl1em1s&t=792s

 

  

No comments:

Post a Comment