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

Bug #1807750 reported by Robert C Jennings
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-image (Ubuntu)
Invalid
Undecided
Unassigned
Xenial
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

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).

Revision history for this message
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/__main__.py", line 341, in main
    list(state_machine)
  File "/usr/lib/python3/dist-packages/ubuntu_image/state.py", line 82, in __next__
    step()
  File "/usr/lib/python3/dist-packages/ubuntu_image/common_builder.py", line 337, in populate_filesystems
    self._populate_one_volume(name, volume)
  File "/usr/lib/python3/dist-packages/ubuntu_image/common_builder.py", line 290, in _populate_one_volume
    preserve_ownership=True)
  File "/usr/lib/python3/dist-packages/ubuntu_image/helpers.py", line 233, in mkfs_ext4
    with mount(img_file) as mountpoint:
  File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/usr/lib/python3/dist-packages/ubuntu_image/helpers.py", line 207, in mount
    run('sudo mount -oloop {} {}'.format(img, mountpoint))
  File "/usr/lib/python3/dist-packages/ubuntu_image/helpers.py", line 115, in run
    **args)
  File "/usr/lib/python3.5/subprocess.py", line 693, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", 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/build_livefs.py", line 161, in run
    self.build()
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_livefs.py", line 152, in build
    self.run_build_command(["lb", "build"], env=base_lb_env)
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_livefs.py", line 79, in run_build_command
    return self.backend.run(args, cwd="/build", **kwargs)
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/lxd.py", line 490, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", 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...

Read more...

Changed in ubuntu-image (Ubuntu):
status: New → Invalid
Changed in ubuntu-image (Ubuntu Xenial):
status: New → Confirmed
Revision history for this message
Ł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
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Robert, or anyone else affected,

Accepted ubuntu-image into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/ubuntu-image/1.6+16.04ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed 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 https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . 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
Revision history for this message
Ł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
Revision history for this message
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
Revision history for this message
Brian Murray (brian-murray) wrote : Update 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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.