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

DigitalOcean: rm: cannot remove '/boot/efi': Device or resource busy #199

Open
willhansen opened this issue Feb 17, 2024 · 4 comments · May be fixed by #213
Open

DigitalOcean: rm: cannot remove '/boot/efi': Device or resource busy #199

willhansen opened this issue Feb 17, 2024 · 4 comments · May be fixed by #213

Comments

@willhansen
Copy link

DigitalOcean droplet.

Tried running script from command-line and through the "user data" mechanism:
image

In both cases, the install logs end with
rm: cannot remove '/boot/efi': Device or resource busy

I am still able to ssh into the ubuntu droplet.

@ironicbadger
Copy link

ironicbadger commented Feb 20, 2024

Can confirm same behavior on a fresh Ubuntu 23.10 droplet.

[edit: 22.04 appears to work fine]

@keeakita
Copy link

keeakita commented Jul 4, 2024

I ran into this as well on 24.04, the issue here seems to be this line: https://github.com/elitak/nixos-infect/blob/master/nixos-infect#L376

Since it appears both /boot and /boot/efi are both mounts, you can't just mv /boot out of the way. In my case, I was able to manually:

  • unmount /boot/efi
  • unmount /boot
  • mount the efi partition directly at /boot

Then re-run the script which carried out the rest of the process. There probably needs to be logic to detect and handle this case.

@keeakita
Copy link

keeakita commented Jul 4, 2024

Hm, no wait, the second part of that line should do the right thing, and when I manually run each of those it results in the right set of steps. Something else is up here.

@keeakita
Copy link

keeakita commented Jul 4, 2024

Ah, I see what's actually wrong here: I ran this with set -x and noticed the following output

+ rm -rf /boot.bak
+ isEFI
+ '[' -d /sys/firmware/efi ']'
+ mv -v /boot /boot.bak
mv: cannot move '/boot' to '/boot.bak': Device or resource busy

What's wrong here is that since isEFI is false, it doesn't unmount /boot/efi. These appear to systems that aren't using EFI to boot, but for some reason have a dedicated EFI partition. I have no idea why it's set up this way, but this check should probably test for the mount, not whether the system appears to be EFI.

@keeakita keeakita linked a pull request Jul 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants