Use of 'sudo' without dependency on 'sudo' package

Bug #1807750 reported by Robert C Jennings on 2018-12-10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-image (Ubuntu)

Bug Description


Recently we have backported the ubuntu-image ubuntu-core build support in livecd-rootfs in xenial. Thanks to this we are now able to build ubuntu-core 16 images using SUITE=xenial.
Sadly, in comparison to other series, the xenial ubuntu-image has additional logic used when preparing ext4 partitions due to an old mkfs.ext4 which is missing all the needed functionality. This additional logic (or hack) requires running a `sudo cp` to copy the rootfs contents onto the partition. The launchpad builders do not have 'sudo' installed by default. When attempting to verify bug #1799736 it was found that the build would fail when 'sudo' could not be found. The python3-ubuntu-image package should depend on 'sudo'

[Test Case]

The best test case would be to see if ubuntu-core SUITE=xenial (core16) images still fail to build due to sudo not being available after the package lands in xenial-proposed.

[Regression Potential]

The change is only a dependency addition so it should not have any real consequences. All systems so far had sudo by default, so no users will see any side-effects (and those that do, they couldn't use ubuntu-image anyway).

Related branches

Robert C Jennings (rcj) wrote :
Download full text (3.4 KiB)

I was verifying bug #1799736 on amd64 with livecd-rootfs 2.408.41 from -proposed following the test case in that bugs description which performs a build of ubuntu-core16 snap. My testing diverged from the test plan in that I was driving livecd-rootfs with ubuntu-old-fashioned[1] which builds with launchpad-buildd tools in a lxd container to replicate the buildd environment. In that environment the build fails due to the lack of 'sudo':

[2018-12-10 18:06:08] lb_build
P: Executing auto/build script.
Fetching core
Fetching pc-kernel
Fetching pc
Warning: for backwards compatibility, `ubuntu-image` falls back to `ubuntu-image snap` if no subcommand is given
-o/--output is deprecated; use -O/--output-dir instead
Crash in state machine
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/ubuntu_image/", line 341, in main
  File "/usr/lib/python3/dist-packages/ubuntu_image/", line 82, in __next__
  File "/usr/lib/python3/dist-packages/ubuntu_image/", line 337, in populate_filesystems
    self._populate_one_volume(name, volume)
  File "/usr/lib/python3/dist-packages/ubuntu_image/", line 290, in _populate_one_volume
  File "/usr/lib/python3/dist-packages/ubuntu_image/", line 233, in mkfs_ext4
    with mount(img_file) as mountpoint:
  File "/usr/lib/python3.5/", line 59, in __enter__
    return next(self.gen)
  File "/usr/lib/python3/dist-packages/ubuntu_image/", line 207, in mount
    run('sudo mount -oloop {} {}'.format(img, mountpoint))
  File "/usr/lib/python3/dist-packages/ubuntu_image/", line 115, in run
  File "/usr/lib/python3.5/", line 693, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.5/", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'sudo'
Build failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/", line 161, in run
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/", line 152, in build
    self.run_build_command(["lb", "build"], env=base_lb_env)
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/", line 79, in run_build_command
    return, cwd="/build", **kwargs)
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/", line 490, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python2.7/", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['lxc', 'exec', 'lp-xenial-amd64', '--env', 'PROJECT=ubuntu-core', '--env', 'ARCH=amd64', '--', '/bin/sh', '-c', 'cd /build && linux64 lb build']' returned non-zero exit status 1

The rootfs used by the builders does not have 'sudo' installed; python3-ubuntu-image should have a package dependency on 'sudo' based on this testing. However, I d...


Changed in ubuntu-image (Ubuntu):
status: New → Invalid
Changed in ubuntu-image (Ubuntu Xenial):
status: New → Confirmed
Łukasz Zemczak (sil2100) wrote :

Thanks Rob! I have incorporated your fix in our github branch and prepared the upload. This should land in xenial-proposed soon (I hope).

description: updated

Hello Robert, or anyone else affected,

Accepted ubuntu-image into xenial-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in ubuntu-image (Ubuntu Xenial):
status: Confirmed → Fix Committed
tags: added: verification-needed verification-needed-xenial
Łukasz Zemczak (sil2100) wrote :

Confirmed that python3-ubuntu-image 1.6+16.04ubuntu1 now ships with the sudo dependency:

Package: python3-ubuntu-image
Architecture: all
Version: 1.6+16.04ubuntu1
Depends: ca-certificates, dosfstools, gdisk, grub-common, livecd-rootfs (>= 2.408.24), fakeroot, mtools (>= 4.0.18-2ubuntu0), python3-attr, python3-parted, python3-pkg-resources, python3-setuptools, python3-voluptuous, python3-yaml, snapd, sudo, python3:any (>= 3.3.2-2~)

tags: added: verification-done verification-done-xenial
removed: verification-needed verification-needed-xenial
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-image - 1.6+16.04ubuntu1

ubuntu-image (1.6+16.04ubuntu1) xenial; urgency=medium

  * Do not copy-over /etc/cloud to the rootfs if it's empty. This can cause
    base snaps that define the writable-path as 'persistent' and 'transition'
    to not be able to provide default configuration. (LP:1808554)
  * Fix --with-proposed handling to properly pass PROPOSED to live-build.
  * SRU tracking number LP: #1808564

ubuntu-image (1.5+16.04ubuntu2) xenial; urgency=medium

  * debian/control: add sudo to the list of dependencies as we need it for
    the sudo cp workaround we have in place for xenial's outdated mkfs.ext4
    (LP: #1807750).

 -- Łukasz 'sil2100' Zemczak <email address hidden> Fri, 14 Dec 2018 17:08:09 +0100

Changed in ubuntu-image (Ubuntu Xenial):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for ubuntu-image has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers