Is it sane to override launch.service if INITSYSTEM=on?



When using INITSYSTEM=on, Resin no longer restarts my main process when it crashes (it doesn’t restart the container either).

The systemd unit /etc/systemd/system/launch.service is pretty simple:

[Unit] User Application



If I want to add behaviors to this service, is it sane to just overwrite this file with a modified version? If I do that, what’s the likelihood of it breaking with future ResinOS updates?

If it’s considered a normal use case to override this service, it also might be good to document it alongside the INITSYSTEM=on docs.

Cheers :v:


Hi, can you paste your Dockerfile please?
And is this service you pasted here intended for the user container?


Hi @floion,

Is the Dockerfile actually relevant here? I meant this as a general question as to whether it’s considered a good or bad practice to override launch.service (the systemd unit that launches the user application, such as this one).

I’ve read in other forum posts that with INITSYSTEM=on, the container no longer gets restarted when the application crashes, and that this is expected behavior (here, for example). And in that specific post, @imrehg recommends overriding the application launch service, which I guess answers my question on whether it’s acceptable to do that.

In either case, it might be worth documenting all this stuff in the INITSYSTEM documentation:


I do believe this will get overwritten with application updates so it would not be safe to overwrite this service.
@nghiant2710 please correct me if I am wrong


I see, that’s what I was afraid of. So is there any officially supported way to ensure that my app gets restarted if it crashes, even when using INITSYSTEM=on?


@bgentry, you can override the launch.service without any problems at all. Moreover, you can add a new service if you don’t want to use the default service, just remember to enable by doing systemctl enable <service> in your Dockerfile.


Thanks, that’s great to know. Keep up the good work :slight_smile: