DNS lookup of repos using pamac not possible on shutdown

Hey guys,

I’m trying to write a script that automatically updates your system on shutdown.
However, pamac is able to check for updates, but not able to resolve the url. It does work though when the system is normally used.
I use the following systemd service to start the updater script:

[Unit]
Description=Update on Shutdown
RequiresMountsFor=/ /home /boot /var /tmp /etc
DefaultDependencies=no
Requires=nss-lookup.target accounts-daemon.service dbus-org.freedesktop.locale1.service systemd-resolved.service pamac-daemon.service upower.service dbus.service network-online.target multi-user.target local-fs-pre.target local-fs.target NetworkManager.service
Upholds=nss-lookup.target accounts-daemon.service dbus-org.freedesktop.locale1.service systemd-resolved.service pamac-daemon.service upower.service dbus.service network-online.target multi-user.target local-fs-pre.target local-fs.target NetworkManager.service
After=nss-lookup.target accounts-daemon.service dbus-org.freedesktop.locale1.service systemd-resolved.service pamac-daemon.service upower.service dbus.service multi-user.target
Before=systemd-poweroff.service shutdown.target umount.target final.target systemd-halt.service

[Service]
Type=oneshot
ExecStart=/bin/true
ExecStop=/usr/share/services/shutdown_update
TimeoutSec=infinity
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

sudo journalctl -rb -1 shows the following:

Pamac logs the following:

As you can see, systemd-resolved switched to 9.9.9.9 as fallback dns server, for whatever reason. I’m connected via wifi to the internet.
Resolving works fine while using it normally.

Did I miss a required service for my script?
Does someone have an idea, why it may happen?

Thanks in advance!

In short, that is needed when system starts, not when the system shuts down. More about it here
https://unix.stackexchange.com/questions/506347/why-do-most-systemd-examples-contain-wantedby-multi-user-target

But regardless, unattended-upgrades are not supported by Arch Linux, hence not supported by Manjaro.
That being said, you can have a look at GitHub - isjerryxiao/pacroller: The "Unattended Upgrades" for Arch Linux. and use that instead … or as a starting point for your script.