all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* guix deploy: modinfo.sh doesn't exist error
@ 2023-01-22 15:20 Dmitry Matveyev
  2023-01-22 15:45 ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Matveyev @ 2023-01-22 15:20 UTC (permalink / raw)
  To: help-guix

I'm trying to use guix deploy to install a Guix System at vultr.com
using a minimal iso image file of Guix System. So I do:

1. Create a minimal ISO image using guix system
2. Boot the ISO image on a remote server
3. Use guix deploy to install the system

I fail at step 3 with "modinfo.sh doesn't exist" error. Below is (1) the
end of the guix deploy command output and (2) my complete instruction of
what I do up to guix deploy command.

I use Guix version d6f1b9487da3e6f9c3ef49dea9c97c0408a25777 on Arch Linux.

The end of guix deploy command is:

================================================================================
building /gnu/store/m6vv3zqf792spnc9fmsnbbfah1cyjx35-grub.cfg.drv...
building /gnu/store/sw9rqrsdqlz5mqxji9wk7i7v30q6mgl2-install-bootloader.scm.drv...
building /gnu/store/nyb01ypw9wbhvk1yqzgpd1brydc15llq-remote-exp.scm.drv...
guix deploy: sending 3 store items (0 MiB) to '10.10.255.50'...

guix deploy: error: failed to deploy vm: failed to install bootloader on
'70.34.254.49':

%exception #<inferior-object #<&message message:
"'/gnu/store/ch9q9w5zbvgq8srr6dscq6hdf03pfqb4-grub-efi-2.06/sbin/grub-install
--boot-directory //boot --bootloader-id=Guix --efi-directory/boot/efi'
exited with status 1; output follows:\n\n
/gnu/store/ch9q9w5zbvgq8srr6dscq6hdf03pfqb4-grub-efi-2.06/sbin/grub-install:
error:
/gnu/store/ch9q9w5zbvgq8srr6dscq6hdf03pfqb4-grub-efi-2.06/lib/grub/i386-pc/modinfo.sh
doesn't exist. Please specify --target or --directory.\n">>
================================================================================


The complete instruction of my current deployment process:

================================================================================
# How to set up Guix System on VPS

## Preparation

We need to have basic things for setting up.

1. Set up DNS record for future HTTPS support, for example, on
   <https://porkbun.com>.

2. Register at the hosting provider site, for example, on <https://vultr.com>.

3. If not using the Guix System as your desktop operating system, install Guix
   on your system as a package manager
   <https://guix.gnu.org/manual/en/html_node/Installation.html>.

## Create and deploy the first image

1. Create a new directory for this deployment and `cd` there.

2. Generate ssh keys for authentication: run `ssh-keygen`, choose to store them
   in the current directory `./`.

3. Copy this to `base_vm.scm`

``` scm
(use-modules (gnu))
(use-service-modules networking ssh)
(use-package-modules bootloaders ssh)

(operating-system
 (host-name "vm")
 (locale "en_US.utf8")
 (timezone "Etc/UTC")
 (bootloader (bootloader-configuration
              (bootloader grub-bootloader)
              (targets '("/dev/vda"))
              (terminal-outputs '(console))))
 (file-systems (cons (file-system
                      (mount-point "/")
                      (device "/dev/vda1")
                      (type "ext4"))
                     %base-file-systems))
 (services
  (append (list (service dhcp-client-service-type)
                (service openssh-service-type
                         (openssh-configuration
                          (openssh openssh-sans-x)
                          (password-authentication? #f)
                          (permit-root-login #t)
                          (authorized-keys
                           ;; Authorise our SSH key.
                           `(("root" ,(local-file "id_rsa.pub")))))))
          %base-services)))
```

4. Use a minimal config in `base_vm.scm` to generate the base image of the
   operating system, this will take a while on the very first run. Note that you
   might need to change `--image-type` to something else like `qcow2` if the
   hosting provider only supports limited options. See all available formats
   with `guix system --list-image-types`.

```
guix system image --save-provenance --image-type=iso9660 base_vm.scm
```

At the very end there will be a path to the generated image such as

```
/gnu/store/6ab54m88rfbdankmacrgpcm9gzzbmi1v-image.iso
```

5. Upload this image to the hosting provider. In Vultr it is required to put it
   online, for example, to <https://dropbox.com> as it allows 2 GB free
   space. Only then it can be added as an iso image in a separate step.

6. Choose options for the virtual server, select the uploaded image and
   instantiate the system.

7. Try logging in with ssh, for example:

```
ssh -i id_rsa root@10.10.142.48
```

8. If booted from iso on Vultr, it is necessary to partition the disk too:

``` shell
fdisk /dev/vda

# Create new GPT table
g

# Create partition for /boot, set size to 300 MB and change its type to UEFI
n
+300M
t
uefi

# Create partition for root partition for all the remaining space
n
# Press Enter many times
t
2
# This is "Linux root (x86-64)
4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709

# Check that everything is good
p

# Write partitions and quit
w
```

9. If everything is successful, quit with Ctrl+D.

10. Generate Guix signing keys with `sudo guix archive --generate-key`, now they
    are available at `/etc/guix`.

11. Save this template to `first_deploy.scm`:

```scm
(use-modules (gnu) (guix))
(use-service-modules networking ssh admin)
(use-package-modules bootloaders ssh)

