pmb.chroot.shutdown: losetup with auto_init=False (MR 1912)
Do not go through the pmb.chroot.init() code path when running pmb.install.losetup.umount() inside pmb.chroot.shutdown(). This is not necessary, as pmb.install.losetup.umount() only gets called if the chroot is already initialized and /dev/loop-control is mounted inside the chroot. Not going through this code path is important for the upcoming workdir migration patch. Without this fix, it will fail with the following if running "pmbootstrap install" before the work migration: ERROR: Could not figure out on which release channel the 'native' chroot is
This commit is contained in:
parent
5a256f66de
commit
d3dc3b2c98
|
@ -65,7 +65,7 @@ def shutdown(args, only_install_related=False):
|
||||||
pattern = chroot + "/home/pmos/rootfs/*.img"
|
pattern = chroot + "/home/pmos/rootfs/*.img"
|
||||||
for path_outside in glob.glob(pattern):
|
for path_outside in glob.glob(pattern):
|
||||||
path = path_outside[len(chroot):]
|
path = path_outside[len(chroot):]
|
||||||
pmb.install.losetup.umount(args, path)
|
pmb.install.losetup.umount(args, path, auto_init=False)
|
||||||
|
|
||||||
# Umount device rootfs chroot
|
# Umount device rootfs chroot
|
||||||
chroot_rootfs = args.work + "/chroot_rootfs_" + args.device
|
chroot_rootfs = args.work + "/chroot_rootfs_" + args.device
|
||||||
|
|
|
@ -50,14 +50,14 @@ def mount(args, img_path):
|
||||||
raise RuntimeError("Failed to mount loop device: " + img_path)
|
raise RuntimeError("Failed to mount loop device: " + img_path)
|
||||||
|
|
||||||
|
|
||||||
def device_by_back_file(args, back_file):
|
def device_by_back_file(args, back_file, auto_init=True):
|
||||||
"""
|
"""
|
||||||
Get the /dev/loopX device, that points to a specific image file.
|
Get the /dev/loopX device, that points to a specific image file.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Get list from losetup
|
# Get list from losetup
|
||||||
losetup_output = pmb.chroot.root(args, ["losetup", "--json",
|
losetup_output = pmb.chroot.root(args, ["losetup", "--json", "--list"],
|
||||||
"--list"], output_return=True)
|
output_return=True, auto_init=auto_init)
|
||||||
if not losetup_output:
|
if not losetup_output:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -69,12 +69,12 @@ def device_by_back_file(args, back_file):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def umount(args, img_path):
|
def umount(args, img_path, auto_init=True):
|
||||||
"""
|
"""
|
||||||
:param img_path: Path to the img file inside native chroot.
|
:param img_path: Path to the img file inside native chroot.
|
||||||
"""
|
"""
|
||||||
device = device_by_back_file(args, img_path)
|
device = device_by_back_file(args, img_path, auto_init)
|
||||||
if not device:
|
if not device:
|
||||||
return
|
return
|
||||||
logging.debug("(native) umount " + device)
|
logging.debug("(native) umount " + device)
|
||||||
pmb.chroot.root(args, ["losetup", "-d", device])
|
pmb.chroot.root(args, ["losetup", "-d", device], auto_init=auto_init)
|
||||||
|
|
Loading…
Reference in New Issue