Open maratbn opened 6 years ago
Hi Marat, virt-bootstrap does not have a debian package yet, but you can install it using the following steps:
$ git clone https://github.com/virt-manager/virt-bootstrap
$ cd virt-bootstrap
$ sudo python setup.py install
Note that virt-bootstrap has the following dependencies: libvirt
, libvirt-sandbox
, skopeo
, python-guestfs
, python-passlib
Thanks @rst0git , the installation procedure worked after I also did apt install python-setuptools python-passlib python-guestfs
for the Python dependencies.
But you still need to do a lot to actually make it functional. For example, skopeo I had to get from this ppa or I had an error.
Now I am getting the following error from virt-manager when trying to run docker://docker.io/ubuntu:18.04
as a test
Unable to complete install: 'virt-bootstrap did not complete successfully'
Command 'virt-sandbox -c qemu:///session --name=bootstrap_8019 -m host-bind:/mnt=/home/max/.local/share/libvirt/filesystems/container1 -- /bin/tar xf /home/max/.cache/virt-bootstrap/docker_images/7996ebd2246a962c134071d90f00119b8e4d228b66e4e2afc80991dd9ac1726a -C /mnt --exclude dev/* --overwrite --absolute-names' returned non-zero exit status 1
Checking layer: /home/max/.cache/virt-bootstrap/docker_images/7996ebd2246a962c134071d90f00119b8e4d228b66e4e2afc80991dd9ac1726a
Untar layer: /home/max/.cache/virt-bootstrap/docker_images/7996ebd2246a962c134071d90f00119b8e4d228b66e4e2afc80991dd9ac1726a
Call command:
virt-sandbox -c qemu:///session --name=bootstrap_8019 -m host-bind:/mnt=/home/max/.local/share/libvirt/filesystems/container1 -- /bin/tar xf /home/max/.cache/virt-bootstrap/docker_images/7996ebd2246a962c134071d90f00119b8e4d228b66e4e2afc80991dd9ac1726a -C /mnt --exclude dev/* --overwrite --absolute-names
Stderr:
libvirt-sandbox-init-qemu: mount_9pfs: cannot mount sandbox:root on /tmproot (9p): Invalid argument
any idea what I'm missing here?
Hi @Queuecumber,
The error message:
libvirt-sandbox-init-qemu: mount_9pfs: cannot mount sandbox:root on /tmproot (9p): Invalid argument
shows that the mount
syscall failed to mount 9p filesystem.
To fix it, try to:
modprobe 9pnet
modprobe 9pnet_virtio
Or you can run virt-manager/virt-bootstrap as root. This will make virt-bootstrap use LXC driver of libvirt instead of qemu-session when extracting the rootfs of the contianer image.
Same error even after loading those modules and verifying that they are loaded. I run libvirt as my local user so that it can interface with pulseaudio, could that be the problem?
Hey @rst0git @maratbn @Queuecumber @giuseppe @Antique Can you please help me resolve this error?
username@PC:~/Downloads/virt-bootstrap-master/src/virtBootstrap$ sudo python virt_bootstrap.py docker://ubuntu:latest /home/dino/Downloads/ubuntu-rootfs
INFO : Checking cached layers
INFO : Downloading container image
Traceback (most recent call last):
File "virt_bootstrap.py", line 350, in
@dinoRkz What is the output of:
$ mkdir /tmp/test
$ skopeo copy docker://ubuntu:latest dir:/tmp/test
Hey, thanks for replying. This is the output of the above commands after execution.
FATA[0000] Error loading trust policy: open /etc/containers/policy.json: no such file or directory
I tried to open the /etc/containers directory, but it does not exist.
@rst0git Please have a look at https://github.com/containers/skopeo/issues/181
$ skopeo --insecure-policy copy docker://ubuntu:latest dir:/tmp/test
I tried executing the above command, and it worked.
I tried to do some alternative fix from here https://github.com/containers/skopeo/blob/master/default-policy.json
And then I executed the command sudo python virt_bootstrap.py docker://ubuntu:latest /home/dino/Downloads/ubuntu-rootfs
The output of the above command is shown below. Could you please help me to resolve this error?
dino@Dinesh-PC:~/Downloads/virt-bootstrap-master/src/virtBootstrap$ sudo python virt_bootstrap.py docker://ubuntu:latest /home/dino/Downloads/ubuntu-rootfs
INFO : Checking cached layers
INFO : Extracting container layers
INFO : Extracting layer (1/4) with size: 30.87 MiB
Traceback (most recent call last):
File "virt_bootstrap.py", line 350, in
Do you have libvirt-sandbox
installed?
Thank you and sorry for bothering you. I realised that I have to delete ubuntu. Installed fedora. Followed all the steps mentioned above including https://github.com/virt-manager/virt-bootstrap/issues/2#issuecomment-407006369
So, I have tried to run program using root, but, this error showed up:
[root@localhost virtBootstrap]# sudo python virt_bootstrap.py docker://ubuntu:latest /home/dino/Downloads/ubuntu-rootfs
INFO : Checking cached layers
INFO : Extracting container layers
INFO : Extracting layer (1/4) with size: 30.87 MiB
Traceback (most recent call last):
File "virt_bootstrap.py", line 350, in
[root@localhost virtBootstrap]# virt-sandbox -c lxc:/// --name=bootstrap_7997 -m host-bind:/mnt=/home/dino/Downloads/ubuntu-rootfs -- /bin/tar xf /var/cache/virt-bootstrap/docker_images/6cf436f81810f067c6d4ffca6793eae7cb6d38456715b0707d8a5a2d1acccf12 -C /mnt --exclude dev/* --overwrite --absolute-names --acls --xattrs --selinux 2019-03-03 14:21:46.356+0000: 1: error : virCommandExec:2190 : cannot execute binary /etc/libvirt-sandbox/scratch/.libs/libvirt-sandbox-init-lxc: Permission denied Failure in libvirt_lxc startup: cannot execute binary /etc/libvirt-sandbox/scratch/.libs/libvirt-sandbox-init-lxc: Permission denied
==============================================================================
EDIT: Screenshot of the output is here:
I think that the Permission denied
error is caused by selinux, could you try with setenforce 0
?
Done! Thanks for all your help. I hope this thread helps someone.
I'm using virt-manager on Ubuntu 18.04, and I specified in the virt-manager UI to create a new Libvirt-LXC virtual machine that is an operating system container. The UI then asks me to provide an existing OS root directory, but also implies that such a directory can be created with the message "To enable OS directory tree creation, please install virt-bootstrap".
I could not find a .deb package for this project, so I suppose it would be done manually, or perhaps by installing another package that includes it? What would be the procedure to install this software on Ubuntu 18.04 and configuring it so that virt-manager could use it?
Thanks, Marat