Run a script on first boot after install in 16.04

Tom H tomh0665 at gmail.com
Tue Jul 12 07:42:42 UTC 2016


On Tue, Jul 12, 2016 at 1:01 AM, Josef Wolf <jw at raven.inka.de> wrote:
> On Fr, Jul 08, 2016 at 11:54:16 +0200, Ralf Mardorf wrote:
>> On Thu, 7 Jul 2016 20:14:06 +0200, Josef Wolf wrote:
>>>
>>> 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.
>>
>> Ubuntu switched from upstart to systemd.
>> Install the script to some /path/to/foo.sh, then add a
>> unit /lib/systemd/system/foo.service, e.g.
>> [ ... ]
>> and enable start on bootup by executing
>>
>> sudo systemctl enable foo.service
>
> Thanks, Ralf!
>
> This ALMOST works.
>
> I need to reboot, login and run "sudo systemctl enable foo.service" manually.
>
> I am looking for a way to activate this service from preseeding by
> late-command.
>
> Unfortunately, neither
>
> in-target systemctl disable foo.service
>
> nor
>
> in-target /bin/sh -c systemctl disable gemedis-postinstall.service

d-i doesn't have systemd as pid 1 so you have to add/remove symlinks
manually to enable/disable a service.



More information about the ubuntu-users mailing list