unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: myglc2 <myglc2@gmail.com>
To: help-guix@gnu.org
Subject: Re: 'guix system vm' questions
Date: Fri, 01 Jul 2016 16:15:17 -0400	[thread overview]
Message-ID: <864m89f73e.fsf@gmail.com> (raw)
In-Reply-To: 20160629154842.GA26047@jasmine

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

Leo Famulari <leo@famulari.name> writes:

> On Wed, Jun 29, 2016 at 10:10:35AM -0400, Thompson, David wrote:
>> On Wed, Jun 29, 2016 at 2:57 AM, myglc2 <myglc2@gmail.com> wrote:
>> > I have a headless server running Guix/Debian 8.3 on which I would like
>> > to run some guix vms. So far, I have a script (see mkvm.sh, attached)
>> > that runs a single vm. It has some issues:
>> >
>> > 1) lsh-service hangs waiting for keystrokes on the QEMU console
>> 
>> LSH needs to be initialized with a key on first boot, which is why you
>> need to type to create entropy.  This sucks for automation, so I would
>> recommend OpenSSH instead, but we don't have an openssh-service yet.
>
> In your operating system configuration, you can pass 'initialize? #f' to
> lsh-service to skip the SSH seed and host-key initialization. You will
> need to initialize the LSH service later, before you can use it.

I tried that and ... lsh spun looking for a seed file advising me to run
'lsh-make-seed', and then stopped.

'lsh-make-seed' was not available.

Maybe this is a bug?


What I saw on the VM:

### lsh spins and stops showing
[...]
Respawning ssh-daemon.
Service SSH-daemeon has started.
No seed file. Please create on by running 
lwh-make-seed -o "/var/spool/lsh/yarrow-seed-file".
lshd: No rendomness generator available.
Service ssh-daemon has been disabled.
  (Respawning too fast.)

### lsh-make-seed seems to be missing
v1 login: root
root@v1 ~# lsh-make-seed 
-bash: lsh-make-seed: command not found


guix version:

Note: running from git checkout
  File: ‘/home/g1/.config/guix/latest’ -> ‘../../dev/guix’
* master                                  242ad41 download: Use basic authentication when userinfo is present in URI.


test script: attached below

[-- Attachment #2: lsh --]
[-- Type: application/octet-stream, Size: 2124 bytes --]

#!/bin/bash
set -xe

# guix vm examples

# usage
# $ <scriptname> mk  [vm#] - mak image
# $ <scriptname> run [vm#] - run image

CMD=`basename "$0"`
VMNUM=${2:-""}
TMPDIR=$PWD/tmp/$CMD$VMNUM
mkdir -p $TMPDIR

case $1 in
    # make vm image
    mk)
	# vm.config
	cat > "$TMPDIR/vm.scm"<<EOF
(use-modules (gnu))
(use-service-modules networking ssh)
(use-package-modules admin
		     disk
		     ssh rsync wget screen
		     version-control
		     emacs
		     xorg certs
		     graphviz
		     package-management
		     )
(operating-system
  (host-name "v1")
  (timezone "America/New_York")
  (locale "en_US.utf8")
  (bootloader (grub-configuration (device "/dev/sda")))
  (file-systems (cons (file-system
			(device "g1sd")
			(title 'label)
			(mount-point "/")
			(type "ext4"))
		      %base-file-systems))
  (users (cons* (user-account
		 (name "u1")
		 (comment "u 1")
		 (group "users")
		 (supplementary-groups '("wheel"))
		 (home-directory "/home/u1"))
		%base-user-accounts))
  (packages
   (cons*
    glibc-utf8-locales
    parted
    openssh nss-certs xauth rsync wget git git-manpages
    emacs magit screen 
    graphviz
    guix
    %base-packages
    )
   )
  (services (cons* (dhcp-client-service)
		   (lsh-service #:initialize? #f)
		   %base-services)))
EOF

	# show guix version
	# guix system --version
	(stat $HOME/.config/guix/latest | grep File:) > $TMPDIR/guix-version
	git -C ~/.config/guix/latest branch -av | grep '* master' >> $TMPDIR/guix-version
	make -C $HOME/.config/guix/latest -s > $TMPDIR/guix-make.log

	# make image & copy from store
	cp -n $(guix system vm-image $TMPDIR/vm.scm --image-size=4GB) $TMPDIR/vm.img

	# make writeable
	chmod u+w $TMPDIR/vm.img
	;;

    run)
	# run image
	# Note: '-k en-us' is a hack to get Mac XQuartz keys to sort of work
	# note: ' -device virtio-rng-pci ' testing other rdm source
	qemu-system-x86_64 \
	    -net user \
	    -net nic,model=virtio \
	    -enable-kvm \
	    -m 256 \
	    -k en-us \
	    -device virtio-rng-pci \
	    $TMPDIR/vm.img

	;;

    *)

	echo ERROR: you typed: \"$CMD $*\" which has missing arguments or invalid arguments

esac

  reply	other threads:[~2016-07-01 20:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29  6:57 'guix system vm' questions myglc2
2016-06-29 14:10 ` Thompson, David
2016-06-29 15:48   ` Leo Famulari
2016-07-01 20:15     ` myglc2 [this message]
2016-07-02 13:06       ` Ludovic Courtès
2016-07-03 13:47         ` myglc2
2016-07-11 19:32     ` Leo Famulari
2016-06-30 21:20   ` myglc2
  -- strict thread matches above, loose matches on Subject: below --
2016-06-29 18:23 David Craven
2016-06-30 13:10 ` David Craven
2016-07-03 13:53   ` myglc2
2016-07-03 16:09 David Craven
2016-07-06 16:17 ` myglc2
2016-07-07 16:26 David Craven

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=864m89f73e.fsf@gmail.com \
    --to=myglc2@gmail.com \
    --cc=help-guix@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.
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).