Imagine you accidentally use mount --bind
to hide /bin
so that umount
(and most other binaries) is not visible any more.
How would you get out of this situation?
Is there any way except a hard reboot?
Imagine you accidentally use mount --bind
to hide /bin
so that umount
(and most other binaries) is not visible any more.
How would you get out of this situation?
Is there any way except a hard reboot?
Fortunately
/bin
is actually rather small, it's only very basic utilities and shells. As long as you have a root shell still open, you should be able to use the tools in /usr/bin to download the package that would have had mount in your distribution (egapt-get install -d mount
on Debian), then extract the file from the downloaded package manually (dpkg-deb -x mount.whatever.deb /some/temp/folder
) and then use./umount
in that folder.Hah, a reboot may not even work, as that may need tools from
/bin
too :)I'm guessing these will not work:
I'd simply reboot. There's nothing wrong with that :)
If you don't want to reboot, I would try to scp/wget a copy of /bin/umount from another machine with the same os and run that.
Actually, you could probably go back to those fine backups you are keeping and restoring the appropriate areas you are missing if you do not want to reboot. (personally, I'd reboot to keep things clean).
if you root filesystem supports snapshot, you can take a snapshot, and copy the /bin files from the snapshot which should be copied to a partition (forgot you cannot mount it).
otherwise, if you have a spare partition, you can use dd to copy the root partition there and get /bin files back that way. likely with an external usb drive.
last, if you network works, you can just copy the command back from a similar system.