guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

respawn? #t doesn't do anything?


From: Nathan Dehnel
Subject: respawn? #t doesn't do anything?
Date: Sun, 6 Mar 2022 18:18:21 -0600

Guix's wireguard service is flawed because it will try to start before
DNS is ready, causing it to fail. I tried to fix this by adding
respawn? #t to the service to make it restart until it succeeds.

https://guix.gnu.org/manual/en/html_node/Shepherd-Services.html#Shepherd-Services

;;definition
(define (wg-quick-shepherd-service config)
  (match-record config <wg-quick-configuration>
    (wg-quick interface)
    (let ((wg-quick (file-append wg-quick "/bin/wg-quick"))
          (config (wg-quick-configuration-file config)))
      (list (shepherd-service
             (requirement '(networking))
             (provision (list
                         (symbol-append 'wg-quick-
                                        (string->symbol interface))))
             (start #~(lambda _
                       (invoke #$wg-quick "up" #$config)))
             (stop #~(lambda _
                       (invoke #$wg-quick "down" #$config)))
             (documentation "Run the Wireguard VPN tunnel")
             (respawn? #t))))))

;;config
            (service wg-quick-service-type
             (wg-quick-configuration
              (interface "test")
              (addresses '("10.9.0.3/24"))
              (private-key "")
              ;;(dns '("10.9.0.1"))
              (peers
               (list
                (wg-quick-peer
                 (name "")
                 (endpoint "")
                 (public-key "")
                 (allowed-ips '("10.0.0.0/24")))
                ))))

When booted, the service fails, and does not respawn, even though it
says it is configured to respawn. Why is it not respawning?

[#] ip link add test type wireguard
[#] wg setconf test /dev/fd/63
Name or service not known: `<hostname>:51820'
Configuration parsing error
[#] ip link delete dev test
failed to start service 'wg-quick-test'


This is the GNU system.  Welcome.
guixtest login: root
This is the GNU operating system, welcome!

root@guixtest ~# herd status wg-quick-test
Status of wg-quick-test:
  It is stopped.
  It is enabled.
  Provides (wg-quick-test).
  Requires (networking).
  Conflicts with ().
  Will be respawned.
root@guixtest ~# herd status
Started:
 + console-font-tty1
 + console-font-tty2
 + console-font-tty3
 + console-font-tty4
 + console-font-tty5
 + console-font-tty6
 + file-system-/dev/pts
 + file-system-/dev/shm
 + file-system-/sys/firmware/efi/efivars
 + file-system-/sys/kernel/debug
 + file-systems
 + guix-daemon
 + loopback
 + mcron
 + networking
 + nscd
 + ntpd
 + root
 + root-file-system
 + ssh-daemon
 + syslogd
 + term-console
 + term-tty1
 + term-tty2
 + term-tty3
 + term-tty4
 + term-tty5
 + term-tty6
 + udev
 + urandom-seed
 + user-file-systems
 + user-processes
 + virtual-terminal
Stopped:
 - wg-quick-test
One-shot:
 * host-name
 * sysctl
 * user-homes



reply via email to

[Prev in Thread] Current Thread [Next in Thread]