← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad-buildd:lxd-more-loop-devices into launchpad-buildd:master

 

Colin Watson has proposed merging ~cjwatson/launchpad-buildd:lxd-more-loop-devices into launchpad-buildd:master.

Commit message:
Make more loop device nodes available in LXD containers

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1963706 in launchpad-buildd: "Ubuntu Desktop Canary ISO failing to build since builders update"
  https://bugs.launchpad.net/launchpad-buildd/+bug/1963706

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/+git/launchpad-buildd/+merge/416589

According to https://discuss.linuxcontainers.org/t/udev-inside-privileged-container/13314, the lack of namespacing for block devices means that the best we can do to make loop devices available is to just pre-create as many as we're likely to need.

(This apparently used to work differently when builders were running bionic, but we were using the old LXD .deb then so quite a lot of things have changed.)
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-buildd:lxd-more-loop-devices into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog
index 50c9cb0..8235c76 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ launchpad-buildd (210) UNRELEASED; urgency=medium
 
   * Stop building with dpkg-deb -Zgzip; we no longer need to install on
     lucid.
+  * Make more loop device nodes available in LXD containers (LP: #1963706).
 
  -- Colin Watson <cjwatson@xxxxxxxxxx>  Mon, 28 Feb 2022 11:27:20 +0000
 
diff --git a/lpbuildd/target/lxd.py b/lpbuildd/target/lxd.py
index 24e48fe..08c40c9 100644
--- a/lpbuildd/target/lxd.py
+++ b/lpbuildd/target/lxd.py
@@ -470,7 +470,7 @@ class LXD(Backend):
         # filesystems.
         self.run(
             ["mknod", "-m", "0660", "/dev/loop-control", "c", "10", "237"])
-        for minor in range(8):
+        for minor in range(256):
             self.run(
                 ["mknod", "-m", "0660", "/dev/loop%d" % minor,
                  "b", "7", str(minor)])
diff --git a/lpbuildd/target/tests/test_lxd.py b/lpbuildd/target/tests/test_lxd.py
index e94657b..07e77cb 100644
--- a/lpbuildd/target/tests/test_lxd.py
+++ b/lpbuildd/target/tests/test_lxd.py
@@ -458,7 +458,7 @@ class TestLXD(TestCase):
                 ["mknod", "-m", "0660", "/dev/loop-control",
                  "c", "10", "237"]),
             ]
-        for minor in range(8):
+        for minor in range(256):
             expected_args.append(
                 Equals(
                     lxc +