unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 43650@debbugs.gnu.org
Subject: [bug#43650] [PATCH 4/8] services: hurd-vm: Check whether /dev/kvm exists at run time.
Date: Tue, 29 Sep 2020 16:22:02 +0200	[thread overview]
Message-ID: <87v9fw1x4l.fsf@gnu.org> (raw)
In-Reply-To: <87r1qk7v11.fsf@gnu.org> ("Ludovic Courtès"'s message of "Tue, 29 Sep 2020 12:10:50 +0200")

[-- Attachment #1: Type: text/plain, Size: 2108 bytes --]

Ludovic Courtès writes:

Hello,

> I’ve pushed ‘wip-childhurd’ with a few additional commits.

Great, this works/fixes it for me!  Using the attached
bare+childhurd.tmpl, I can build and start a Guix VM with a childhurd:

--8<---------------cut here---------------start------------->8---
$ $(./pre-inst-env guix system vm gnu/system/examples/bare+childhurd.tmpl) \
  -m 1G --nographic --net nic \
  --net user,hostfwd=tcp:127.0.0.1:12022-:2222,hostfwd=tcp:127.0.0.1:13022-:10022
--8<---------------cut here---------------end--------------->8---

and then, after half a minute or so:

--8<---------------cut here---------------start------------->8---
$ ssh -p 13022 localhost


  This is the GNU Hurd.  Welcome.

root@childhurd ~#
--8<---------------cut here---------------end--------------->8---

> The flaky startup issue appears to be fixed by:
>
>   88946005d7 * services: secret-service: Add initial client/server handshake.
>
> Before that, what would happen is that:
>
>   1. The host would connect(2) to QEMU as soon as QEMU is running;
>      connect(2) would succeed immediately and so the host would send its
>      secrets right away, disconnect, and move on.
>
>      However, at that point, the guest is still booting and its secret
>      service server is not even accept(2)ing yet.  Looks like QEMU’s
>      SLIRP would more or less buffer the packets the host sent, “more or
>      less” being the important point.
>
>   2. The guest would eventually accept(2), which would succeed.  Then it
>      would sometimes receive stuff, sometimes not, depending on what
>      happened with the SLIRP buffering I suppose.

Ah, thanks for the explanation...that makes sense.

> Consequently, it can take ~20s for the ‘start’ method of the childhurd
> to succeed.  Eventually, when shepherd runs on Fibers or similar, it
> won’t be a problem, but for now it means that PID 1 remains stuck in
> select(2) for this many seconds.

Yeah...Anyway LGTM!

Greetings,
Janneke


[-- Attachment #2: bare+childhurd.tmpl --]
[-- Type: application/octet-stream, Size: 3351 bytes --]

;; This is an operating system configuration template
;; for a "bare bones" setup, with no X11 display server.

(use-modules (gnu) (guix records))
(use-service-modules networking ssh virtualization)
(use-package-modules screen ssh)

;; Forward SSH and VNC to public interface, to allow QEMUs hostfwd
(define (childhurd-net-options config)
  `("--device" "rtl8139,netdev=net0"
    "--netdev" ,(string-append
                 "user,id=net0"
                 ",hostfwd=tcp:127.0.0.1:"
                 (number->string (hurd-vm-port config
                                               (@@ (gnu services virtualization) %hurd-vm-secrets-port)))
                 "-:1004"
                 ",hostfwd=tcp:0.0.0.0:"
                 (number->string (hurd-vm-port config
                                               (@@ (gnu services virtualization) %hurd-vm-ssh-port)))
                 "-:2222"
                 ",hostfwd=tcp:0.0.0.0:"
                 (number->string (hurd-vm-port config
                                               (@@ (gnu services virtualization) %hurd-vm-vnc-port)))
                 "-:5900")))

(operating-system
  (host-name "komputilo")
  (timezone "Europe/Berlin")
  (locale "en_US.utf8")

  ;; Allow running QEMU with --nographic
  (kernel-arguments '("console=tty0"
                      "console=ttyS0,115200"))

  ;; Boot in "legacy" BIOS mode, assuming /dev/sdX is the
  ;; target hard disk, and "my-root" is the label of the target
  ;; root file system.
  (bootloader (bootloader-configuration
                (bootloader grub-bootloader)
                (target "/dev/sdX")))
  (file-systems (cons (file-system
                        (device (file-system-label "my-root"))
                        (mount-point "/")
                        (type "ext4"))
                      %base-file-systems))

  ;; This is where user accounts are specified.  The "root"
  ;; account is implicit, and is initially created with the
  ;; empty password.
  (users (cons* (user-account
                (name "alice")
                (comment "Bob's sister")
                (group "users")

                ;; Adding the account to the "wheel" group
                ;; makes it a sudoer.  Adding it to "audio"
                ;; and "video" allows the user to play sound
                ;; and access the webcam.
                (supplementary-groups '("wheel"
                                        "audio" "video")))
               
               %base-user-accounts))

  ;; Globally-installed packages.
  (packages (cons screen %base-packages))

  ;; Add services to the baseline: a DHCP client and
  ;; an SSH server.
  (services (append (list (service dhcp-client-service-type)
                          (service openssh-service-type
                                   (openssh-configuration
                                    (openssh openssh-sans-x)
                                    (port-number 2222)
                                    (permit-root-login #t)
                                    (allow-empty-passwords? #t)
                                    (password-authentication? #t)))
                          (service hurd-vm-service-type
		                   (hurd-vm-configuration
                                    (net-options (childhurd-net-options this-record)))))
                    %base-services)))

[-- Attachment #3: Type: text/plain, Size: 152 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com

  reply	other threads:[~2020-09-29 14:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 15:29 [bug#43650] [PATCH 0/8] Assorted childhurd improvements Ludovic Courtès
2020-09-27 15:32 ` [bug#43650] [PATCH 1/8] services: hurd-vm: Run QEMU as an unprivileged user Ludovic Courtès
2020-09-27 15:32   ` [bug#43650] [PATCH 2/8] services: childhurd: Tweak description Ludovic Courtès
2020-09-27 15:32   ` [bug#43650] [PATCH 3/8] secret-service: Clarify the origin of messages Ludovic Courtès
2020-09-27 15:32   ` [bug#43650] [PATCH 4/8] services: hurd-vm: Check whether /dev/kvm exists at run time Ludovic Courtès
2020-09-28 17:02     ` Jan Nieuwenhuizen
2020-09-29 10:10       ` Ludovic Courtès
2020-09-29 14:22         ` Jan Nieuwenhuizen [this message]
2020-09-29 20:13           ` bug#43650: " Ludovic Courtès
2020-09-27 15:32   ` [bug#43650] [PATCH 5/8] services: guix: Generate key pair if needed during activation Ludovic Courtès
2020-09-27 15:32   ` [bug#43650] [PATCH 6/8] services: hurd-vm: Initialize the guest's SSH/Guix keys at activation time Ludovic Courtès
2020-09-27 15:32   ` [bug#43650] [PATCH 7/8] services: hurd-vm: Pass "-no-reboot" when spawning the Hurd VM Ludovic Courtès
2020-09-27 15:32   ` [bug#43650] [PATCH 8/8] secret-service: Add a timeout when waiting for a client Ludovic Courtès
2020-09-28 16:57   ` [bug#43650] [PATCH 1/8] services: hurd-vm: Run QEMU as an unprivileged user Jan Nieuwenhuizen
2020-09-28 22:19     ` Ludovic Courtès
2020-09-29  7:06     ` Efraim Flashner
2020-09-29 10:23       ` Ludovic Courtès
2020-09-28 17:10 ` [bug#43650] [PATCH 0/8] Assorted childhurd improvements Jan Nieuwenhuizen
2020-09-28 20:47   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9fw1x4l.fsf@gnu.org \
    --to=janneke@gnu.org \
    --cc=43650@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).