HOWTO Populate /dev with static files on Debian

This article was first written in December 2005 for the BeezNest technical
website (http://glasnost.beeznest.org/articles/320).
In some situation (when using previously devfs, for example), your /dev is empty of static files, and moving to udev or coming back to static /dev is then impossible. In package debootstrap on Debian, there is the file /usr/lib/debootstrap/devices.tar.gz (or /usr/share/debootstrap/devices.tar.gz in newer releases) which only contains standard /dev files. To set them in place is then just:
# cd /mount_point
# tar zxvf /usr/lib/debootstrap/devices.tar.gz
Of course, your /dev must not be mounted with udev or devfs for this to work, so it may be necessary to boot from a CD (for example) and mount your adequate partitions (containing /dev and /usr/lib) before doing this.

Example procedure

Your installation is broken because the system does not find some devices at boot (ex.: /dev/console or /dev/null).
  • Boot on a Debian or Ubuntu CD (not necessarily a LiveCD)
  • Switch to console (alt-f2 - Enter)
  • Mount the partition on the harddrive where / is located (ex: /dev/hda3) on /floppy
  • Mount the partition on the harddrive where /usr is located, if separate, under /floppy/usr
  • Change to directory /floppy
  • Execute tar zxvf usr/lib/debootstrap/devices.tar.gz
  • Reboot