when you run the OS gives this error.The file exists, but it is empty. I tried this command, but nothing changes. sudo mknod -m 666 /dev/null c 1 3
1 Answer
If it says dev/null (not /dev/null, mind the leading slash), then it doesn't refer to /dev/null. It refers to ./dev/null. This is different than /dev/null, unless the working directory happens to be /.
Some line probably misses the leading slash for /dev/null. You need to find it and fix it. The regex you need may be [^/]dev/null.
Your grep probably supports -r. I would first check the contents of /etc/:
sudo grep -r '[^/]dev/null' /etc/And if by "when you run the OS" you mean "when your user logs in", then the home directory:
grep -r '[^/]dev/null' "$HOME"(consider --binary-files=without-match if your grep supports it).
Similarly you can check other directories (e.g. /usr/lib/systemd/system/, although I would rather expect it to be sane).
As the last resort you may want to check the entire /. In this case an option to not descend to other filesystems may be handy. There is no such option in grep but you can use find with -xdev:
sudo find / -xdev -type f -exec grep -l '[^/]dev/null' {} +This last command doesn't use non-POSIX extensions, it's quite universal.
If any command finds something, you should carefully investigate if / is really missing there. False positives are possible. E.g. a string like udev/null or udev/nullifier (whatever it could refer to) is possibly fine, while =dev/null is possibly erroneous. And /var/log/auth.log will most likely contain the literal [^/]dev/null string, but it's just a log.
If you decide to alter any file you don't fully understand, make a copy of it (cp -a) and/or note (on a piece of paper) its path and what you're changing. Change one file at a time and reboot. If the problem doesn't vanish, change the file back to what it was. In case you break something very bad, such precautions may save your day. It's a worst case scenario though. You will probably narrow your search down to just one suspicious file and this will be it.