Fix unreachable Ubuntu Focal Instance when it has two public IP adresses
When using an Ubuntu 20.04 Focal Instance with more than one routed IP address, the Instance will become unreachable after a reboot. This may happen when you attach a second routed IPv4 or IPv6 IP address to the Instance.
The version of systemd-networkd
used in Ubuntu Focal does not support the definition of a default route which is not part of the subnet of the network interface. The on-link: true
option must be added to the netplan profile.
A modified cloud-init
package named cloud-init_24.2-0ubuntu1~20.04.1+scaleway
has been added to Scaleway's stable PPA to work around this situation.
Your Instance has not been rebooted
- Add Scaleway's stable PPA
add-apt-repository ppa:scaleway/stable
- Add the modified cloud-init package
apt -y install cloud-init
- Re-initialize cloud-init to fix the netplan profile
cloud-init clean
cloud-init init --local
cloud-init init
From this point on, your Instance may be safely rebooted and you will no longer lose connectivity.
Your Instance has rebooted and is no longer reachable
Rescue mode allows you to boot your Instance into a temporary operating system, running from the Instance's RAM. Rescue mode is often used to diagnose and resolve issues such as faulty kernel configurations, networking issues, firewall configurations, and more.
- Switch the Instance's
boot-type
torescue
and reboot your Instance into rescue mode using the CLI:
scw instance server stop <Instance_ID>
# Wait for the instance to be stopped.
scw instance server update <Instance_ID> boot-type=rescue
scw instance server start <Instance_ID>
- Once the Instance is rebooted, log into your Instance using SSH and set up the environment to be able to chroot into it:
cat /proc/partitions
major minor #blocks name
7 0 65480 loop0
7 1 89120 loop1
7 2 39760 loop2
252 0 19531250 vda
252 1 19417569 vda1
252 14 4096 vda14
252 15 108544 vda15
8 0 9765625 sda
8 1 3240943 sda1
8 14 4096 sda14
8 15 108544 sda15
Then mount the partitions and get into the chroot
:
mount /dev/vda1 /mnt
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
mount -o bind /dev /mnt/dev
mount -o bind /run /mnt/run
chroot /mnt
- Fix the DNS resolution file in the chroot
rm -f /etc/resolv.conf
ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
- Once in the
chroot
install the modified cloud-init package:
add-apt-repository ppa:scaleway/stable
apt -y install cloud-init
- Re-initialize cloud-init to fix the netplan profile:
cloud-init clean && cloud-init init --local && cloud-init init
- Get out of the
chroot
and remove the mounts:
umount /mnt/sys /mnt/proc /mnt/dev /mnt/run /mnt
- Stop the Instance, switch back the Instance's
boot_type
tolocal
, and reboot the Instance:
scw instance server stop <Instance_ID>
# Wait for the instance to be stopped
scw instance server update <Instance_ID> boot-type=local
scw instance server start <Instance_ID>
Once rebooted, your Instance will be reachable again.
- Put a hold on the newly installed cloud-init:
apt-mark hold cloud-init
cloud-init set on hold.