View Full Version : can only boot to read-only filesystem

10th August 2005, 09:54 PM
i accidentally did a mv /dev/null instead of cp (stupid!...not thinking), and know what i need to do to fix it, however i can only boot to a read-only filesystem and need to delete the regular file /dev/null that was created. i have tried modifying grub to go to single boot and emergency but still get "cannot remove /dev/null (read-only filesystem)" when trying to delete null. once i can get to a non-read-only i have to run

cd /dev
rm null
mknod /dev/null c 1 3
chmod 666 null

thanks in advance

10th August 2005, 10:14 PM
once in single user, try 'mount -o remount,rw /'

10th August 2005, 10:26 PM
good call fsck. that was the part i needed. i was getting the uuid label error from below when trying to mount otherwise. thanks for the reply. here's the full fix i used for anyone googling this problem in the future

Fixing dup2: bad file descriptor, /dev/null: Read-only filesystem error

Only use these if you get “dup2: bad file descriptor“ and “/dev/null: Read-only filesystem“ during bootup, and
“could not open /proc/partitions some stuff about UUID and Label” when trying to remount a filesystem.

first you must boot into the single user mode. Although if you get the error and you restart the system it will automatically drop you in into the single user mode shell.

second you need to mount the /proc partition:

$ mount -o ro /proc

now you must mount the / filesystem in rw mode

$ mount -o remount,rw /

then you must delete the /dev/null file and replace it with the correct inode.

$ rm -f /dev/null
$ mknod -m 666 /dev/null c 1 3

and the last step is to remount / filesystem back to the ro mode, and restart the system

$ mount -o remount,ro /
$ reboot