unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Building Qemu VM
@ 2024-12-09  0:29 Timothy Washington
  2024-12-09  8:51 ` Jeremy Korwin-Zmijowski
  2024-12-09  9:27 ` Andreas Enge
  0 siblings, 2 replies; 6+ messages in thread
From: Timothy Washington @ 2024-12-09  0:29 UTC (permalink / raw)
  To: help-guix

I've got an existing `system.scm` which defines `physical-operating-system`
as a guix `operating-system`.

I've created a simplified `vm-image` in its own file `vm.scm`.

(use-modules (gnu)
             (gnu system)
             (gnu system image)
             (gnu system vm)
             (guix gexp))

(load "system.scm")

(define vm-image
  (image
   (operating-system physical-operating-system)
   (format qcow2-image-type)
   (size (* 10 (expt 2 30)))))
vm-image


A. However this configuration is giving me this error, even though i.
qcow2-image-type
<https://guix.gnu.org/manual/en/html_node/image_002dtype-Reference.html#index-qcow2_002dimage_002dtype>
clearly exists. And I ii. I made sure to `guix pull` to the latest version.

$ guix system image -t qcow2 vm.scm
guix system: error: #<<image-type> name: qcow2 constructor: #<procedure
7feb505b76e0 at gnu/system/image.scm:249:16 (t-14c4023038d444da-1784)>>:
invalid 'format' value


B. Removing `(format qcow2-image-type)` gives me this error. So guix wants
the `(format)` field initializer.

$ guix system image -t qcow2 vm.scm
/home/twashing/dotfiles/vm.scm:10:2: error: (image (operating-system
physical-operating-system) (size (* 10 (expt 2 30)))): missing field
initializers (format)


C. And quoting the symbol with `(format 'qcow2-image-type)` doesn't solve
the problem either.

$ guix system image -t qcow2 vm.scm
/home/twashing/dotfiles/vm.scm:12:11: error: qcow2-image-type: invalid
'format' value


D. After combing through the documentation
<https://guix.gnu.org/manual/en/html_node/Invoking-guix-system.html#index-image_002c-creating-disk-images>,
I also tried building an image against my base `system.scm`.

(operating-system
 ...
 (bootloader
    (bootloader-configuration
     (bootloader grub-efi-bootloader)
     (targets (list "/boot/efi"))
     (keyboard-layout keyboard-layout)))
 ...)

But that also fails with this configuration.

$ guix system image --image-type=qcow2 system.scm
guix system: error: EFI bootloader required with GPT partitioning


What am I missing here?

Tim

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

* Re: Building Qemu VM
  2024-12-09  0:29 Building Qemu VM Timothy Washington
@ 2024-12-09  8:51 ` Jeremy Korwin-Zmijowski
  2024-12-11  4:52   ` Timothy Washington
  2024-12-09  9:27 ` Andreas Enge
  1 sibling, 1 reply; 6+ messages in thread
From: Jeremy Korwin-Zmijowski @ 2024-12-09  8:51 UTC (permalink / raw)
  To: help-guix

Hi Timothy,

Last time I generated a system image, I ran this command :

guix system image --image-size=10G --image-type=qcow2 basic.scm

Does it help ?

Jérémy



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

* Re: Building Qemu VM
  2024-12-09  0:29 Building Qemu VM Timothy Washington
  2024-12-09  8:51 ` Jeremy Korwin-Zmijowski
@ 2024-12-09  9:27 ` Andreas Enge
  2024-12-11  4:50   ` Timothy Washington
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Enge @ 2024-12-09  9:27 UTC (permalink / raw)
  To: Timothy Washington; +Cc: help-guix

Hello Tim,

Am Sun, Dec 08, 2024 at 07:29:47PM -0500 schrieb Timothy Washington:
> (define vm-image
>   (image
>    (operating-system physical-operating-system)
>    (format qcow2-image-type)
>    (size (* 10 (expt 2 30)))))

