X-Git-Url: https://git.siccegge.de//index.cgi?a=blobdiff_plain;f=vmdebootstrap;h=67ea2c867ca785d24e2b2a1d8204ceaa9280126c;hb=5413ccc44b905facd55fbb0812b7c9e350deb44f;hp=18cce1903efa4d1cf92e8d8846566ddd1f2920d4;hpb=ad64e0d3f602fff51455b8db86e3b566df2555e5;p=forks%2Fvmdebootstrap.git diff --git a/vmdebootstrap b/vmdebootstrap index 18cce19..67ea2c8 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -30,7 +30,7 @@ import time from distro_info import DebianDistroInfo, UbuntuDistroInfo -__version__ = '0.10' +__version__ = '0.11' # pylint: disable=invalid-name,line-too-long,missing-docstring,too-many-branches @@ -784,6 +784,18 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth else: logging.debug('not removing non-existent %s', pathname) + def mask_udev_predictable_rules(self, rootdir): + """ + This can be reset later but to get networking working immediately + on boot, the interface we're going to use must be known without + reference to the eventual machine. + http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ + """ + self.message('Disabling systemd predictable interface names') + udev_path = os.path.join( + 'etc', 'udev', 'rules.d', '80-net-setup-link.rules') + self.runcmd(['chroot', rootdir, 'ln', '-s', '/dev/null', udev_path]) + def setup_networking(self, rootdir): self.message('Setting up networking') ifc_file = os.path.join(rootdir, 'etc', 'network', 'interfaces') @@ -808,6 +820,8 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth eth.write('\n') eth.write('auto eth0\n') eth.write('iface eth0 inet dhcp\n') + # force predictable interface names + self.mask_udev_predictable_rules(rootdir) def append_serial_console(self, rootdir): if self.settings['serial-console']: