containers / krunvm

Create microVMs from OCI images
Apache License 2.0
1.41k stars 42 forks source link

Failure to delete a VM #42

Open c3d opened 1 year ago

c3d commented 1 year ago

On macOS, some of the VMs that are recorded in my configuration won't delete:

% krunvm start debian-microVM
Error: error unmounting container debian-working-container: container not known
buildah returned an error:

% krunvm delete debian-microVM
Error: error unmounting container debian-working-container: container not known
buildah returned an error:

Notice the empty buildah output.

buildah only shows a restricted list of containers:

% buildah --root /Volumes/krunvm/root  --runroot /Volumes/krunvm/root list -a
CONTAINER ID  BUILDER  IMAGE ID     IMAGE NAME                       CONTAINER NAME
89619ec2a430     *     a6be1f66f70f                                  ubuntu-working-container
38114032134f     *     a6be1f66f70f                                  ubuntu-working-container-1

The container for debian-microVM is not there:

% krunvm list
[...]
debian-microVM
 CPUs: 2
 RAM (MiB): 1024
 DNS server: 1.1.1.1
 Buildah container: debian-working-container
 Workdir: /root
 Mapped volumes: {}
 Mapped ports: {}
[...]

In my VM list, many of my VMs have non-existent containers and fail the same way, e.g.:

fedora-rawhide
 CPUs: 4
 RAM (MiB): 4096
 DNS server: 1.1.1.1
 Buildah container: fedora-working-container
 Workdir: /root
 Mapped volumes: {"/Users/ddd": "/root"}
 Mapped ports: {}

What I find more concerning is that several VMs apparently share the same container. Is that normal?

bd-ubuntu
 CPUs: 8
 RAM (MiB): 8192
 DNS server: 1.1.1.1
 Buildah container: ubuntu-working-container-1
 Workdir: /ddd
 Mapped volumes: {"/Users/ddd/": "/ddd"}
 Mapped ports: {}

ubuntu-test
 CPUs: 2
 RAM (MiB): 1024
 DNS server: 1.1.1.1
 Buildah container: ubuntu-working-container-1
 Workdir:
 Mapped volumes: {}
 Mapped ports: {}

None of these VMs can be deleted using krunvm today, because the error causes the configuration to not be updated. It might be useful to add a -f option to ignore buildah errors and delete entries in the krunvm config anyway.