Commit e675a4a4 authored by Kristian Klausen's avatar Kristian Klausen 🎉 Committed by Christian Rebischke
Browse files

Disable predictable network interface names in a more "correct" way

Disabling it by masking 99-default.link works, but it "breaks":
udevadm test-builtin net_setup_link, as a default link configuration
isn't created. Breaking net_setup_link breaks cloud-init, which means
the cloud image doesn't work.
So with this commit we disable it the same way as Debian does[1], by
adding "net.ifnames=0" to the kernels command line.

See also #30

[1] https://salsa.debian.org/openstack-team/debian/openstack-debian-images/blob/fb1d5be0b84895c96f8209f6e7177cf1f6bf1b25/build-openstack-debian-image#L1861

Signed-off-by: Kristian Klausen's avatarKristian Klausen <kristian@klausen.dk>
parent 933ff206
...@@ -35,9 +35,6 @@ curl --output /home/vagrant/.ssh/authorized_keys --location https://raw.github.c ...@@ -35,9 +35,6 @@ curl --output /home/vagrant/.ssh/authorized_keys --location https://raw.github.c
chown vagrant:vagrant /home/vagrant/.ssh/authorized_keys chown vagrant:vagrant /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/authorized_keys chmod 0600 /home/vagrant/.ssh/authorized_keys
# setup unpredictable kernel names
ln -s /dev/null /etc/systemd/network/99-default.link
# setup network # setup network
cat <<EOF >/etc/systemd/network/eth0.network cat <<EOF >/etc/systemd/network/eth0.network
[Match] [Match]
...@@ -98,4 +95,6 @@ elif [ -b "/dev/vda" ]; then ...@@ -98,4 +95,6 @@ elif [ -b "/dev/vda" ]; then
grub-install /dev/vda grub-install /dev/vda
fi fi
sed -i -e 's/^GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=1/' /etc/default/grub sed -i -e 's/^GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=1/' /etc/default/grub
# setup unpredictable kernel names
sed -i -e 's/^GRUB_CMDLINE_LINUX=.*$/GRUB_CMDLINE_LINUX="net.ifnames=0"/' /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg grub-mkconfig -o /boot/grub/grub.cfg
...@@ -29,9 +29,6 @@ arch ALL=(ALL) NOPASSWD: ALL ...@@ -29,9 +29,6 @@ arch ALL=(ALL) NOPASSWD: ALL
EOF EOF
chmod 440 /etc/sudoers.d/arch chmod 440 /etc/sudoers.d/arch
# setup unpredictable kernel names
ln -s /dev/null /etc/systemd/network/99-default.link
# setup network # setup network
cat <<EOF >/etc/systemd/network/eth0.network cat <<EOF >/etc/systemd/network/eth0.network
[Match] [Match]
...@@ -92,4 +89,6 @@ elif [ -b "/dev/vda" ]; then ...@@ -92,4 +89,6 @@ elif [ -b "/dev/vda" ]; then
grub-install /dev/vda grub-install /dev/vda
fi fi
sed -i -e 's/^GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=1/' /etc/default/grub sed -i -e 's/^GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=1/' /etc/default/grub
# setup unpredictable kernel names
sed -i -e 's/^GRUB_CMDLINE_LINUX=.*$/GRUB_CMDLINE_LINUX="net.ifnames=0"/' /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg grub-mkconfig -o /boot/grub/grub.cfg
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment