Jump to content
Welcome to our new Citrix community!
  • 0

XenServer Network installation - first boot script

Ken Z


Hi Everyone


I have a quick question regarding a Network installation and the post-install script that can be used to perform post build configuration.

in the past XenServer was used with the initd system of booting, while the latest version uses systemd

the initd used start-up scripts starting with 'S' in the relevant run level folders (rc3.d, rc5.d, etc). That means that the post-install script just needed to copy/link in the relevant scripts to get the first-boot script to run after the reboot of the server after the system build.

Systemd requires you to run a command ("systemd enable <'script.service'>") to enable the bootup scripts to run. So for example the old post-install script might have looked like


touch $1/tmp/post-executed
wget http://192,168.10.100/first-boot-script.sh -O $1/tmp/first-boot-script.sh
chmod 777 $1/tmp/first-boot-script.sh
ln -s /tmp/first-boot-script.sh $1/etc/rc3.d/S99zzpostinstall


but the new one should look like (where "first-boot-script.service" is the config file to run the bash script)


touch $1/tmp/post-executed
wget -O $1/tmp/first-boot-script.sh
wget -O $1/tmp/first-boot-script.service
chmod 777 $1/tmp/first-boot-script.sh
cp $1/tmp/first-boot-script.service $1/etc/systemd/system/first-boot-script.service
systemctl enable first-boot-script.service


unfortunately the last line of the script does not work as the systemd environment has not yet been initialised.

I can either run this last line manually after the system gets rebooted, then reboot a second time (after which it works as expected), or run the /tmp/first-boot-script.sh manually.


I'm trying to get the installation to work as automatically/seamlessly as possible, so does anyone know how to enable the service via the post-install script?




Ken Z

Link to comment

2 answers to this question

Recommended Posts

  • 0



if anyone is interested, this was not possible using systemd/systemctl.

The only way to get this to work was by creating a cron entry that runs on reboot. i.e. contains a line that contains the @reboot option. Below is an example.


@reboot /tmp/first-boot-script.sh


This works fine





Ken |

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...