all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* qemu instructions for manual
@ 2016-01-11 20:03 Leo Famulari
  2016-01-12 21:50 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Leo Famulari @ 2016-01-11 20:03 UTC (permalink / raw)
  To: guix-devel

Hi everyone,

I recently started using GuixSD in a virtual machine in advance of
getting some dedicated hardware.

This process is not well-documented, at least for somebody who is new to
QEMU. I don't think our manual should explain how to use QEMU, but I do
think it should provide the necessary information to get from `guix
system vm-image` to a working GuixSD virtual machine.

I'm looking for feedback on my understanding of QEMU so that my
contribution to the manual is accurate

This is a 'run-vm.sh' script produced by `guix system vm` for a simple
system declaration:

#!/gnu/store/ibpm6n6706yimzr3967krkxi2ibxq5yh-bash-4.3.39/bin/sh
exec /gnu/store/jm6wvkhq87kwr2grlravx6ix3w63p996-qemu-2.4.0.1/bin/qemu-system-x86_64 \
-kernel /gnu/store/lcs3ncjam9xxkczy34rdn7mxn0y912g9-linux-libre-4.3.3/bzImage \
-initrd /gnu/store/1n5q21mc49pkb33ynf6nzrmx11vgp28r-system/initrd \
-append "--system=/gnu/store/1n5q21mc49pkb33ynf6nzrmx11vgp28r-system --load=/gnu/store/1n5q21mc49pkb33ynf6nzrmx11vgp28r-system/boot --root=/dev/vda1 " \
-enable-kvm \
-no-reboot \
-net nic,model=virtio \
-virtfs local,path="/gnu/store",security_model=none,mount_tag="TAG_gnu_store" \
-net user \
-serial stdio \
-vga std \
-drive file=/gnu/store/2azafsay573829m1hynp27kwvmssdp1f-qemu-image,if=virtio,cache=writeback,werror=report,readonly \
-m 256 \
"$@"

This appears to be the minimum QEMU invocation that works:
$ qemu-system-x86_64 \
-net user \
-net nic,model=virtio \
-m 256 \
./qemu-image

Is there anything else that can be adapted from the run-vm.sh script?

After playing around with `guix system vm-image`, this appears to be the
minimum list of commands that will successfully boot GuixSD:
$ guix system vm-image --image-size=1G ~/guix/doc/os-config-bare-bones.texi 
$ cp /gnu/store/...-qemu-image ./qemu-image && guix gc -d /gnu/store/...-qemu-image
$ chmod 600 ./qemu-image
$ qemu-system-x86_64 \
-net user \
-net nic,model=virtio \
-m 256 \
./qemu-image

Annotated version:
# System type to emulate. Does this have to match the host hardware? Can
# "foreign" arch machine images be built with Guix?
$ qemu-system-x86_64 \

# Unprivileged user mode networking. Guest can access host but not vice versa.
# If you don't choose a network stack, the boot process will fail.
-net user \

# You must create a network interface of a given model. You can get a list of
# available NIC types by running `qemu-system-$arch -net nic,model=help`. If
# you don't create a NIC, the boot process will fail.
-net nic,model=virtio \

# RAM available to the guest OS. Defaults to 128 megabytes, which is not enough
# for the Guix daemon. More is better.
-m 256 \

OPTIONAL: If your system is x86 with hardware virtualization extensions,
enabling the kernel virtual machine will make things go much faster.
-enable-kvm \

# Path to the virtual machine image
./qemu-image

Any feedback?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: qemu instructions for manual
  2016-01-11 20:03 qemu instructions for manual Leo Famulari
@ 2016-01-12 21:50 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2016-01-12 21:50 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

Leo Famulari <leo@famulari.name> skribis:

> This appears to be the minimum QEMU invocation that works:
> $ qemu-system-x86_64 \
> -net user \
> -net nic,model=virtio \
> -m 256 \
> ./qemu-image

In practice -enable-kvm is highly recommended too.  I think anything
less than 5 to 8(?) years old supports virtualization extensions.

> Annotated version:
> # System type to emulate. Does this have to match the host hardware? Can
> # "foreign" arch machine images be built with Guix?
> $ qemu-system-x86_64 \

In theory we should be able to cross-compile complete GuixSD images to
other architectures, but that’s never been tried and there are probably
lots of build issues on the way, so let’s say that this has to match the
hardware platform or a sibling thereof (e.g., i686 code can be built on
x86_64.)

> # Unprivileged user mode networking. Guest can access host but not vice versa.
> # If you don't choose a network stack, the boot process will fail.
> -net user \
>
> # You must create a network interface of a given model. You can get a list of
> # available NIC types by running `qemu-system-$arch -net nic,model=help`. If
> # you don't create a NIC, the boot process will fail.
> -net nic,model=virtio \
>
> # RAM available to the guest OS. Defaults to 128 megabytes, which is not enough
> # for the Guix daemon. More is better.
> -m 256 \
>
> OPTIONAL: If your system is x86 with hardware virtualization extensions,
> enabling the kernel virtual machine will make things go much faster.
> -enable-kvm \
>
> # Path to the virtual machine image
> ./qemu-image

Sounds good!

Note that our QEMU package installs two Info manuals.  They are sparse,
but helpful.

In the Guix manual, and interesting thing would be an “Installating
GuixSD in a VM” section.  This is a bit more involved than the above,
because you need a target disk image separate from the installation
image, but the above is a good start.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-12 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11 20:03 qemu instructions for manual Leo Famulari
2016-01-12 21:50 ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.