looking at the code, I see this in gnu/image.scm:
(define-record-type* <image>
  image make-image
  image?
  (name               image-name ;symbol
                      (default #false))
  (format             image-format                ;symbol
                      (sanitize validate-image-format))
...

and a bit above:
;; The supported image formats.
(define-set-sanitizer validate-image-format format
  (disk-image compressed-qcow2 docker iso9660 tarball wsl2))

So my guess is that 'compressed-qcow2 would be the value to put there.

Andreas



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

* Re: Building Qemu VM
  2024-12-09  9:27 ` Andreas Enge
@ 2024-12-11  4:50   ` Timothy Washington
  2024-12-11 12:42     ` Andreas Enge
  0 siblings, 1 reply; 6+ messages in thread
From: Timothy Washington @ 2024-12-11  4:50 UTC (permalink / raw)
  To: Andreas Enge; +Cc: help-guix

Hi Andreas,

Ah, so my `(use-modules)` needed A, not B.
Ie the `image` form is coming from `gnu.image`, not `gnu.system.image`.
But then what is the difference between these two modules?
When would I use `gnu.system.image` instead of `gnu.image`?

A. (gnu image)
B. (gnu system image)

Either way, I've gotten a step further.
But I've run across another problem building a Qemu VM image.
The vm definition in C gives me the error in D. Anything that I'm missing?

C
(use-modules (gnu)
             (gnu image)
             (gnu system vm)
             (gnu system)
             (gnu system file-systems))

(load "system.scm")

(define (boot-partition size)
  (file-system
     (mount-point "/boot")
     (device "/dev/vda1")
     (type "ext4")))

(define (root-partition size)
  (file-system
     (mount-point "/")
     (device "/dev/vda1")
     (type "ext4")))

(define vm-image
  (image
   (operating-system physical-operating-system)
   (format 'compressed-qcow2)
   (size (* 10 (expt 2 30)))
   (partitions
    (list (boot-partition (* 1 (expt 2 30)))
          (root-partition (* 9 (expt 2 30)))))))

vm-image


D
$ guix system image -t qcow2 vm.scm
Backtrace:
In guix/status.scm:
    859:3 19 (_)
    839:4 18 (call-with-status-report _ _)
In guix/scripts/system.scm:
   1318:4 17 (_)
In ice-9/boot-9.scm:
  1752:10 16 (with-exception-handler _ _ #:unwind? _ # _)
In guix/store.scm:
   689:37 15 (thunk)
   1330:8 14 (call-with-build-handler #<procedure 7f8e82ced090 at g…> …)
  2210:25 13 (run-with-store #<store-connection 256.100 7f8e7e2b0910> …)
In guix/scripts/system.scm:
    858:2 12 (_ _)
In guix/store.scm:
  2038:13 11 (_ #<store-connection 256.100 7f8e7e2b0910>)
In guix/gexp.scm:
   300:51 10 (_)
In unknown file:
           9 (with-fluids* (#<fluid 7f8e94df84a0>) (#f) #<procedure …>)
In guix/gexp.scm:
   750:29  8 (_)
In gnu/system/image.scm:
  1010:15  7 (_)
   943:32  6 (operating-system-for-image #<<image> name: #f format: …>)
   892:28  5 (image->root-file-system #<<image> name: #f format: com…>)
    349:6  4 (find-root-partition _)
In srfi/srfi-1.scm:
   730:15  3 (find #<procedure root-partition? (partition)> _)
In gnu/system/image.scm:
   345:16  2 (root-partition? #<<file-system> device: "/dev/vda1" mo…>)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure partition-flags: Wrong type argument: #<<file-system> device:
"/dev/vda1" mount-point: "/boot" type: "ext4" flags: () options: #f mount?:
#t mount-may-fail?: #f needed-for-boot?: #f check?: #t
skip-check-if-clean?: #t repair: preen create-mount-point?: #f
dependencies: () shepherd-requirements: () location: ((filename .
"/home/twashing/dotfiles/vm.scm") (line . 44) (column . 2))>

Tim


On Mon, 9 Dec 2024 at 04:27, Andreas Enge <andreas@enge.fr> wrote:

> Hello Tim,
>
> Am Sun, Dec 08, 2024 at 07:29:47PM -0500 schrieb Timothy Washington:
> > (define vm-image
> >   (image
> >    (operating-system physical-operating-system)
> >    (format qcow2-image-type)
> >    (size (* 10 (expt 2 30)))))
>
> looking at the code, I see this in gnu/image.scm:
> (define-record-type* <image>
>   image make-image
>   image?
>   (name               image-name ;symbol
>                       (default #false))
>   (format             image-format                ;symbol
>                       (sanitize validate-image-format))
> ...
>
> and a bit above:
> ;; The supported image formats.
> (define-set-sanitizer validate-image-format format
>   (disk-image compressed-qcow2 docker iso9660 tarball wsl2))
>
> So my guess is that 'compressed-qcow2 would be the value to put there.
>
> Andreas
>
>

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

* Re: Building Qemu VM
  2024-12-09  8:51 ` Jeremy Korwin-Zmijowski
@ 2024-12-11  4:52   ` Timothy Washington
  0 siblings, 0 replies; 6+ messages in thread
From: Timothy Washington @ 2024-12-11  4:52 UTC (permalink / raw)
  To: Jeremy Korwin-Zmijowski; +Cc: help-guix

Yes, Cheers for that. I'm able to run that command, and get a bit further.

Tim

On Mon, 9 Dec 2024 at 05:08, Jeremy Korwin-Zmijowski <
jeremy@korwin-zmijowski.fr> wrote:

> Hi Timothy,
>
> Last time I generated a system image, I ran this command :
>
> guix system image --image-size=10G --image-type=qcow2 basic.scm
>
> Does it help ?
>
> Jérémy
>
>
>

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

* Re: Building Qemu VM
  2024-12-11  4:50   ` Timothy Washington
@ 2024-12-11 12:42     ` Andreas Enge
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Enge @ 2024-12-11 12:42 UTC (permalink / raw)
  To: Timothy Washington; +Cc: help-guix

Am Tue, Dec 10, 2024 at 11:50:44PM -0500 schrieb Timothy Washington:
> (define (boot-partition size)
>   (file-system
>      (mount-point "/boot")
>      (device "/dev/vda1")
>      (type "ext4")))
> 
> (define (root-partition size)
>   (file-system
>      (mount-point "/")
>      (device "/dev/vda1")
>      (type "ext4")))
> 
> (define vm-image
>   (image
>    (operating-system physical-operating-system)
>    (format 'compressed-qcow2)
>    (size (* 10 (expt 2 30)))
>    (partitions
>     (list (boot-partition (* 1 (expt 2 30)))
>           (root-partition (* 9 (expt 2 30)))))))

Have a look at the documentation of the "image" record:
   https://guix.gnu.org/manual/en/html_node/image-Reference.html#index-image
and follow the "partition Reference":
   https://guix.gnu.org/manual/en/html_node/partition-Reference.html

A partition is not a file-system.

Andreas



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

end of thread, other threads:[~2024-12-11 12:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-09  0:29 Building Qemu VM Timothy Washington
2024-12-09  8:51 ` Jeremy Korwin-Zmijowski
2024-12-11  4:52   ` Timothy Washington
2024-12-09  9:27 ` Andreas Enge
2024-12-11  4:50   ` Timothy Washington
2024-12-11 12:42     ` Andreas Enge

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).