Now I can't remount anything and get access back. How can I fix it?
sudo
returns
sudo: effective uid is not 0, is /usr/bin/sudo on a filesystem with the 'nosuid' option set or an NFS filesystem without root privileges?
mount
returns
mount: failed to read mtab: No such file or directory
If I try to open anything new I get the message
Failed to execute child Failed to open PTY: No such file or directory
Just reboot the machine. It is just temporarily and the permanent configuration in
/etc/fstab
is restored upon reboot.Whenever you are on a situation like this on Linux, if you want to do a safe reboot, there is the "Magic SysRq key" + REISUB:
https://en.wikipedia.org/wiki/Magic_SysRq_key
You need to press:
Alt + SysRq
and while keeping that pressed type:r
: The kernel takesr
aw control of the keyboard (from X or Wayland)e
: Te
rminate all running programsi
: Ki
ll all programs left (except init)s
:S
ync (flush data to disk)u
:u
nmount (remounts all filesystems readonly)b
: reb
ootKeep a few seconds between each typed letter for each of the tasks to complete.
This is a clean way of directly telling the linux kernel to restart.
Since you had unmounted all the file systems, the sync and unmount do not make much sense to me, however it is easier to remember the whole sequence than to apply only the parts you need.
To avoid rebooting, I believe running
sudo mount -a
should fix it, as it will then run the mounts specified in/etc/fstab