containers / krunvm

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

Error deleting a VM #19

Open c3d opened 2 years ago

c3d commented 2 years ago

Created two VMs from a fedora-rawhide image, and got the following trying to delete the second one:

% krunvm delete fedora-f37
error unmounting container fedora-working-container-1: container not known
buildah returned an error: 

There is nothing below, i.e. if there was an actual error from buildah, it is not shown.

It is possible the error message was different the first time, but unfortunately, I closed the corresponding terminal window.

c3d commented 2 years ago

The problem might be related to having multiple "fedora" VMs at the same time.

Setup of a Fedora 35 VMs, while I have a Rawhide microvm defined.

% krunvm create --name f35 fedora:35
Resolving "fedora" using unqualified-search registries (/opt/homebrew/etc/containers/registries.conf)
Trying to pull quay.io/fedora:35...
Trying to pull docker.io/library/fedora:35...
Getting image source signatures
Copying blob 623fc6c8f399 done  
Copying config 775b4cdd6b done  
Writing manifest to image destination
Storing signatures
microVM created with name: f35

% krunvm  changevm f35 -v /Users/ddd:/ddd --mem 4096 --cpus 4
f35
 CPUs: 4
 RAM (MiB): 4096
 DNS server: 1.1.1.1
 Buildah container: fedora-working-container-1
 Workdir: /root
 Mapped volumes: {"/Users/ddd": "/ddd"}
 Mapped ports: {}

The first run sort of works, but with a weird error about /var not existing:

% krunvm start f35 /bin/bash
[root@f35 ~]# dnf install -y dmesg
Fedora 35 - aarch64                             957 kB/s |  75 MB     01:19    
Fedora 35 openh264 (From Cisco) - aarch64       1.0 kB/s | 2.5 kB     00:02    
Fedora Modular 35 - aarch64                     815 kB/s | 3.2 MB     00:04    
Fedora 35 - aarch64 - Updates                   906 kB/s |  30 MB     00:33    
[Errno 2] No such file or directory: '/var/cache/dnf/metadata_lock.pid'
Failed to store expired repos cache: [Errno 2] No such file or directory: '/var'
[root@f35 ~]# exit
exit

The second run does shows an error similar to what I had with delete:

% krunvm -v start f35
error unmounting container fedora-working-container-1: container not known
buildah returned an error: 
c3d commented 2 years ago

The container indeed does not show up for buildah:

% buildah --root /Volumes/krunvm/root --runroot  /Volumes/krunvm/runroot containers
CONTAINER ID  BUILDER  IMAGE ID     IMAGE NAME                       CONTAINER NAME
35038b6e9a92     *     f8a1a9e13d62 registry.fedoraproject.org/fe... fedora-working-container
c3e1d8d70c8c     *     585393df054a docker.io/library/debian:latest  debian-working-container
e90f078efb2d     *     bad148f8963f docker.io/library/ubuntu:latest  ubuntu-working-container
c3d commented 2 years ago

Right after the first create, the container is there:

CONTAINER ID  BUILDER  IMAGE ID     IMAGE NAME                       CONTAINER NAME
35038b6e9a92     *     f8a1a9e13d62 registry.fedoraproject.org/fe... fedora-working-container
c3e1d8d70c8c     *     585393df054a docker.io/library/debian:latest  debian-working-container
e90f078efb2d     *     bad148f8963f docker.io/library/ubuntu:latest  ubuntu-working-container
d1f672d2d174     *     775b4cdd6b58 docker.io/library/fedora:35      fedora-working-container-1
c3d commented 2 years ago

This is not systematic. I tried again, this time having another window with a watch for the list of containers, trying to see when it was destroyed. I could start the VM multiple times, and I could delete it successfully.