File Descriptor error while mounting proc file system
Introduction-
One day I was just playing with device files in /dev directory. While next reboot I met a new error “Mounting proc filesystem Bad file descriptor No such partition found …” I have no idea why this is happening! I stuck with this problem for two days and with lot of search on internet I found that this is due to /dev/null is modifed as “regular file“!! To fix this, I login in to rescue mode and then remounted the root(/) file system as read-write and restore the /dev/null file!
bash-arun~# mount -n -o remount,rw /
bash-arun~#
bash-arun~# rm -f /dev/null
bash-arun~# mknod -m 0666 /dev/null c 1 3
bash-arun~#
That’s it!!
root@arunbagul:~# ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 2008-02-29 09:22 /dev/null
root@arunbagul:~#
* As shown above the /dev/null is character device file…
command(1) mknod – this command is used to create “Block device” or “Character device” special files….
mknod [options]… NAME TYPE [MAJOR MINOR]
Options –
-m, –mode=MODE
set permission mode (permission need to be numeric format)
–help display this help and exit
–version
output version information and exit
Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X, it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal; otherwise, as decimal.
TYPE may be –
b –> create a block (buffered) special file
c, u –> create a character (unbuffered) special file
p –> create a FIFO
Example –
root@arunbagul:~# mknod /tmp/arun p
root@arunbagul:~#
root@arunbagul:~# ls -l /tmp/arun
prw-r–r– 1 root root 0 2008-04-18 23:31 /tmp/arun
root@arunbagul:~#
root@arunbagul:~# mknod -m 666 /tmp/block_device b 12 16
root@arunbagul:~#
root@arunbagul:~# ls -l /tmp/block_device
brw-rw-rw- 1 root root 12, 16 2008-04-18 23:32 /tmp/block_device
root@arunbagul:~#
Cheers,
Arun Bagul