Custom .service Not Active After Boot; Failed to reset devices.list

,

I wrote a tiny custom .service module to capture the date and time when my containers shutdown. The reason: I’m chasing a different problem w/ my setup, so knowing the time of shutdown would be useful.

I used systemctl enable and systemctl start as required. However, after booting the container, the service isn’t active: systemctl status myNewService shows it as “inactive (dead).”
I also see the following error message: “myNewService.service: Failed to reset devices.list: Operation not permitted”

If I use systemctl restart, the status switches to “active (exited)” and the error message drops away.

Also, the service actually does what it should do at shutdown when it is active.

I would appreciate any help.

Specs: Ubuntu 18.04 host w/ Ubuntu 18.04 containers.
The service unit file looks like this

[Unit]
Description: blah
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target kexec.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
ExecStop=/path/to/my/custom/script # ← executable, of course

[Install]
WantedBy=shutdown.target reboot.target halt.target kexec.target

The devices.list error is a red herring, it’s just a warning which shows up for just about every unit in every container.

Thanks for the reply.

I wonder what I’ve done wrong, then. I’ll keep looking.