Guix on Debian 8.3 'guix system vm ...' -> "ERROR: qemu failed "qemu-system-x86_64"

  • Done
  • quality assurance status badge
Details
3 participants
  • Leo Famulari
  • Ludovic Courtès
  • myglc2
Owner
unassigned
Submitted by
myglc2
Severity
normal

Debbugs page

M
M
myglc2 wrote on 24 Jun 2016 06:53
(address . bug-guix@gnu.org)
86lh1ur8vr.fsf@gmail.com
Apologies in advance if I missed a required step & this is operator
error as it is my first attempt to use QEMU/Debian.


Running Guix on Debian 8.3, I set up qemu like this ...

su
apt-get update
apt-get upgrade
apt-get install qemu
apt-get install qemu-kvm
apt-get install libvirt-bin
adduser g1 kvm
adduser g1 libvirt


... then, as user g1, I checked that virsh commands work ...

g1@e3b:~/dev/vms$ virsh list --all
Id Name State
----------------------------------------------------

g1@e3b:~/dev/vms$ virsh --connect qemu:///system list --all
Id Name State
----------------------------------------------------

g1@e3b:~/dev/vms$ virsh version --daemon
Compiled against library: libvirt 1.2.9
Using library: libvirt 1.2.9
Using API: QEMU 1.2.9
Running hypervisor: QEMU 2.1.2
Running against daemon: 1.2.9


... then, using this version of guix ...

git branch -av | grep '* master'
* master bae0636 bournish: Add 'wc' command.
g1@e3b:~/dev/guix$ stat /home/g1/.config/guix/latest | grep File:
File: ‘/home/g1/.config/guix/latest’ -> ‘../../dev/guix’


... I tried making a guix vm ...

