Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apt: workaround umount failure #1449

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions subiquity/server/apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ async def cleanup(self):
for m in reversed(self._mounts):
await self.unmount(m, remove=False)
for d in self._tdirs:
shutil.rmtree(d)
try:
shutil.rmtree(d)
except OSError as ose:
log.warning(f'failed to rmtree {d}: {ose}')

async def deconfigure(self, context, target: str) -> None:
target_mnt = Mountpoint(mountpoint=target)
Expand All @@ -272,7 +275,11 @@ async def _restore_dir(dir):
await _restore_dir('var/lib/apt/lists')

await self.cleanup()
os.rmdir(target_mnt.p('cdrom'))
try:
d = target_mnt.p('cdrom')
os.rmdir(d)
except OSError as ose:
log.warning(f'failed to rmdir {d}: {ose}')

async def setup_target(self, context, target: str):
# Call this after the rootfs has been extracted to the real target
Expand Down