Hello,

Thank you for the fast responce.

First of all I want to ask did you try to override Shepherd yourself?

It would be helpful to have a paragraph in the documentation how to
override the Shepherd, and if you know a proper way, please add a small
example of operating-system definition with overriden Shepherd and a
basic service like OpenSSH.

Maxime Devos <[email protected]> writes:

> On Sun, 2021-01-31 at 15:46 +0300, Oleg Pykhalov wrote:
>> Before applied patch [1] I used a hack to override shepherd package:
>> 
>>     (module-set! (resolve-module '(gnu packages admin)) 'shepherd 
>> shepherd-patched)
>> 
>> Now on Guix commit eb6b061 I cannot use the previous override, and also
>> the mentioned in [1] way overriding shepherd package doesn't work:
>> 
>>     (shepherd-root-service-type config => (shepherd-configuration
>>                                            (inherit config)
>>                                            (shepherd shepherd-patched)))
>> 
>> I got error about undefined ‘#:supplementary-groups’ which added in
>> ‘shepherd-patched’, so I assume my ‘shepherd-patched’ package not used.
>> 
>> [1] https://issues.guix.gnu.org/46043
>
> Can you post your operating system configuration definition?
> Also, were does the error about undefined "#:supplementary-groups"
> appear? When booting, when reconfiguring a ‘live’ system, when
> guix is compiling the shepherd services to .go?

While booting (as I understand in initrd).  If I run (system "/bin/sh"),
then "ps auxwww" I got only shepherd and /bin/sh in the process list.

I can publish, but it's too big [1], so if you don't mind I prepared a
virtual-machine to reproduce the issue.  Basically I don't even need to
use a patched shepherd to break the VM (result attached as a screenshot
below).

;; Generation 120	Jan 31 2021 01:15:12	(current)
;;   guix eb6b061
;;     repository URL: https://git.savannah.gnu.org/git/guix.git
;;     branch: master
;;     commit: eb6b061320418fdbd49ecb72c366e43ff7a38dbc
;;
;; env GUIX_PACKAGE_PATH=$PWD guix system build vm-image.tmpl
;; env GUIX_PACKAGE_PATH=$PWD guix system vm vm-image.tmpl

(use-modules (gnu) (guix) (srfi srfi-1))
(use-service-modules shepherd networking ssh)
(use-package-modules admin bootloaders certs nano)

(let ((base-system
       (operating-system
         (host-name "gnu")
         (timezone "Etc/UTC")
         (locale "en_US.utf8")

         (firmware '())

         ;; Below we assume /dev/vda is the VM's hard disk.
         ;; Adjust as needed.
         (bootloader (bootloader-configuration
                      (bootloader grub-bootloader)
                      (target "/dev/vda")
                      (terminal-outputs '(console))))
         (file-systems (cons (file-system
                               (mount-point "/")
                               (device "/dev/vda1")
                               (type "ext4"))
                             %base-file-systems))

         (users (cons (user-account
                       (name "guest")
                       (comment "GNU Guix Live")
                       (password "")                     ;no password
                       (group "users")
                       (supplementary-groups '("wheel" "netdev"
                                               "audio" "video")))
                      %base-user-accounts))

         ;; Our /etc/sudoers file.  Since 'guest' initially has an empty password,
         ;; allow for password-less sudo.
         (sudoers-file (plain-file "sudoers" "\
root ALL=(ALL) ALL
%wheel ALL=NOPASSWD: ALL\n"))

         (packages (append (list nano nss-certs)
                           %base-packages))

         (services
          (append (list ;; Uncomment the line below to add an SSH server.
                   ;;(service openssh-service-type)

                   ;; Use the DHCP client service rather than NetworkManager.
                   (service dhcp-client-service-type))

                  ;; Remove GDM, ModemManager, NetworkManager, and wpa-supplicant,
                  ;; which don't make sense in a VM.
                  (remove (lambda (service)
                            (let ((type (service-kind service)))
                              (or (memq type
                                        (list wpa-supplicant-service-type
                                              network-manager-service-type
                                              modem-manager-service-type))
                                  (eq? 'network-manager-applet
                                       (service-type-name type)))))
                          %base-services))))))
  (operating-system
    (inherit base-system)
    (essential-services
     (modify-services (operating-system-default-essential-services base-system)
       (shepherd-root-service-type config => (shepherd-configuration
                                              (inherit config)
                                              (shepherd shepherd)))))))
> A pitfall to take in mind: it's the ‘essential-services’ field
> you need to modify, not the ‘services’ field of ‘operating-system’.
> My original example at [1] was incorrect.  A corrected example:
>
> (operating-system
>  [...]
>  (services [don't modify this])
>  (essential-services
>   (modify-services (operating-system-default-essential-services
>                     this-operating-system)
>     (shepherd-root-service-type c =>
>                                 (shepherd-configuration
>                                  (inherit c)
>                                  (shepherd-patched))))))

Attachment: signature.asc
Description: PGP signature

Reply via email to