From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:33568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6JNK-000849-SV for guix-patches@gnu.org; Tue, 19 Mar 2019 14:22:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6JNG-0000G2-LV for guix-patches@gnu.org; Tue, 19 Mar 2019 14:22:09 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37294) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6JNE-0000Bz-JD for guix-patches@gnu.org; Tue, 19 Mar 2019 14:22:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6JNB-0007cS-Ui for guix-patches@gnu.org; Tue, 19 Mar 2019 14:22:04 -0400 Subject: [bug#34917] [PATCH] gnu: docker: Use fewer modprobes. Resent-Message-ID: Received: from eggs.gnu.org ([209.51.188.92]:33367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6JMW-0007ba-O3 for guix-patches@gnu.org; Tue, 19 Mar 2019 14:21:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6JMT-0007Dr-Dt for guix-patches@gnu.org; Tue, 19 Mar 2019 14:21:19 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:52438) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6JMQ-0006f1-Tz for guix-patches@gnu.org; Tue, 19 Mar 2019 14:21:16 -0400 From: Danny Milosavljevic Date: Tue, 19 Mar 2019 19:20:53 +0100 Message-Id: <20190319182053.20524-1-dannym@scratchpost.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 34917@debbugs.gnu.org Fixes . Reported by Allan Adair . * gnu/packages/patches/docker-use-fewer-modprobes.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/docker.scm (docker)[source]: Use it. --- gnu/local.mk | 1 + gnu/packages/docker.scm | 5 +- .../patches/docker-use-fewer-modprobes.patch | 100 ++++++++++++++++++ 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/docker-use-fewer-modprobes.patch diff --git a/gnu/local.mk b/gnu/local.mk index 0a7e9bbc6..46bd83e50 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -723,6 +723,7 @@ dist_patch_DATA =3D \ %D%/packages/patches/doc++-segfault-fix.patch \ %D%/packages/patches/docker-engine-test-noinstall.patch \ %D%/packages/patches/docker-fix-tests.patch \ + %D%/packages/patches/docker-use-fewer-modprobes.patch \ %D%/packages/patches/dovecot-trees-support-dovecot-2.3.patch \ %D%/packages/patches/doxygen-test.patch \ %D%/packages/patches/dropbear-CVE-2018-15599.patch \ diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm index 88fc7fc6e..77605d4c0 100644 --- a/gnu/packages/docker.scm +++ b/gnu/packages/docker.scm @@ -227,6 +227,8 @@ network attachments.") (home-page "http://containerd.io/") (license license:asl2.0))) =20 +;; TODO: Patch out modprobes for ip_vs, xfrm_user, xfrm_algo, nf_conntra= ck, +;; nf_conntrack_netlink, aufs. (define-public docker (package (name "docker") @@ -242,7 +244,8 @@ network attachments.") (base32 "06yr5xwr181lalh8z1lk07nxlp7hn38aq8cyqjk617dfy4lz0ixx")) (patches (search-patches "docker-engine-test-noinstall.patch" - "docker-fix-tests.patch")))) + "docker-fix-tests.patch" + "docker-use-fewer-modprobes.patch")))) (build-system gnu-build-system) (arguments `(#:modules diff --git a/gnu/packages/patches/docker-use-fewer-modprobes.patch b/gnu/= packages/patches/docker-use-fewer-modprobes.patch new file mode 100644 index 000000000..c631400cb --- /dev/null +++ b/gnu/packages/patches/docker-use-fewer-modprobes.patch @@ -0,0 +1,100 @@ +This patch makes docker find out whether a filesystem type is supported +by trying to mount a filesystem of that type rather than invoking "modpr= obe". +--- docker-18.09.0-checkout/daemon/graphdriver/overlay/overlay.go.orig 1= 970-01-01 01:00:00.000000000 +0100 ++++ docker-18.09.0-checkout/daemon/graphdriver/overlay/overlay.go 2019-0= 3-19 09:16:03.487087490 +0100 +@@ -8,7 +8,6 @@ + "io" + "io/ioutil" + "os" +- "os/exec" + "path" + "path/filepath" + "strconv" +@@ -201,9 +200,16 @@ + } +=20 + func supportsOverlay() error { +- // We can try to modprobe overlay first before looking at +- // proc/filesystems for when overlay is supported +- exec.Command("modprobe", "overlay").Run() ++ // Access overlay filesystem so that Linux loads it (if possible). ++ mountTarget, err :=3D ioutil.TempDir("", "supportsOverlay") ++ if err !=3D nil { ++ logrus.WithField("storage-driver", "overlay2").Error("Could not creat= e temporary directory, so assuming that 'overlay' is not supported.") ++ return graphdriver.ErrNotSupported ++ } else { ++ /* The mounting will fail--after the module has been loaded.*/ ++ defer os.RemoveAll(mountTarget) ++ unix.Mount("overlay", mountTarget, "overlay", 0, "") ++ } +=20 + f, err :=3D os.Open("/proc/filesystems") + if err !=3D nil { +--- docker-18.09.0-checkout/daemon/graphdriver/overlay2/overlay.go.orig = 2019-03-18 23:42:23.728525231 +0100 ++++ docker-18.09.0-checkout/daemon/graphdriver/overlay2/overlay.go 2019-= 03-19 08:54:31.411906113 +0100 +@@ -10,7 +10,6 @@ + "io" + "io/ioutil" + "os" +- "os/exec" + "path" + "path/filepath" + "strconv" +@@ -261,9 +260,16 @@ + } +=20 + func supportsOverlay() error { +- // We can try to modprobe overlay first before looking at +- // proc/filesystems for when overlay is supported +- exec.Command("modprobe", "overlay").Run() ++ // Access overlay filesystem so that Linux loads it (if possible). ++ mountTarget, err :=3D ioutil.TempDir("", "supportsOverlay") ++ if err !=3D nil { ++ logrus.WithField("storage-driver", "overlay2").Error("Could not creat= e temporary directory, so assuming that 'overlay' is not supported.") ++ return graphdriver.ErrNotSupported ++ } else { ++ /* The mounting will fail--after the module has been loaded.*/ ++ defer os.RemoveAll(mountTarget) ++ unix.Mount("overlay", mountTarget, "overlay", 0, "") ++ } +=20 + f, err :=3D os.Open("/proc/filesystems") + if err !=3D nil { +--- docker-18.09.0-checkout/daemon/graphdriver/devmapper/deviceset.go.or= ig 2019-03-19 09:19:16.592844887 +0100 ++++ docker-18.09.0-checkout/daemon/graphdriver/devmapper/deviceset.go 20= 19-03-19 09:21:18.019361761 +0100 +@@ -540,8 +539,14 @@ + return err // error text is descriptive enough + } +=20 +- // Check if kernel supports xfs filesystem or not. +- exec.Command("modprobe", "xfs").Run() ++ mountTarget, err :=3D ioutil.TempDir("", "supportsOverlay") ++ if err !=3D nil { ++ return errors.Wrapf(err, "error checking for xfs support") ++ } else { ++ /* The mounting will fail--after the module has been lo= aded.*/ ++ defer os.RemoveAll(mountTarget) ++ unix.Mount("none", mountTarget, "xfs", 0, "") ++ } +=20 + f, err :=3D os.Open("/proc/filesystems") + if err !=3D nil { +--- docker-18.09.0-checkout/vendor/github.com/docker/libnetwork/iptables= /iptables.go.orig 2019-03-19 09:47:19.430111170 +0100 ++++ docker-18.09.0-checkout/vendor/github.com/docker/libnetwork/iptables= /iptables.go 2019-03-19 10:38:01.445136177 +0100 +@@ -72,11 +71,12 @@ + } +=20 + func probe() { +- if out, err :=3D exec.Command("modprobe", "-va", "nf_nat").CombinedOut= put(); err !=3D nil { +- logrus.Warnf("Running modprobe nf_nat failed with message: `%s`, erro= r: %v", strings.TrimSpace(string(out)), err) ++ path, err :=3D exec.LookPath("iptables") ++ if err !=3D nil { ++ return + } +- if out, err :=3D exec.Command("modprobe", "-va", "xt_conntrack").Combi= nedOutput(); err !=3D nil { +- logrus.Warnf("Running modprobe xt_conntrack failed with message: `%s`= , error: %v", strings.TrimSpace(string(out)), err) ++ if out, err :=3D exec.Command(path, "--wait", "-t", "nat", "-L", "-n")= .CombinedOutput(); err !=3D nil { ++ logrus.Warnf("Running iptables --wait -t nat -L -n failed with messag= e: `%s`, error: %v", strings.TrimSpace(string(out)), err) + } + } +=20