zos icon indicating copy to clipboard operation
zos copied to clipboard

development tools to help building and debugging custom images

Open muhamadazmy opened this issue 1 year ago • 3 comments

The idea is that we need to have so development/debugging tools to help with building custom VM images (microvms)

  • I already created this script which allows you to boot a VM https://gist.github.com/muhamadazmy/a10bfb0cc77084c9b09dea5e49ec528e
  • We also need to inject cidata (cloud-init seed) that include config to configure a simple network, and also add user key to the vm to make sure cloud-init is well configured

muhamadazmy avatar Mar 14 '24 09:03 muhamadazmy

  • Missing dep installation: mtools and cargo.
  • Installation happened in the /root.
  • Got this when trying to run with flist https://hub.grid.tf/omarabdulaziz.3bot/ubuntu-jammy.flist
Booting ...
+ boot
+ sudo cloud-hypervisor --cpus boot=1,max=1 --memory size=1024M,shared=on --kernel /tmp/overlay/kernel --initramfs /tmp/overlay/initramfs-linux.img --fs tag=vroot,socket=/tmp/virtiofs.sock --disk path=/tmp/cidata.img --cmdline 'rw console=ttyS0 reboot=k panic=1 root=vroot rootfstype=virtiofs rootdelay=30' --serial tty --console off
:: running hook [bootstrap]
mounting pts
ln: /dev/fd/fd: No such file or directory
trying to mount root
:: mounting 'vroot' on real root
:: trial '1'
:: running late hook [bootstrap]
settign up environment
setting up system
seed directory: /seed
root directory: /new_root
failed to apply network: failed to load network config file: failed to open file /seed/network-config: open /seed/network-config: no such file or directory
generating host ssh keys
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: Network is unreachable
fill /etc/hosts
ERROR: Root device mounted successfully, but /sbin/init does not exist.
Bailing out, you are on your own. Good luck.

sh: can't access tty; job control turned off
[rootfs ]#

A-Harby avatar Jun 12 '24 10:06 A-Harby

thanks ya harby, i will look at it

Omarabdul3ziz avatar Jun 12 '24 10:06 Omarabdul3ziz

@A-Harby i couldn't know exactly what happened to make the booting stuck in the initramfs and failed to chroot to the new_root to continue the booting process, but mostly it is a wrong deps installation. in the mentioned pr i separated the deps installtion on a file and add some missing deps.

on a new env setted up with the new install_deps script i managed to run a VM with the mentioned flist. could you try again by cleaning your env and setup with the script?

Omarabdul3ziz avatar Jun 24 '24 09:06 Omarabdul3ziz

I tried again on a newly created VM to follow the instructions to install the tool, but it still fails to install libraries packages.

image image

I'll communicate with @Omarabdul3ziz to identify errors and fix them.

A-Harby avatar Jul 10 '24 09:07 A-Harby

@A-Harby nested virtualization isn't supported on the vms on the grid, so the script will not run on a VM. i added some docs/configs can you try to verify again on your local machine from the main_debug-image-script_deps branch?

Omarabdul3ziz avatar Sep 24 '24 10:09 Omarabdul3ziz

I was able to run the debug script on a Flist image after using the udpated install_preq script on the Omar branch main_debug-image-script_deps.

And image was successfully booted. image

A-Harby avatar Sep 24 '24 11:09 A-Harby

final changes are merged

Omarabdul3ziz avatar Sep 24 '24 14:09 Omarabdul3ziz