Skip to main content
Notice removed Draw attention by Marcus Müller
Bounty Ended with kos's answer chosen by Marcus Müller
added 62 characters in body
Source Link
Marcus Müller
  • 52.1k
  • 4
  • 80
  • 123

I've got a few things that I don't want to update while my graphical session is running, but would be happy to have them updated on shutdown (after my graphical session ended, while network is still up), once. So, I don't want to write a service file, enable it, and then have it run at every shutdown.

Now, I thought, OK, systemd-run to the rescue:

systemd-run \
           --property=Type=oneshot \
           --property=DefaultDependencies=no \
           --property=Requires=network.service \
           --property=WantedBy=shutdown.target \
           /usr/bin/dnf5 update -y package1 packge2…

But that fails with

Failed to start transient service unit: Dependency type WantedBy may not be created transiently.

Is there another way to this?

I've got a few things that I don't want to update while my graphical session is running, but would be happy to have them updated on shutdown, once. So, I don't want to write a service file, enable it, and then have it run at every shutdown.

Now, I thought, OK, systemd-run to the rescue:

systemd-run \
           --property=Type=oneshot \
           --property=DefaultDependencies=no \
           --property=Requires=network.service \
           --property=WantedBy=shutdown.target \
           /usr/bin/dnf5 update -y package1 packge2…

But that fails with

Failed to start transient service unit: Dependency type WantedBy may not be created transiently.

Is there another way to this?

I've got a few things that I don't want to update while my graphical session is running, but would be happy to have them updated on shutdown (after my graphical session ended, while network is still up), once. So, I don't want to write a service file, enable it, and then have it run at every shutdown.

Now, I thought, OK, systemd-run to the rescue:

systemd-run \
           --property=Type=oneshot \
           --property=DefaultDependencies=no \
           --property=Requires=network.service \
           --property=WantedBy=shutdown.target \
           /usr/bin/dnf5 update -y package1 packge2…

But that fails with

Failed to start transient service unit: Dependency type WantedBy may not be created transiently.

Is there another way to this?

Notice added Draw attention by Marcus Müller
Bounty Started worth 200 reputation by Marcus Müller
Source Link
Marcus Müller
  • 52.1k
  • 4
  • 80
  • 123

Run an update *one* time at shutdown – systemd-run?

I've got a few things that I don't want to update while my graphical session is running, but would be happy to have them updated on shutdown, once. So, I don't want to write a service file, enable it, and then have it run at every shutdown.

Now, I thought, OK, systemd-run to the rescue:

systemd-run \
           --property=Type=oneshot \
           --property=DefaultDependencies=no \
           --property=Requires=network.service \
           --property=WantedBy=shutdown.target \
           /usr/bin/dnf5 update -y package1 packge2…

But that fails with

Failed to start transient service unit: Dependency type WantedBy may not be created transiently.

Is there another way to this?