Run a script on first boot after install in 16.04

Tom H tomh0665 at gmail.com
Fri Jul 8 12:44:56 UTC 2016


On Thu, Jul 7, 2016 at 2:14 PM, Josef Wolf <jw at raven.inka.de> wrote:
>
> I have created a customized install-cd that uses the preseed/late_command from
> debian-installer to install some perl-scripts which should be run at the very
> first reboot after the install.
>
> This is the script that is run from late_command:
>
> #! /bin/sh
>
> umask 077
>
> # make our customized instfiles available afte reboot
> #
> cp -a /cdrom/preseed/instfiles /target
> cp -a /cdrom/preseed/instfiles/gem/files/* /target
> chmod -R u=rwX,go= /target/instfiles
>
> # make start scripts executable at first boot
> #
> cd /target/instfiles/gem/scripts/start
> for i in *; do
> ln -s /instfiles/gem/scripts/start/$i /target/etc/rcS.d
> done
>
> The scripts have names like S98postinstall.pl, so symlinks like
> /etc/rcS.d/S98postinstall.pl are created. The scripts delete themselves when
> done, so they will vanish once they're done.
>
> This strategy worked great since 6.10 up to 14.04.
>
> Unfortunately, with 16.04, this won't work anymore. The symlinks in /etc/rcS.d
> are created, but the scripts won't be run at startup.
>
> Any ideas why the links in /etc/rcS.d are ignored and how to get them executed
> at first reboot?

IIRC, systemd no longer integrate early boot sysvinit scripts.

You'd be better off creating systemd service units in
"/etc/systemd/system/sysinit.target.wants/" that call your scripts.



More information about the ubuntu-users mailing list