Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on VirtualBox image #9

Closed
geneoes opened this issue Sep 12, 2022 · 12 comments
Closed

Error on VirtualBox image #9

geneoes opened this issue Sep 12, 2022 · 12 comments
Labels
documentation Improvements or additions to documentation

Comments

@geneoes
Copy link

geneoes commented Sep 12, 2022

When running :

d2vm build -p MyP4Ssw0rd -f ubuntu.Dockerfile -o ubuntu.vdi .
Building docker image from ubuntu.Dockerfile
Inspecting image d2vm-4dca598b-8f4d-4c6e-b6c2-c36d145dcb2a
No network manager specified, using distribution defaults: netplan
Docker image based on Ubuntu 22.04.1 LTS (Jammy Jellyfish)
Building kernel enabled image
Creating vm image
Creating raw image
Mounting raw image
Build failed
Unmounting raw image
Failed to unmount
Error: losetup --show -f /tmp/d2vm/834629c7-f718-4d96-bbea-c7890c7a1a09/disk0.d2vm.raw: stdout:  stderr: losetup: cannot find an unused loop device
 error: exit status 1

I am running this inside an Ubuntu VirtualBox with a Windows host

@Adphi
Copy link
Member

Adphi commented Sep 12, 2022

The relevant error is:

losetup: cannot find an unused loop device

Can you list the loop devices inside your vm ?

sudo losetup -a

If there is none, can you ensure the kernel module is enabled ?

sudo modprobe loop

@Adphi
Copy link
Member

Adphi commented Sep 12, 2022

Ah... you have to use sudo to build the image...

@Adphi Adphi added the documentation Improvements or additions to documentation label Sep 12, 2022
@geneoes
Copy link
Author

geneoes commented Sep 12, 2022

Ah... you have to use sudo to build the image...

Ahh right!
I didn't because when using sudo: sudo: d2vm: command not found
I installed it through brew install linka-cloud/tap/d2vm

@Adphi
Copy link
Member

Adphi commented Sep 12, 2022

I always forget... since ubuntu 20.04 the user's $PATH is not preserved by sudo, so you need to run with the -E flag:

sudo -E d2vm ...

@geneoes
Copy link
Author

geneoes commented Sep 12, 2022

hey yeah I tried but same message

sudo: d2vm: command not found

@Adphi
Copy link
Member

Adphi commented Sep 12, 2022

what is the output of which d2vm ?

@geneoes
Copy link
Author

geneoes commented Sep 12, 2022

what is the output of which d2vm ?

/home/linuxbrew/.linuxbrew/bin/d2vm

@Adphi
Copy link
Member

Adphi commented Sep 12, 2022

can you show me your $PATH ?

echo $PATH

@geneoes
Copy link
Author

geneoes commented Sep 12, 2022

/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

@Adphi
Copy link
Member

Adphi commented Sep 12, 2022

Can you try sudo env "PATH=$PATH" d2vm ... ?

@geneoes
Copy link
Author

geneoes commented Sep 12, 2022

That worked and the build finished successfully, thank you!

@Adphi
Copy link
Member

Adphi commented Sep 12, 2022

You're welcome !

@Adphi Adphi closed this as completed Sep 12, 2022
Adphi added a commit that referenced this issue Sep 13, 2022
set user permissions on image if run with sudo or in docker
run/vbox & run/hetzner: run qemu-img in docker if not available in path

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants