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

Error: Failed removing cache directory #716

Closed
kamzar1 opened this issue Apr 26, 2023 · 1 comment · Fixed by #720
Closed

Error: Failed removing cache directory #716

kamzar1 opened this issue Apr 26, 2023 · 1 comment · Fixed by #720
Labels
Bug Confirmed to be a bug

Comments

@kamzar1
Copy link

kamzar1 commented Apr 26, 2023

distrobuilder git-2c88fed 1582 latest/edge stgraber classic

I used to mount the cachedir as tempfs to save ssd writes. It has worked previously:

sudo mount -t tmpfs -o rw,size=12G,uid=0,gid=0,mode=1755 /var/cache/distro
distrobuilder --cache-dir=/var/cache/distro build-lxd ...

But recently I got this error message:
distrobuilder Error: Failed removing cache directory: unlinkat /var/cache/distro: device or resource busy

@monstermunchkin monstermunchkin added the Bug Confirmed to be a bug label Jun 13, 2023
@monstermunchkin
Copy link
Member

Distrobuilder tries removing the cache directory before it does anything, just to ensure it starts with a clean slate. In this case the directory is a mountpoint which cannot be removed.

What we could do is try removing only the directory content, not the directory itself. If this also fails, we could issue a warning instead of an error. The user would then be responsible for cleaning up the cache directory.

monstermunchkin added a commit to monstermunchkin/distrobuilder that referenced this issue Jun 13, 2023
This fixes an issue where the cache directory cannot be removed if it's
a mountpoint.

This commit tries removing the cache directory but doesn't fail if
unsuccessful. Instead it tries removing the content of the cache
directory. Should this fail as well, distrobuilder will issue a warning.
The user is then responsible for cleaning up the cache directory.

Fixes lxc#716

Signed-off-by: Thomas Hipp <thomas.hipp@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed to be a bug
Development

Successfully merging a pull request may close this issue.

2 participants