LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   /dev/null is a regular file (https://www.linuxquestions.org/questions/linux-general-1/dev-null-is-a-regular-file-616044/)

Wynd 01-24-2008 12:07 PM

/dev/null is a regular file
 
Today I started getting permission denied errors when accessing /dev/null. I did a ls -l on it and the permissions are "-rw-r--r--"; that is, not only are the permissions wrong but it is a regular file and not a device. I fixed it by deleting it and using "mknod -m 0666 /dev/null c 1 3", but what could be causing this?

Uncle_Theodore 01-24-2008 12:26 PM

Well, it might be that your /dev/null was deleted and then some process started to write to it. Then, it would be created again as a regular file. You could've tried to read what in it before deleting it, then you'd had an idea what process wrote to it right after it reappeared. That might have given you an idea of what happened.
Some people suggest creating a cron job like this

test -c /dev/null || echo "/dev/null is missing or a regular file."

PS. Have you by any chance, compiled a kernel as root recently? :)

Wynd 01-24-2008 12:29 PM

Thanks for the advice. I did do "file /dev/null" before I deleted it and it came up as "empty," so I don't know what created it.


All times are GMT -5. The time now is 05:16 PM.