(define os
  (operating-system
    (host-name "vm")
    (locale "en_US.utf8")
    (timezone "Etc/UTC")
    (bootloader (bootloader-configuration
                 (bootloader grub-efi-bootloader)
                 (targets '("/boot/efi"))))
    (file-systems (append
                   (list (file-system
                          (device "/dev/vda2")
                          (mount-point "/")
                          (type "ext4"))
                         (file-system
                          (device "/dev/vda1")
                          (mount-point "/boot/efi")
                          (type "vfat")))
                   %base-file-systems))
    (services
     (append
      (list (service openssh-service-type
                     (openssh-configuration
                      (openssh openssh-sans-x)
                      (password-authentication? #f)
                      (permit-root-login #t)
                      (authorized-keys
                       `(("root" ,(local-file "id_rsa.pub"))))))
            (service dhcp-client-service-type)
            (service unattended-upgrade-service-type))
      (modify-services %base-services
                       ;; The server must trust the Guix packages you build. If you add the signing-key
                       ;; manually it will be overridden on next `guix deploy` giving
                       ;; "error: unauthorized public key". This automatically adds the signing-key.
                       (guix-service-type config =>
                                          (guix-configuration
                                           (inherit config)
                                           (authorized-keys
                                            (append (list (local-file "/etc/guix/signing-key.pub"))
                                                    %default-authorized-guix-keys)))))))))

(list (machine
       (operating-system os)
       (environment managed-host-environment-type)
       (configuration (machine-ssh-configuration
                       (host-name "71.41.243.84")
                       (system "x86_64-linux")
                       ;; Update this after seeing an error running `guix deploy`.
                       (host-key "ssh-ed25519 AAAAC3N123456789mZwG+Y8Xk+XN123456789GNJ1RU3BkuUU")
                       (user "root")
                       ;; Use this key to communicate with the machine.
                       (identity "id_rsa")))))
```

12. Try deploying with `guix deploy first_deploy.scm`, you will see an error that
    host key doesn't match, it is expected, update it in the machine
    configuration accordingly:

```
(host-key "ssh-ed25519 AAAAC3N123456789mZwG+Y8Xk+XN123456789GNJ1RU3BkuUU")
```

13. Re-run `guix deploy first_deploy.scm` to finally install the system. Note
    that you may need to run it several times in case it fails because of errors
    such as "Throw to key `guile-ssh-error' with args `("channel-open-session"
    "Channel openingfailure: channel 67 error (2) open failed" #<input-output:
    channel (closed) 7f96971b8760> #f)'" - this is probably a transient error,
    see discussion at <https://issues.guix.gnu.org/56709>.

## References

- <https://guix.gnu.org/blog/2019/managing-servers-with-gnu-guix-a-tutorial/> -
  blog post on Guix
- <https://othacehe.org/hosting-a-blog-using-only-scheme.html> - deploying a
  blog
- <https://stumbles.id.au/getting-started-with-guix-deploy.html> - deploying on
  Digital Ocean Guix->Guix
- <https://wiki.pantherx.org/Installation-digital-ocean/> - deploying on Digital
  Debian->Guix
- <https://paste.sr.ht/~akagi/04c11305b19b1b25d0e61a88f6892057dee01b67> -
  example config
================================================================================

Best,
Dmitry.


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

* Re: guix deploy: modinfo.sh doesn't exist error
  2023-01-22 15:20 guix deploy: modinfo.sh doesn't exist error Dmitry Matveyev
@ 2023-01-22 15:45 ` Tobias Geerinckx-Rice
  2023-01-23  7:27   ` Dmitry Matveyev
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Geerinckx-Rice @ 2023-01-22 15:45 UTC (permalink / raw)
  To: public; +Cc: help-guix

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

Hi Dmitri,

Dmitry Matveyev 写道:
> /gnu/store/ch9q9w5zbvgq8srr6dscq6hdf03pfqb4-grub-efi-2.06…

Note the ‘-efi’.

> …/lib/grub/i386-pc/modinfo.sh

Note the ‘i386-pc’, i.e., non-UEFI.

This GRUB thinks it's installing in BIOS/CSM mode, but was not 
built to support this, and fails.

Is the ‘minimal ISO image’ booted in UEFI mode, that is, does 
/sys/firmware/efi exist there?

If so, is the ESP actually mounted at /boot/efi?

Kind regards,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

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

* Re: guix deploy: modinfo.sh doesn't exist error
  2023-01-22 15:45 ` Tobias Geerinckx-Rice
@ 2023-01-23  7:27   ` Dmitry Matveyev
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Matveyev @ 2023-01-23  7:27 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: help-guix

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

Hi, Tobias!

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> Dmitry Matveyev 写道:
>> /gnu/store/ch9q9w5zbvgq8srr6dscq6hdf03pfqb4-grub-efi-2.06…
>
> Note the ‘-efi’.
>
>> …/lib/grub/i386-pc/modinfo.sh
>
> Note the ‘i386-pc’, i.e., non-UEFI.
>
> This GRUB thinks it's installing in BIOS/CSM mode, but was not built to support
> this, and fails.
>
> Is the ‘minimal ISO image’ booted in UEFI mode, that is, does /sys/firmware/efi
> exist there?
>
> If so, is the ESP actually mounted at /boot/efi?

It was indeed not booted in the UEFI mode, as I gathered from Vultr's
tutorial[1] on installing Gentoo, the volumes should use MBR anyway, so
my attempt to use both UEFI for ISO image and installation failed as
well.

[1]: https://www.vultr.com/docs/installing-gentoo-linux-on-a-vultr-server/

I have changed both ISO and deploy config to using MBR, now it is a
different error, so some progress at least. Thank you!

Best,
Dmitry.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

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

end of thread, other threads:[~2023-01-23  7:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-22 15:20 guix deploy: modinfo.sh doesn't exist error Dmitry Matveyev
2023-01-22 15:45 ` Tobias Geerinckx-Rice
2023-01-23  7:27   ` Dmitry Matveyev

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.