g1@e3b:~/dev/vms$ guix system vm ../configs/c01system.scm --expose=$HOME --share=$HOME/tmp=/exchange --verbosity=1
;;; note: source file /home/g1/.config/guix/latest/gnu/packages/screen.scm
;;; newer than compiled /home/g1/.config/guix/latest/gnu/packages/screen.go
;;; compiling /home/g1/.config/guix/latest/gnu/packages/screen.scm
;;; compiled /home/g1/.cache/guile/ccache/2.0-LE-8-2.0/home/g1/dev/guix/gnu/packages/screen.scm.go
substitute: warning: failed to install locale: Invalid argument
substitute: updating list of substitutes from 'http://hydra.gnu.org'... 100.0%
The following derivations will be built:
/gnu/store/jz6mlhlz7f5sp4g93spac69bxfjpjbqg-run-vm.sh.drv
/gnu/store/5f6zfsx0fa0bzkl4ynqb1lf5pk3m4rfs-qemu-image.drv
warning: failed to install locale: Invalid argument
building path(s) `/gnu/store/nbppjjb2kkb17nr8jqas7hchkg669nv9-qemu-image'
Formatting 'image.qcow2', fmt=qcow2 size=31457280 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
Could not access KVM kernel module: Permission denied
failed to initialize KVM: Permission denied
Backtrace:
In ice-9/boot-9.scm:
157: 10 [catch #t #<catch-closure 8c9720> ...]
In unknown file:
?: 9 [apply-smob/1 #<catch-closure 8c9720>]
In ice-9/boot-9.scm:
63: 8 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
432: 7 [eval # #]
In ice-9/boot-9.scm:
2401: 6 [save-module-excursion #<procedure 8e6800 at ice-9/boot-9.scm:4045:3 ()>]
4050: 5 [#<procedure 8e6800 at ice-9/boot-9.scm:4045:3 ()>]
1724: 4 [%start-stack load-stack #<procedure 8f97c0 at ice-9/boot-9.scm:4041:10 ()>]
1729: 3 [#<procedure 8fb9c0 ()>]
In unknown file:
?: 2 [primitive-load "/gnu/store/kfakhvdns3vjpivw6pk0bkdqafywr9s9-qemu-image-builder"]
In ./gnu/build/vm.scm:
127: 1 [load-in-linux-vm "/gnu/store/9yprr0vmwnpvlkr2a0jgylpf9py6cf83-linux-vm-loader" ...]
In unknown file:
?: 0 [scm-error misc-error #f "~A ~S" ("qemu failed" "qemu-system-x86_64") #f]

ERROR: In procedure scm-error:
ERROR: qemu failed "qemu-system-x86_64"
environment variable `PATH' set to `/gnu/store/nk0z0qs8g3i03jfyi6hr2rwnd9pg2qnv-qemu-minimal-2.6.0/bin:/gnu/store/34j2zmi69mqwrslpyizbi9mcxmn2hzgb-coreutils-8.24/bin'
builder for `/gnu/store/5f6zfsx0fa0bzkl4ynqb1lf5pk3m4rfs-qemu-image.drv' failed with exit code 1
cannot build derivation `/gnu/store/jz6mlhlz7f5sp4g93spac69bxfjpjbqg-run-vm.sh.drv': 1 dependencies couldn't be built
guix system: error: build failed: build of `/gnu/store/jz6mlhlz7f5sp4g93spac69bxfjpjbqg-run-vm.sh.drv' failed
g1@e3b:~/dev/vms$

tia, - George
Attachment: c01glc.scm
L
L
Leo Famulari wrote on 24 Jun 2016 07:47
(name . myglc2)(address . myglc2@gmail.com)(address . 23838@debbugs.gnu.org)
20160624144746.GA1545@jasmine
On Fri, Jun 24, 2016 at 09:53:12AM -0400, myglc2 wrote:
Toggle quote (2 lines)
> g1@e3b:~/dev/vms$ guix system vm ../configs/c01system.scm --expose=$HOME --share=$HOME/tmp=/exchange --verbosity=1

[...]

Toggle quote (3 lines)
> Could not access KVM kernel module: Permission denied
> failed to initialize KVM: Permission denied

On Debian, /dev/kvm is by default not accessible to unprivileged users.
I manually do `chmod 666 /dev/kvm` when I need to use QEMU with KVM,
after each reboot.
L
L
Ludovic Courtès wrote on 24 Jun 2016 08:52
(name . myglc2)(address . myglc2@gmail.com)(address . 23838@debbugs.gnu.org)
87k2he37pa.fsf@gnu.org
Hi!

myglc2 <myglc2@gmail.com> skribis:

Toggle quote (9 lines)
> The following derivations will be built:
> /gnu/store/jz6mlhlz7f5sp4g93spac69bxfjpjbqg-run-vm.sh.drv
> /gnu/store/5f6zfsx0fa0bzkl4ynqb1lf5pk3m4rfs-qemu-image.drv
> warning: failed to install locale: Invalid argument
> building path(s) `/gnu/store/nbppjjb2kkb17nr8jqas7hchkg669nv9-qemu-image'
> Formatting 'image.qcow2', fmt=qcow2 size=31457280 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
> Could not access KVM kernel module: Permission denied
> failed to initialize KVM: Permission denied

Please make sure the guixbuild* user accounts have write permission for
/dev/kvm.

Usually, /dev/kvm is has “kvm” as its group and is group-writable. So
all you need is to add the guixbuild* users to the “kvm” group.

The manual mentions this pitfall (info "(guix) Invoking guix system")
but I guess it’s easily missed.

Thanks,
Ludo’.
M
M
myglc2 wrote on 24 Jun 2016 12:34
(address . bug-guix@gnu.org)
86ziqanzxz.fsf@gmail.com
ludo@gnu.org (Ludovic Courtès) writes:
Toggle quote (4 lines)
>
> Usually, /dev/kvm is has “kvm” as its group and is group-writable. So
> all you need is to add the guixbuild* users to the “kvm” group.

Thank you, it does.

Toggle quote (3 lines)
> The manual mentions this pitfall (info "(guix) Invoking guix system")
> but I guess it’s easily missed.

Thank you, so I did this ...

adduser guixbuilder1 kvm
adduser guixbuilder2 kvm
adduser guixbuilder3 kvm
adduser guixbuilder4 kvm
adduser guixbuilder5 kvm
adduser guixbuilder6 kvm
adduser guixbuilder7 kvm
adduser guixbuilder8 kvm

