First Boot Script Not Running


#1

Heya.

I’m creating Debian-based VMs with everything else as the default apart from selecting “Add Script” as the Firstboot script option, then pasting in some shell code.

I started out with something that starts:

#!/bin/bash

# Paste me as the ByteMark first run script

# Install Salt

/bin/echo 'deb http://debian.saltstack.com/debian stretch-saltstack main' >> /etc/apt/sources.list
/usr/bin/wget -O - http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key | apt-key add -
/usr/bin/apt update
/usr/bin/apt install -y salt-minion

But that didn’t work. I simplified the code, tried sh rather than bash, got down to the minimal test case of:

/bin/touch /root/first-boot

and that doesn’t work either.

Does anyone have an example of a first boot script that works, or a suggestion for what I might be doing wrong?

Thank you.


#2

Hi Rob, Rather than pasting in the commands to run, have you tried putting the touch(1) into a new shell script somewhere, make it executable, and then giving “Add Script” the full path to that script. Perhaps it just takes a command to execute with execve(2), whether it’s a script or not. Cheers, Ralph.