From 91a3a806c22110ae2ec05f1f839e27ae00e01564 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 15 May 2011 11:18:47 +0100 Subject: [PATCH] Remove persistent udev rules. When debootstrap installs udev, it picks up at least the net devices from the host that is building the image. This is not useful, so we remove the files. Upon booting the image, udev will re-create the files, so that's all fine. --- vmdebootstrap | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vmdebootstrap b/vmdebootstrap index fbba419..fcdc774 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -73,6 +73,7 @@ class VmDebootstrap(cliapp.Application): rootdir = self.mount(rootdev) self.debootstrap(rootdir) self.set_root_password(rootdir) + self.remove_udev_persistent_rules(rootdir) self.install_extlinux(rootdev, rootdir) except: self.cleanup() @@ -164,6 +165,16 @@ class VmDebootstrap(cliapp.Application): def set_root_password(self, rootdir): self.message('Removing root password') self.runcmd(['chroot', rootdir, 'passwd', '-d', 'root']) + + def remove_udev_persistent_rules(self, rootdir): + self.message('Removing udev persistent cd and net rules') + for x in ['70-persistent-cd.rules', '70-persistent-net.rules']: + pathname = os.path.join(rootdir, 'etc', 'udev', 'rules.d', x) + if os.path.exists(pathname): + logging.debug('rm %s' % pathname) + os.remove(pathname) + else: + logging.debug('not removing non-existent %s' % pathname) def install_extlinux(self, rootdev, rootdir): self.message('Installing extlinux') -- 2.39.5