unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: andreoss@SDF.ORG, 38432@debbugs.gnu.org
Subject: bug#38432: dockerd is not started automatically
Date: Mon, 01 Jun 2020 20:59:50 -0400	[thread overview]
Message-ID: <87h7vunuyh.fsf@gmail.com> (raw)
In-Reply-To: <20200601142454.5a45c75c@scratchpost.org> (Danny Milosavljevic's message of "Mon, 1 Jun 2020 14:24:54 +0200")

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

Hi Danny!

Danny Milosavljevic <dannym@scratchpost.org> writes:

> Hi Maxim,
>
> On Sun, 31 May 2020 23:27:30 -0400
> Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>
>> time="2020-05-31T22:28:15.885343166-04:00" level=warning msg="failed
>> to load plugin io.containerd.snapshotter.v1.aufs" error="modprobe
>> aufs failed: "modprobe: FATAL: Module aufs not found in directory
>> /lib/modules/5.4.43-gnu\n": exit status 1"
>
> We don't have aufs, but it's not mandatory anyway.
>
>> The only new lines to appear in docker.log following my last reboot are:
>> 
>> --8<---------------cut here---------------start------------->8---
>> time="2020-05-31T22:28:13.579626539-04:00" level=info msg="Starting up"
>> failed to start containerd: exec: "containerd": executable file not found in $PATH
>> --8<---------------cut here---------------end--------------->8---
>> 
>> So, it seems the failure is related to kernel modules not being found
>> where they are looked for?
>
> I don't think so this time, at least according to these logs.
>
> Could it be that containerd takes too long to start up or something?  And then it
> tries to start it on its own?
>
> To find out, try adding sleep to gnu/services/docker.scm docker-shepherd-service
> before make-forkexec-constructor, to make it read
>
>  #~(begin
>      (sleep 2)
>      (make-forkexec-constructor ....

It looks like this! Which is weird, because containerd doesn't take much
time to start, even when networking is not yet functional (I suspected
something like this at first).

I wonder what we can do here... looks like we need to poll containerd to
know when it's ready in the start procedure of dockerd (unless I'm
missing something fancier that Shepherd would allow doing).  Else we
could let dockerd spawn its own containerd daemon, which it can do if we
tell it where it is.

Thoughts?

I've made the following changes while troubleshooting this.  It only
printed a couple more lines, but I guess it's nice to have:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-services-docker-Add-a-debug-parameter.patch --]
[-- Type: text/x-patch, Size: 3666 bytes --]

From 80f3812e36cfb738b494343c5a6c20cb65588ad1 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 1 Jun 2020 20:54:40 -0400
Subject: [PATCH] gnu: services: docker: Add a debug? parameter.

* gnu/services/docker.scm (docker-configuration): Add a debug? field.
(containerd-shepherd-service): Pass the "--log-level=debug" argument when
DEBUG? is true.
(docker-shepherd-service): Pass the "--debug" and "--log-level=debug"
arguments when DEBUG? is true.
---
 doc/guix.texi           |  9 +++++++++
 gnu/services/docker.scm | 19 +++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index beeda34ea2..de958c9cf1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -26287,6 +26287,15 @@ The Docker package to use.
 @item @code{containerd} (default: @var{containerd})
 The Containerd package to use.
 
+@item @code{proxy} (default @var{docker-libnetwork-cmd-proxy})
+The Docker user-land networking proxy package to use.
+
+@item @code{enable-proxy?} (default @code{#f})
+Enable or disable the use of the Docker user-land networking proxy.
+
+@item @code{debug?} (default @code{#f})
+Enable or disable debug output.
+
 @end table
 @end deftp
 
diff --git a/gnu/services/docker.scm b/gnu/services/docker.scm
index d6dc792821..ccdb67ed73 100644
--- a/gnu/services/docker.scm
+++ b/gnu/services/docker.scm
@@ -52,7 +52,10 @@
 loop-back communications.")
   (enable-proxy?
    (boolean #t)
-   "Enable or disable the user-land proxy (enabled by default)."))
+   "Enable or disable the user-land proxy (enabled by default).")
+  (debug?
+   (boolean #f)
+   "Enable or disable debug output."))
 
 (define %docker-accounts
   (list (user-group (name "docker") (system? #t))))
@@ -71,19 +74,24 @@ loop-back communications.")
         (mkdir-p #$state-dir))))
 
 (define (containerd-shepherd-service config)
-  (let* ((package (docker-configuration-containerd config)))
+  (let* ((package (docker-configuration-containerd config))
+         (debug? (docker-configuration-debug? config)))
     (shepherd-service
            (documentation "containerd daemon.")
            (provision '(containerd))
            (start #~(make-forkexec-constructor
-                     (list (string-append #$package "/bin/containerd"))
+                     (list (string-append #$package "/bin/containerd")
+                           #$@(if debug?
+                                  '("--log-level=debug")
+                                  '()))
                      #:log-file "/var/log/containerd.log"))
            (stop #~(make-kill-destructor)))))
 
 (define (docker-shepherd-service config)
   (let* ((docker (docker-configuration-docker config))
          (enable-proxy? (docker-configuration-enable-proxy? config))
-         (proxy (docker-configuration-proxy config)))
+         (proxy (docker-configuration-proxy config))
+         (debug? (docker-configuration-debug? config)))
     (shepherd-service
            (documentation "Docker daemon.")
            (provision '(dockerd))
@@ -101,6 +109,9 @@ loop-back communications.")
            (start #~(make-forkexec-constructor
                      (list (string-append #$docker "/bin/dockerd")
                            "-p" "/var/run/docker.pid"
+                           #$@(if debug?
+                                  '("--debug" "--log-level=debug")
+                                  '())
                            (if #$enable-proxy? "--userland-proxy" "")
                            "--userland-proxy-path" (string-append #$proxy
                                                                   "/bin/proxy"))
-- 
2.26.2


[-- Attachment #3: Type: text/plain, Size: 7 bytes --]


Maxim

  reply	other threads:[~2020-06-02  1:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-29 22:06 bug#38432: dockerd is not started automatically andreoss
2020-05-28 13:24 ` Maxim Cournoyer
2020-05-28 13:42   ` Danny Milosavljevic
2020-06-01  3:27     ` Maxim Cournoyer
2020-06-01 12:24       ` Danny Milosavljevic
2020-06-02  0:59         ` Maxim Cournoyer [this message]
2020-06-02 12:11         ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7vunuyh.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=38432@debbugs.gnu.org \
    --cc=andreoss@SDF.ORG \
    --cc=dannym@scratchpost.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).