mount: special device /var/run does not exist

While P2V-ing an Ubuntu 6.06 server with my warm-cloning P2V method, I ran into a strange problem when booting:

Sceendump - click to enlarge

The exact text of the error is:


mount: special device /var/run does not exist
mount: special device /var/lock does not exist
mount: wrong fs type, bad option, bad superblock on /dev/shm/var.run,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail or so

mount: wrong fs type, bad option, bad superblock on /dev/shm/var.lock,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail or so

Everything seems to work, untill I found out that the extra IP addresses on secondary network interfaces were not able to carry any network traffic…
I had to cancel the virtualization and revert to the physical machine again.
The system in question has a separate /var partition (see booting picture, /dev/sda6 in my case).
I first mount the root filesystem, which holds on empty “var” directory, and then mount /dev/sda6 on that “var” directory. I had created empty “run” and “lock” directories in there to be able to mount /var/run and /var/lock. Wrong!

Turns out that the root filesystem needs to contain /var/run and /var/lock, even though the system has a separate /var partition.

:bonk: :bonk: :bonk:

Thanks to Chris Siebenmann for pointing this out on his wiki.

The solution thus is to boot from Ubuntu Live CD, mount ONLY the root filesystem, and create the /var/run and /var/lock directories.
They are only needed for mounting the tempfs partitions, and will be hidden by the real /var partition, which is mounted over it once the system has finished booting.

6 Responses to “mount: special device /var/run does not exist”

  1. Ali Sattari says:

    Hi,
    Really annoying problem! :|
    I think same goes for /var/tmp (at least in my case).

    Thanks for the Tip!

  2. zazuge says:

    thanks for the tip i’ve run into the same problem
    when i tried to move my ubuntu form one root partition to multiple LVM partitions (seperate var usr tmp etc ..)

  3. Hans-Christian says:

    A simpler solution than using a live cd is mount –bind / /mnt/rootfs ; mkdir /mnt/rootfs/var/run /mnt/rootfs/var/loc ; umount /mnt/rootfs

    Thank you for the tip, I had the same problem.

  4. thanks for the tip i’ve run into the same problem
    when i tried to move my ubuntu form one root partition to multiple LVM partitions (seperate var usr tmp etc ..)

  5. زفات says:

    Really annoying problem!
    I think same goes for /var/tmp (at least in my case).

  6. Stefan says:

    Thanks! Had this same issue tonight with a clients server rebuild. After creating /var/lock, /var/run, /var/tmp on the root / partition, everything was ok. Appreciate it!

Leave a Reply

Captcha
Enter the letters you see above.
(Sorry it is so long, but spammers actually type these as well.... give it your best shot if you really want to comment)