help-guix
[Top][All Lists]
Advanced

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

luks home causes syncthing service to start too early?


From: Remco van 't Veer
Subject: luks home causes syncthing service to start too early?
Date: Mon, 17 Jul 2023 10:54:16 +0200
User-agent: mu4e 1.10.5; emacs 28.2

Hi,

In my current setup syncthing fails to start on boot.  Here's /var/log/messages:

  Jul 17 09:51:52 localhost vmunix: [    1.605917] shepherd[1]: Starting 
service syncthing-me...
  Jul 17 09:51:52 localhost vmunix: [    1.606790] shepherd[1]: Service 
syncthing-me has been started.
  Jul 17 09:51:52 localhost vmunix: [    1.611919] shepherd[1]: Service 
syncthing-me started.
  Jul 17 09:51:52 localhost vmunix: [    1.613080] shepherd[1]: Service 
syncthing-me running with value 356.
  Jul 17 09:51:52 localhost vmunix: [    1.654826] shepherd[1]:
  Jul 17 09:51:52 localhost vmunix: [    1.654903] [
  Jul 17 09:51:52 localhost vmunix: [    1.654963] syncthing
  Jul 17 09:51:52 localhost vmunix: [    1.655011] ]
  Jul 17 09:51:52 localhost vmunix: [    1.655069] WARNING: Failure on home 
directory: mkdir /home/me: permission denied
  Jul 17 09:51:52 localhost vmunix: [    1.655741] shepherd[1]: Service 
syncthing-me (PID 356) exited with 1.
  Jul 17 09:51:52 localhost vmunix: [    1.655973] shepherd[1]: Service 
syncthing-me has been disabled.

It's pretty obvious why this fails because the mounting of the home
happens later:

  Jul 17 09:51:52 localhost vmunix: [    4.207897] shepherd[1]: Starting 
service device-mapping-home...
  Jul 17 09:51:52 localhost vmunix: [   12.502555] shepherd[1]: Service 
device-mapping-home has been started.
  Jul 17 09:51:52 localhost vmunix: [   12.503557] shepherd[1]: Service 
device-mapping-home started.
  Jul 17 09:51:52 localhost vmunix: [   12.514975] shepherd[1]: Service 
device-mapping-home running with value #t.
  Jul 17 09:51:52 localhost vmunix: [   12.538402] shepherd[1]: Starting 
service file-system-/home...
  Jul 17 09:51:52 localhost vmunix: [   12.573507] shepherd[1]: Service 
file-system-/home has been started.
  Jul 17 09:51:52 localhost vmunix: [   12.573775] shepherd[1]: Service 
file-system-/home started.
  Jul 17 09:51:52 localhost vmunix: [   12.573935] shepherd[1]: Service 
file-system-/home running with value #t.
  Jul 17 09:51:52 localhost vmunix: [   12.696235] shepherd[1]: Starting 
service user-homes...
  Jul 17 09:51:52 localhost vmunix: [   12.698117] shepherd[1]: Service 
user-homes has been started.
  Jul 17 09:51:52 localhost vmunix: [   12.698406] shepherd[1]: Service 
user-homes started.
  Jul 17 09:51:52 localhost vmunix: [   12.698756] shepherd[1]: Service 
user-homes running with value #t.

I have my home directory on a separate encrypted partition as follows:

  (mapped-devices
   (list (mapped-device
          (source (uuid ...))
          (target "home")
          (type luks-device-mapping))))

  (file-systems (cons* (file-system
                        (mount-point "/boot/eff") ..)
                       (file-system
                        (mount-point "/")
                        (device (uuid ...))
                        (type "ext4"))
                       (file-system
                        (mount-point "/home")
                        (device "/dev/mapper/home")
                        (type "ext4")
                        (dependencies mapped-devices))
                       %base-file-systems))

And syncthing wedged into a big list of services:

  (define my-base-desktop-services
    (cons* ...

           (service syncthing-service-type
                    (syncthing-configuration (user "me"))
           ...

           (modify-services
               (remove (lambda (service)
                         (eq? (service-kind service) gdm-service-type))
                       %desktop-services)
               ...

Looking at the syncthing-shepherd-service definition[1]:

  (define syncthing-shepherd-service
    (match-lambda
      (($ <syncthing-configuration> syncthing arguments logflags user group 
home)
       (list
        (shepherd-service
         (provision (list (string->symbol (string-append "syncthing-" user))))
         (documentation "Run syncthing.")
         (requirement '(loopback))
         (start #~(make-forkexec-constructor ...

this shepherd-service only requires "loopback".  How do make it require
"user-homes" too without copy-pasting it and defining my own syncthing
service?

Also why doesn't it at least require "file-systems" already (which is
available just before "user-homes")?  It seems obvious to me that
syncthing should not start before all file systems are up and running.

The workaround is to add (needed-for-boot? #t) to the (file-system ..)
definition for my homes partition but then I have to type LUKS password
twice which was a nice so about this setup..

Cheers,
Remco


[1] 
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/syncthing.scm#n60



reply via email to

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