all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Offlineimap is not able to run as a shepherd service
@ 2023-12-07  9:15 Lars Rustand
  2023-12-08 22:08 ` Lars Rustand
  0 siblings, 1 reply; 2+ messages in thread
From: Lars Rustand @ 2023-12-07  9:15 UTC (permalink / raw)
  To: help-guix


Hello, I'm trying to run offlineimap as a shepherd service, but it fails
in a weird way. I'm able to run offlineimap just fine when I start from
the commandline, but inside the service it fails with this error:

-8<---------------cut here---------------start------------->8---
2023-12-07 10:31:13 Traceback:
2023-12-07 10:31:13   File "/gnu/store/g2231vkzbnncyj72085n1ylkh8hq16lm-offlineimap-8.0.0/lib/python3.10/site-packages/offlineimap/accounts.py", line 298, in syncrunner
2023-12-07 10:31:13     self.__sync()
2023-12-07 10:31:13   File "/gnu/store/g2231vkzbnncyj72085n1ylkh8hq16lm-offlineimap-8.0.0/lib/python3.10/site-packages/offlineimap/accounts.py", line 374, in __sync
2023-12-07 10:31:13     remoterepos.getfolders()
2023-12-07 10:31:13   File "/gnu/store/g2231vkzbnncyj72085n1ylkh8hq16lm-offlineimap-8.0.0/lib/python3.10/site-packages/offlineimap/repository/IMAP.py", line 681, in getfolders
2023-12-07 10:31:13     imapobj = self.imapserver.acquireconnection()
2023-12-07 10:31:13   File "/gnu/store/g2231vkzbnncyj72085n1ylkh8hq16lm-offlineimap-8.0.0/lib/python3.10/site-packages/offlineimap/imapserver.py", line 683, in acquireconnection
2023-12-07 10:31:13     e.args[0][:35] == 'IMAP4 protocol error: socket error:':
2023-12-07 10:31:13
-8<---------------cut here---------------end--------------->8---

I am using the exact same commandline arguments both in the shepherd
service and when running offlineimap manually, so Shepherd must be doing
something weird that causes offlineimap to fail.

Here is my service definition:

-8<---------------cut here---------------start------------->8---
(define-module (lrustand services offlineimap)
  #:use-module (gnu)
  #:use-module (gnu services)
  #:use-module (gnu packages mail)
  #:use-module (gnu services shepherd)
  #:use-module (gnu services configuration)
  #:use-module (guix gexp)
  #:use-module (guix records)
  #:use-module (ice-9 curried-definitions)
  #:use-module (gnu home services)
  ;; For the 'home-shepherd-service-type' mapping.
  #:use-module (gnu home services shepherd)
  #:export (offlineimap-configuration
            offlineimap-configuration?

            offlineimap-configuration-log-file
            offlineimap-configuration-pid-file

            offlineimap-shepherd-service
            offlineimap-service-type
            home-offlineimap-service-type))

(define-configuration/no-serialization offlineimap-configuration
  (pid-file
   (string "/var/run/offlineimap.pid")
   "Where to store the PID file.")
  (config-file
   (string "/home/lars/.config/offlineimap/config")
   "Configuration file to use.")
  (log-file
   (string "/home/lars/offlineimap.log")
   "File where ‘offlineimap’ writes its log to.")
  (extra-options
   (list-of-strings '())
   "This option provides an “escape hatch” for the user to provide
arbitrary command-line arguments to ‘offlineimap’ as a list of strings.")
  (home-service?
   (boolean for-home?)
   ""))

(define offlineimap-shepherd-service
  (match-record-lambda <offlineimap-configuration>
    (pid-file config-file log-file extra-options home-service?)
    (list (shepherd-service
           (provision '(offlineimap))
           (documentation "")
           (requirement (if home-service? '() '(user-processes)))
           (start #~(make-forkexec-constructor
                      (list (string-append #$offlineimap
                                           "/bin/offlineimap")
                             #$@extra-options
                             "-c" #$config-file
                             "-l" #$log-file)
                     #:log-file #$log-file
                     #:pid-file #$pid-file))
           (stop #~(make-kill-destructor))
           (one-shot? #f)
           (respawn? #t)))))

(define offlineimap-service-type
  (service-type
   (name 'offlineimap)
   (extensions
    (list (service-extension shepherd-root-service-type
                             offlineimap-shepherd-service)))
   (default-value (offlineimap-configuration))
   (description
    "Synchronize remote IMAP mail with local Maildir.")))

(define home-offlineimap-service-type
  (service-type
   (inherit (system->home-service-type offlineimap-service-type))
   (default-value (for-home (offlineimap-configuration)))))
-8<---------------cut here---------------end--------------->8---


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

* Re: Offlineimap is not able to run as a shepherd service
  2023-12-07  9:15 Offlineimap is not able to run as a shepherd service Lars Rustand
@ 2023-12-08 22:08 ` Lars Rustand
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Rustand @ 2023-12-08 22:08 UTC (permalink / raw)
  To: help-guix


I tried making a shepherd service for a different mail service
also. This other one also runs fine manually but fails with some
networking related error when run as a shepherd service. Apparently
there is something more that needs to be done in order for a shepherd
service to succesfully use networking.

I can't find this documented anywhere in the manual, so I've checked the
source code to find other shepherd services to look at, but so far I
can't find any answers there either.

I must be missing something obvious here, since other shepherd services
are able to use networking just fine.


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

end of thread, other threads:[~2023-12-08 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-07  9:15 Offlineimap is not able to run as a shepherd service Lars Rustand
2023-12-08 22:08 ` Lars Rustand

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.