How to fix "dup2: bad file descriptor" on Linux

  • This error is actually happen because the /dev/null entry in the device inode permission is screwed up
    when the system is showing:

    mounting proc filesystem [ ERROR ]
    dup2: bad file descriptor,


  • Note: The following step will fix the error:

  1. Proceed with login to repair filesystem (provide root password)
    Next mount your root filesystem
  2. mount -n -o remount,rw /dev/hdxx (where hdxx or sdxx is your root partition)
    Remove the /dev/null entry
  3. rm -rf /dev/null
    Since we've already remove the /dev/null, we have to create a new writeable entry
  4. mknod -m 666 /dev/null c 1 3
    Reboot the system using shutdown -r now or shutdown -h now, the filesystem should be correctly mounted the next round of booting.

Hosted by www.Geocities.ws

1