The post explains how to fix a potential network problem when using a CI template. It is based on a true story after creating an Ubuntu 24.04 template and using it.
Use case
ci.inria.fr allows users to create their own templates. The process is quite simple:
- create a slave as usual
- configure it as you wish (installing your preferred packages, tools, environment, conda, etc.
-
connect to Cloudstack
- stop the slave
- create a template from this slave (the process and instructions on where to click can be found in the Cloudstack documentation)
This is exactly what I did for a Ubuntu 24.04 slave.
Then, I created a new slave using this homemade template…
And… patatras !
The problem
The new slave started, but it was not reachable online (SSH connections failed).
The fix
- connect to the Cloudstack console for this slave (before this, I had to force reboot the slave several times, for reasons still unknown).
- log in using the ci account.
- increase your privileges to root (sudo -i).
- verify that the network interface is broken (e.g., by using ifconfig).
- get the MAC address of the network interface (ifconfig will help you again; for Ubuntu 24.04, the interface is ens3).
- modify the file /etc/netplan/50-cloud-init.yaml: replace the MAC address in the file with the actual MAC address of the current slave.
- reboot the slave.
Et voilà!
More cleaning
The new slave inherits all the characteristics of the original one. Some additional fixes can/should be performed:
As root:
- change the hostname of the new slave (echo new_slave_hostname > /etc/hostname).
- regenerate the SSH server keys (dpkg-reconfigure openssh-server).
As the ci user:
- update the GitLab/GitHub runner credentials if they are part of the template (remove the old ones, create new ones).
PS: This list might grow if new issues are discovered with the new slave…