Interactive firstboot

cloudguy

Renowned Member
Jan 4, 2012
47
2
73
Hello. I'm trying to automate the install of PVE. I got everything to work as expected referencing published WIKI automated install docs. However I didn't expect that the firstboot script would end up running as a service vs. interactively. I have a few prompts that need user input (site code, hostname, etc.) that complete the config.

Code:
[first-boot]
source = "from-url"
ordering = "network-online"
url = "{bash_script_url}"

Does anyone know how to force firstboot to run interactively on first login as root?
 
Hi,

It's mostly modeled after the https://www.freedesktop.org/software/systemd/man/latest/systemd-firstboot.html mechanism, which does pretty much the same.

You can script the interactive prompt yourself, though.
Easiest way would be probably through some users ~/.profile, which runs on login, so the administrator needs to log in just once.
E.g. something like:
Bash:
if ! [ -f ~/.provisioned ]; then
  # do some provisioing ..
  touch ~/.provisioned
fi

or you could also create the provisioing script in your first-boot script somewhere on the system, e.g. /usr/local/bin/our-provisioning, then run it in the background with nohup /usr/local/bin/our-provisioning &, writing & reading from some other TTY.

For example, the following switches to TTY12, resets it, displays some text and finally an interactive dialog, afterwards switching back to TTY1.
Bash:
#!/bin/sh

trap "chvt 1" SIGINT

chvt 12
reset >/dev/tty12 2>/dev/tty12
echo here on tty12 >/dev/tty12
sleep 2

dialog --msgbox foo 10 40 >/dev/tty12 2>/dev/tty12 </dev/tty12

chvt 1
 
Thank you. I was thinking of doing similar. Just wasn't sure if I was missing any thing from the auto install documented / undocumented capabilities.