* GUIX 0.7 under QEMU/KVM with virtio
@ 2014-10-04 4:59 Assaf Gordon
2014-10-04 20:42 ` Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: Assaf Gordon @ 2014-10-04 4:59 UTC (permalink / raw)
To: guix-devel
Hello Guix Developers,
I'm experimenting in using Guix under QEMU/KVM.
I've read these:
https://lists.gnu.org/archive/html/guix-devel/2014-09/msg00326.html
http://lists.gnu.org/archive/html/guix-devel/2014-09/msg00149.html
First,
I can provide another recipe:
## On Host
$ wget ftp://alpha.gnu.org/gnu/guix/gnu-usb-install-0.7.x86_64.xz
$ unxz gnu-usb-install-0.7.x86_64.xz
$ qemu-img create -q -f qcow2 guix.qcow2 5G
$ qemu-system-x86_64 --enable-kvm \
-m 1024 \
-net nic,model=virtio -net user \
-boot menu=on \
-hda gnu-usb-install-0.7.x86_64 \
-drive file=guix.qcow2,if=virtio,media=disk,index=0 \
-serial mon:stdio \
-vga std
## Inside guest:
1. Press F12 (quickly) for QEMU Boot menu
2. Choose "1" for QEMU ATA DISK 750MB SIZE (which is the USB image)
3. GRUB Loads, boots into Guix shell
4. The USB drive is "/dev/sda1"
5. The Disk image is "/dev/vda" (unpartitioned)
6. Parition with fdisk:
# fdisk /dev/vda
press n (new partition)
press p (primary partition)
(use defaults for all values)
a (activate parition)
1 (parition number)
w (write changes)
7. Create File system
# mkfs.ext4 -L guix /dev/vda1
8. Follow instructions at
http://www.gnu.org/software/guix/manual/html_node/System-Installation.html
# dhclient eth0
# mount /dev/vda1 /mnt
# deco start cow-store /mnt
# guix system init /mnt/etc/config.scm /mnt
(my 'config.scm' attached below)
Second,
I can confirm Nate's observation that using QEMU's "-usbdrive" option for the USB image causes everything to be VERY slow.
not sure why.
Using "-hda" for the USB image is much better.
Third,
After boot (before setup), I'm trying to get a login prompt on the serial port (which QEMU's redirect to the terminal).
I can do the following:
echo "hello" > /dev/ttyS0 => appears on the terminal
I can also boot with "console=ttyS0,9600n8" (in the GRUB command line), and the kernel messages appear on the console.
However, I can't get a login prompt on the serial console.
I tried variations of:
agetty -L 9600 ttyS0 linux
But they all exit after a timeout of few seconds, and no prompt appears on the serial console.
Any ideas ?
Fourth,
Sadly, after installation is complete, and after rebooting, the system fails to load from "/dev/vda1" (drops to "early boot guile").
Based on the kernel messages, it seems the "virtio_blk" driver is not loaded, and so "/dev/vda" is not available.
If I then switch QEMU parameters from "-drive if=virtio" to "-drive if=ide" the system loads fine (also requires changing grub's "--root" parameter).
Is there a way to fix this? force the kernel to load virto driver?
Regards,
- Assaf
=== config.scm, adapted for "/dev/vda" ====
(use-modules (gnu))
(operating-system
(host-name "guix07")
(timezone "Europe/Paris")
(locale "en_US.UTF-8")
(bootloader (grub-configuration (device "/dev/vda")))
(file-systems (cons (file-system
(device "/dev/vda1")
(mount-point "/")
(type "ext4"))
%base-file-systems))
(users (list (user-account
(name "miles")
(group "users")
(supplementary-groups '("wheel"))
(home-directory "/home/miles")))))
=================
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GUIX 0.7 under QEMU/KVM with virtio
2014-10-04 4:59 GUIX 0.7 under QEMU/KVM with virtio Assaf Gordon
@ 2014-10-04 20:42 ` Ludovic Courtès
2014-10-05 0:15 ` Assaf Gordon
0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2014-10-04 20:42 UTC (permalink / raw)
To: Assaf Gordon; +Cc: guix-devel
Hi, Assaf,
Assaf Gordon <assafgordon@gmail.com> skribis:
> First,
> I can provide another recipe:
Thanks for the recipe. We should probably add a subsection on how to
install to a VM image in the manual. Would you like to amend guix.texi
for that?
> Second,
> I can confirm Nate's observation that using QEMU's "-usbdrive" option for the USB image causes everything to be VERY slow.
> not sure why.
> Using "-hda" for the USB image is much better.
Weird, no idea either.
> Third,
> After boot (before setup), I'm trying to get a login prompt on the serial port (which QEMU's redirect to the terminal).
> I can do the following:
> echo "hello" > /dev/ttyS0 => appears on the terminal
>
> I can also boot with "console=ttyS0,9600n8" (in the GRUB command line), and the kernel messages appear on the console.
> However, I can't get a login prompt on the serial console.
>
> I tried variations of:
> agetty -L 9600 ttyS0 linux
>
> But they all exit after a timeout of few seconds, and no prompt appears on the serial console.
> Any ideas ?
I haven’t tried agetty, but it seems to have a hard-coded default login
program of “/bin/login”, which doesn’t exist here. Could you try
invoking it with -l $(guix build shadow)/bin/login ?
Alternately you could try adding a mingetty service to the
configuration:
(operating-system
...
(services (cons (mingetty-service "ttyS0")
%base-services)))
> Fourth,
> Sadly, after installation is complete, and after rebooting, the system fails to load from "/dev/vda1" (drops to "early boot guile").
> Based on the kernel messages, it seems the "virtio_blk" driver is not loaded, and so "/dev/vda" is not available.
> If I then switch QEMU parameters from "-drive if=virtio" to "-drive if=ide" the system loads fine (also requires changing grub's "--root" parameter).
>
> Is there a way to fix this? force the kernel to load virto driver?
Currently all the drivers needed to mount the root partition must be
explicitly loaded in the initrd. So yes, you would need to have the
virtio modules loaded from the initrd (info "(guix) Initial RAM Disk"):
(operating-system
...
(initrd (lambda (file-systems . rest)
(apply base-initrd file-systems
#:extra-modules '("virtio.ko" "virtio_ring.ko"
"virtio_blk.ko")
rest))))
I think this should work.
Thanks for your feedback!
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GUIX 0.7 under QEMU/KVM with virtio
2014-10-04 20:42 ` Ludovic Courtès
@ 2014-10-05 0:15 ` Assaf Gordon
2014-10-05 12:29 ` Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: Assaf Gordon @ 2014-10-05 0:15 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Hi,
Thanks for the help.
Some more details (replying out of order):
On 10/04/2014 04:42 PM, Ludovic Courtès wrote:
>> Is there a way to fix this? force the kernel to load virto driver?
>
> Currently all the drivers needed to mount the root partition must be
> explicitly loaded in the initrd. So yes, you would need to have the
> virtio modules loaded from the initrd (info "(guix) Initial RAM Disk"):
>
> (operating-system
> ...
> (initrd (lambda (file-systems . rest)
> (apply base-initrd file-systems
> #:extra-modules '("virtio.ko" "virtio_ring.ko"
> "virtio_blk.ko")
> rest))))
Two more things were needed:
1. adding"virtio_pci.ko" and "virtio_net.ko" to the list of drivers.
2. Labeling "/dev/vda1" as "gnu-disk-image" (when doing "mkfs.ext4 -L").
This wasn't needed to boot from "/dev/sda1", but was needed to use "/dev/vda1".
Perhaps some hard-coded thing ?
With these, the VM boots with virtio disk and network.
>
>> After boot (before setup), I'm trying to get a login prompt on the serial port (which QEMU's redirect to the terminal).
>> I can do the following:
>> echo "hello" > /dev/ttyS0 => appears on the terminal
>>
>> I can also boot with "console=ttyS0,9600n8" (in the GRUB command line), and the kernel messages appear on the console.
>> However, I can't get a login prompt on the serial console.
>>
>> I tried variations of:
>> agetty -L 9600 ttyS0 linux
>>
>> But they all exit after a timeout of few seconds, and no prompt appears on the serial console.
>> Any ideas ?
>
> I haven’t tried agetty, but it seems to have a hard-coded default login
> program of “/bin/login”, which doesn’t exist here. Could you try
> invoking it with -l $(guix build shadow)/bin/login ?
>
> Alternately you could try adding a mingetty service to the
> configuration:
>
> (operating-system
> ...
> (services (cons (mingetty-service "ttyS0")
> %base-services)))
>
I still can't get serial console to work, perhaps needs more fidgeting.
Trying "mingetty ttyS0" from the command line fails with:
ttyS0: no controlling tty: Operation not permitted
So I'm not sure 'mingetty' is the way to go.
I'm not well-versed in scheme, so it will take me some more time to figure things out...
-Assaf
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GUIX 0.7 under QEMU/KVM with virtio
2014-10-05 0:15 ` Assaf Gordon
@ 2014-10-05 12:29 ` Ludovic Courtès
2014-10-05 23:29 ` Assaf Gordon
0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2014-10-05 12:29 UTC (permalink / raw)
To: Assaf Gordon; +Cc: guix-devel
Assaf Gordon <assafgordon@gmail.com> skribis:
> On 10/04/2014 04:42 PM, Ludovic Courtès wrote:
>
>>> Is there a way to fix this? force the kernel to load virto driver?
>>
>> Currently all the drivers needed to mount the root partition must be
>> explicitly loaded in the initrd. So yes, you would need to have the
>> virtio modules loaded from the initrd (info "(guix) Initial RAM Disk"):
>>
>> (operating-system
>> ...
>> (initrd (lambda (file-systems . rest)
>> (apply base-initrd file-systems
>> #:extra-modules '("virtio.ko" "virtio_ring.ko"
>> "virtio_blk.ko")
>> rest))))
> Two more things were needed:
> 1. adding"virtio_pci.ko" and "virtio_net.ko" to the list of drivers.
OK.
> 2. Labeling "/dev/vda1" as "gnu-disk-image" (when doing "mkfs.ext4 -L").
> This wasn't needed to boot from "/dev/sda1", but was needed to use "/dev/vda1".
> Perhaps some hard-coded thing ?
“gnu-disk-image” is the label of the root partition of the USB
installation image (see gnu/system/install.scm.)
However, the user’s root can carry any label, as long as the
corresponding ‘file-system’ declaration uses it.
> With these, the VM boots with virtio disk and network.
Good.
>> I haven’t tried agetty, but it seems to have a hard-coded default login
>> program of “/bin/login”, which doesn’t exist here. Could you try
>> invoking it with -l $(guix build shadow)/bin/login ?
>>
>> Alternately you could try adding a mingetty service to the
>> configuration:
>>
>> (operating-system
>> ...
>> (services (cons (mingetty-service "ttyS0")
>> %base-services)))
>>
>
> I still can't get serial console to work, perhaps needs more fidgeting.
Did you try agetty with -l as suggested above?
> Trying "mingetty ttyS0" from the command line fails with:
> ttyS0: no controlling tty: Operation not permitted
Is mingetty running as root here? If it is, could you strace it to see
exactly what returns EPERM?
HTH,
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GUIX 0.7 under QEMU/KVM with virtio
2014-10-05 12:29 ` Ludovic Courtès
@ 2014-10-05 23:29 ` Assaf Gordon
2014-10-06 19:28 ` Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: Assaf Gordon @ 2014-10-05 23:29 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Hello,
On 10/05/2014 08:29 AM, Ludovic Courtès wrote:
>>> I haven’t tried agetty, but it seems to have a hard-coded default login
>>> program of “/bin/login”, which doesn’t exist here. Could you try
>>> invoking it with -l $(guix build shadow)/bin/login ?
>>>
>>> Alternately you could try adding a mingetty service to the
>>> configuration:
>>>
>>> (operating-system
>>> ...
>>> (services (cons (mingetty-service "ttyS0")
>>> %base-services)))
>>>
>>
>> I still can't get serial console to work, perhaps needs more fidgeting.
>
> Did you try agetty with -l as suggested above?
>
Yes. Same as before - it exists after a timeout of few seconds.
>> Trying "mingetty ttyS0" from the command line fails with:
>> ttyS0: no controlling tty: Operation not permitted
>
> Is mingetty running as root here? If it is, could you strace it to see
> exactly what returns EPERM?
>
Yes. Running as root.
I don't have "strace" installed - how do I install it ? (I'm very new to guix).
Thanks,
- Assaf
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GUIX 0.7 under QEMU/KVM with virtio
2014-10-05 23:29 ` Assaf Gordon
@ 2014-10-06 19:28 ` Ludovic Courtès
0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2014-10-06 19:28 UTC (permalink / raw)
To: Assaf Gordon; +Cc: guix-devel
Assaf Gordon <assafgordon@gmail.com> skribis:
> On 10/05/2014 08:29 AM, Ludovic Courtès wrote:
>>>> I haven’t tried agetty, but it seems to have a hard-coded default login
>>>> program of “/bin/login”, which doesn’t exist here. Could you try
>>>> invoking it with -l $(guix build shadow)/bin/login ?
>>>>
>>>> Alternately you could try adding a mingetty service to the
>>>> configuration:
>>>>
>>>> (operating-system
>>>> ...
>>>> (services (cons (mingetty-service "ttyS0")
>>>> %base-services)))
>>>>
>>>
>>> I still can't get serial console to work, perhaps needs more fidgeting.
>>
>> Did you try agetty with -l as suggested above?
>>
>
> Yes. Same as before - it exists after a timeout of few seconds.
>
>>> Trying "mingetty ttyS0" from the command line fails with:
>>> ttyS0: no controlling tty: Operation not permitted
>>
>> Is mingetty running as root here? If it is, could you strace it to see
>> exactly what returns EPERM?
>>
>
> Yes. Running as root.
>
> I don't have "strace" installed - how do I install it ? (I'm very new to guix).
Run ‘guix package -i strace’. Preferably register hydra.gnu.org.pub to
enable “substitutes” before doing that, so the system doesn’t end up
building the world (info "(guix) Substitutes").
HTH,
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-10-06 19:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-04 4:59 GUIX 0.7 under QEMU/KVM with virtio Assaf Gordon
2014-10-04 20:42 ` Ludovic Courtès
2014-10-05 0:15 ` Assaf Gordon
2014-10-05 12:29 ` Ludovic Courtès
2014-10-05 23:29 ` Assaf Gordon
2014-10-06 19:28 ` 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.