【发布时间】:2021-07-18 19:32:15
【问题描述】:
我使用关闭脚本在实例关闭之前备份实例上的文件。 在这个关闭脚本中,gsutil 工具用于将文件发送到谷歌云存储中的存储桶。
/snap/bin/gsutil -m rsync -d -r /home/ganjin/notebook gs://ganjin-computing/XXXXXXXXXXX/TEST-202104/notebook
它在很长一段时间内运行良好。但是最近出现了如下错误。
如果我手动运行代码,它运行良好。 systemd的作业管理好像有问题。
谁能给我一些提示?
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).]
【问题讨论】:
-
您当前的 systemd 版本是多少?您使用的是与脚本上次运行时相同的 systemd 版本吗?
-
检查是否有可用的更新 (
gcloud components update)。更新,我认为该错误会消失。 -
我在实例上运行“gcloud components update”(用于创建图像文件的那个),出现错误:
ERROR: (gcloud.components.update) You cannot perform this action because this Cloud SDK installation is managed by an external package manager. Please consider using a separate installation of the Cloud SDK created through the default mechanism described at: https://cloud.google.com/sdk/ -
我使用的是 Ubuntu 镜像:
Linux instance-XXXXXXX 5.4.0-1036-gcp #39-Ubuntu SMP Thu Jan 14 18:41:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux -
尝试以下步骤:1)
gcloud version。记下gsutil的版本。 2)sudo apt update。 3)sudo apt upgrade。 4)gcloud version。 5)gsutil更新了吗?
标签: google-compute-engine shutdown-script