0

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).]
4

1 回答 1

0
  1. 使用 -f 选项更新 gsutil。

    更新 gsutil -f

    如果上述命令不起作用,请尝试以下命令:

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

  2. 更新来宾环境并尝试关闭实例。使用下面的链接作为更新来宾环境的参考。

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

  3. 如果仍然面临问题,请强制关闭:

    sudo poweroff -f

于 2021-06-08T21:31:02.977 回答