Improve teardown_mountpoint to recursively find all submounts and unmount them

Bug #1721279 reported by Balint Reczey on 2017-10-04
This bug affects 1 person
Affects Status Importance Assigned to Milestone
livecd-rootfs (Ubuntu)

Bug Description

[SRU Justification]

The teardown_mountpoint function was back-ported to Xenial recently but
the hard coded list of mounts to unmount makes using it problematic when
different features require different set of mounts.
This change set improves teardown_mountpoint to recursively find all submounts and unmount them, instead of working from a hard-coded list. This makes the code resilient against other submounts being added later, including downstream.

[Test case]

Autopkgtest excercises this code-path but to be on the safe side all cloud images need to be test-built, too.

[Regression potential]

This change may break building images or the host system by unmounting host's mounts.

[Other Info]

 * This is an improvement of LP: #1716992
 * The fix also removes sleep / udevadm settle calls which seem to be obsolete

Balint Reczey (rbalint) on 2017-10-04
Changed in livecd-rootfs (Ubuntu):
status: New → Fix Released
Balint Reczey (rbalint) on 2017-10-04
description: updated
Balint Reczey (rbalint) wrote :

The related fixes are merged to the packaging repository but they are also available in the full patch in LP #1721261

description: updated

Hello Balint, or anyone else affected,

Accepted livecd-rootfs 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, details of your testing will help us make a better decision.

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

Changed in livecd-rootfs (Ubuntu Xenial):
status: New → Fix Committed
tags: added: verification-needed verification-needed-xenial
Steve Langasek (vorlon) wrote :

I have run through a set of CPC image builds with this version of livecd-rootfs, and the builds succeeded. Marking v-done.

tags: added: verification-done-xenial
removed: verification-needed verification-needed-xenial
Scott Moser (smoser) wrote :

As I understand the change
what has been done is to sort /proc/self/mounts with C locale sorting and unmount.

A more correct change is to just read the file backwards.

That is what mount-image-callback does in 'umount_r'

I'm guessing the change you made was sufficient for your use case, but /proc/mounts lists mounts in order of operation, so those later are guaranteed to be "on top" of those listed earlier.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package livecd-rootfs - 2.408.21

livecd-rootfs (2.408.21) xenial; urgency=medium

  [ Balint Reczey ]
  * Use kvm kernel only on amd64.
  * Make non-x86 minimized images consistent with x86 by not explicitly
    installing the server task.
  * Clean up dangling /boot/initrd.img symlink left behind on minimized

 -- Steve Langasek <email address hidden> Fri, 20 Oct 2017 23:10:29 -0700

Changed in livecd-rootfs (Ubuntu Xenial):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers