I use a shutdown-script to backup the files on an instance before it is shutdown. In this shutdown-script, the gsutil tool is used to send files to a bucket at google cloud storage.

/snap/bin/gsutil -m rsync -d -r /home/ganjin/notebook gs://ganjin-computing/XXXXXXXXXXX/TEST-202104/notebook

It worked well for long days. But recently, there occurs some error as below.

If I run the code manually, it works well. It seems that there is something wrong with jobs management of systemd.

Could anyone give me some hint?

 INFO shutdown-script: /snap/bin/gsutil -m rsync -d -r /home/ganjin/notebook gs://ganjin-computing/XXXXXXXXXXX/TEST-202104/notebook
Apr 25 03:00:41 instance-XXXXXXXXXXX systemd[1]: Requested transaction contradicts existing jobs: Transaction for snap.google-cloud-sdk.gsutil.d027e14e-3905-4c96-9e42-c1f5ee9c6b1d.scope/start is destructive (poweroff.target has 'start' job queued, but 'stop' is included in transaction).
Apr 25 03:00:41 instance-XXXXXXXXXXX shutdown-script: INFO shutdown-script: internal error, please report: running "google-cloud-sdk.gsutil" failed: cannot create transient scope: DBus error "org.freedesktop.systemd1.TransactionIsDestructive": [Transaction for snap.google-cloud-sdk.gsutil.d027e14e-3905-4c96-9e42-c1f5ee9c6b1d.scope/start is destructive (poweroff.target has 'start' job queued, but 'stop' is included in transaction).]
1

There are 1 best solutions below

0
On
  1. Update gsutil with -f option.

    update gsutil -f

    If the above command doesn’t work then try the command below:

    sudo apt-get update && sudo apt-get --only-upgrade install google-cloud-sdk

  2. Update guest environment and try to shutdown the instance. Use the link below as a reference to update the guest environment.

    https://cloud.google.com/compute/docs/images/install-guest-environment#update-guest

  3. If still facing issues do forceful shutdown:

    sudo poweroff -f