#585133 devices created by MAKEDEV during installation are lost due improper setup of /target/dev/.static/dev

#585133#5
Date:
2010-06-09 13:18:21 UTC
From:
To:
I have observed in lenny's debian-installer that devices created by
MAKEDEV (called in a postinst of some package) are lost. In most cases
this goes unnoticed because udev is used and devices are created
automatically. After checking the code I believe the latest version
to be affected as well so I'm filing this bug on it.

The reason is that the code in setup_dev_linux() in library.sh is not
doing what it's supposed to do. mount --bind does not transfer sub-mounts
and as such /target/dev/.static/dev is not the same as /dev/.static/dev
despite the bind mount of /dev on /target/dev. I first tried fixing this
with mount --rbind (instead of --bind) but it did not help. I found a
solution that achieves the same task in a more elegant way, see the
attached patch. I first duplicate /target/dev on /target/mnt with mount
--bind, then I replace /target/dev with /dev and finally I move the
bind-mount on /target/mnt to /target/dev/.static/dev.

This does not pollute /dev/.static/dev and still ensures what we want.

Please consider applying the attached patch.

BTW, it would be nice if the patch in #579645 could also be considered. It
will conflict with this patch but it's easy to update if you need.