... but maybe the manual should say this ...

# 2.4.1 Build Environment Setup
# -----------------------------
# [...]
# On a GNU/Linux system, a build user pool may be created like this
# (using Bash syntax and the ‘shadow’ commands):
#
# # groupadd --system guixbuild
# # for i in `seq -w 1 10`;
# do
# useradd -g guixbuild -G guixbuild,kvm \
# -d /var/empty -s `which nologin` \
# -c "Guix build user $i" --system \
# guixbuilder$i;
# done

... anyway, now I get ...

g1@e3b:~/dev/vms$ guix system vm ../configs/c01system.scm --expose=$HOME --share=$HOME/tmp=/exchange --verbosity=1
substitute: warning: failed to install locale: Invalid argument
/gnu/store/7rv558c43bwnmmkc85izv1b69ards5qy-run-vm.sh
g1@e3b:~/dev/vms$ /gnu/store/7rv558c43bwnmmkc85izv1b69ards5qy-run-vm.sh
qemu-system-x86_64: -virtfs local,path=/home/g1/tmp,security_model=none,mount_tag=TAG_home_g1_tmp: 9pfs Failed to initialize fs-driver with id:TAG_home_g1_tmp and export path:/home/g1/tmp
g1@e3b:~/dev/vms$

TIA, George
M
M
myglc2 wrote on 24 Jun 2016 15:15
(address . bug-guix@gnu.org)
86vb0ynshh.fsf@gmail.com
myglc2 <myglc2@gmail.com> writes:

Toggle quote (8 lines)
> ludo@gnu.org (Ludovic Courtès) writes:
>>
>> Usually, /dev/kvm is has “kvm” as its group and is group-writable. So
>> all you need is to add the guixbuild* users to the “kvm” group.
>
> Thank you, so I did this ...
>
> adduser guixbuilder1 kvm
...
Toggle quote (10 lines)
>
> ... anyway, now I get ...
>
> g1@e3b:~/dev/vms$ guix system vm ../configs/c01system.scm --expose=$HOME --share=$HOME/tmp=/exchange --verbosity=1
> substitute: warning: failed to install locale: Invalid argument
> /gnu/store/7rv558c43bwnmmkc85izv1b69ards5qy-run-vm.sh
> g1@e3b:~/dev/vms$ /gnu/store/7rv558c43bwnmmkc85izv1b69ards5qy-run-vm.sh
> qemu-system-x86_64: -virtfs local,path=/home/g1/tmp,security_model=none,mount_tag=TAG_home_g1_tmp: 9pfs Failed to initialize fs-driver with id:TAG_home_g1_tmp and export path:/home/g1/tmp
> g1@e3b:~/dev/vms$

OOH! DUH! Nevermind ...

mkdir /home/g1/tmp

... fixes this.
L
L
Ludovic Courtès wrote on 26 Jun 2016 03:20
(name . myglc2)(address . myglc2@gmail.com)(address . 23838@debbugs.gnu.org)
87mvm8meu0.fsf@gnu.org
myglc2 <myglc2@gmail.com> skribis:

Toggle quote (17 lines)
> ... but maybe the manual should say this ...
>
> # 2.4.1 Build Environment Setup
> # -----------------------------
> # [...]
> # On a GNU/Linux system, a build user pool may be created like this
> # (using Bash syntax and the ‘shadow’ commands):
> #
> # # groupadd --system guixbuild
> # # for i in `seq -w 1 10`;
> # do
> # useradd -g guixbuild -G guixbuild,kvm \
> # -d /var/empty -s `which nologin` \
> # -c "Guix build user $i" --system \
> # guixbuilder$i;
> # done

I’ve added something along these lines, thank you!

Ludo’.
L
L
Ludovic Courtès wrote on 26 Jun 2016 03:20
control message for bug #23838
(address . control@debbugs.gnu.org)
87lh1smeth.fsf@gnu.org
tags 23838 notabug
close 23838
?
Your comment

This issue is archived.

To comment on this conversation send an email to 23838@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 23838
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch