Run script into VM (VM originally used: Lima - Ubuntu)
- Create a dedicated VM
limactl start --name=placeholder template://ubuntu
limactl list # to view active VMs- Shell into the created VM
limactl shell placeholder # use the shell inside the VMHere we can do a passwordless sudo so there is no need to log in as root
- Do checks
python3 --version
uname -m # machine hardware name
mount | grep cgroup2 -
Run file using
sudo python3 filename.py -
Clean-up and Reset
limactl stop placeholder
limactl delete placeholder- Checks from Host Side -> Use another terminal session's
psandhostname
Getting alpine-rootfs and extracting the tarball inside VM
-
Open https://alpinelinux.org/downloads/ and navigate until "Mini Root Filesystem" is found
-
Navigate to the appropriate mini root filesys according to your VM machine hardware name (checked using
uname -minside the VM) and copy link address -
Open the VM's shell using
limactl shell placeholder -
cd ~inside the VM's shell to change current working directory to home, andpwdto check if you are in the correct directory (e.g, /home/name.guest) -
Download the mini root filesystem using the link address that was copied previously with
wget link-address -
Create a directory to put the root filesystem
mkdir -p /mnt/alpine-rootfs- Extract the tarball that was downloaded previously inside the new directory
sudo tar -xzf tarball-name -C /mnt/alpine-rootfsls /mnt/alpine-rootfsand check ifbin,dev,etc, and others are included inside, if yes, then all is good :)