簡體   English   中英

Google Compute Engine (GCE) 啟動腳本 //“apt-get upgrade”關閉 google script runner (google-startup-scripts.service)

[英]Google Compute Engine (GCE) Startup Script // "apt-get upgrade" shutting down google script runner (google-startup-scripts.service)

就在過去幾天,我的 GCE 啟動腳本在創建新實例時一直失敗。 我相信這是因為apt-get upgrade命令導致 google-startup-scripts 服務關閉或重啟。 我添加了export行和--force-conf選項來嘗試解決這個問題,但它仍然失敗。 如果我從腳本中刪除apt-get upgrade命令,一切都會成功完成。 但是,然后我必須登錄服務器進行最后的“升級”。 關於如何解決這個問題的任何想法?

可能值得注意的是,當我手動運行apt-get upgrade時,它會詢問我 2 個提示:1) 我是否要覆蓋 sshserver 配置文件(我不想),以及 2) 重新啟動以下服務(在下面列出)

操作系統 Ubuntu 22.04.1 LTS(e2-standard-2 計算引擎)

啟動腳本片段

apt-get -y update

export DEBIAN_FRONTEND=noninteractive
export NEEDRESTART_MODE=l
apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

日志片段

解壓google-guest-agent后,似乎關閉了腳本運行器

google_metadata_script_runner startup-script-url: Preparing to unpack .../61-dbus-user-session_1.12.20-2ubuntu4.1_amd64.deb ...
google_metadata_script_runner startup-script-url: Unpacking dbus-user-session (1.12.20-2ubuntu4.1) over (1.12.20-2ubuntu4) ...
google_metadata_script_runner startup-script-url: Preparing to unpack .../62-google-compute-engine-oslogin_20220714.00-0ubuntu1~22.04.1_amd64.deb ...
google_metadata_script_runner startup-script-url: Unpacking google-compute-engine-oslogin (20220714.00-0ubuntu1~22.04.1) over (20210907.00-0ubuntu2) ...
google_metadata_script_runner startup-script-url: Preparing to unpack .../63-google-guest-agent_20220622.00-0ubuntu2~22.04.0_amd64.deb ...
systemd Stopping Google Compute Engine Shutdown Scripts...
systemd google-startup-scripts.service: Main process exited, code=killed, status=15/TERM
systemd google-startup-scripts.service: Failed with result 'signal'.
systemd google-startup-scripts.service: Unit process 1263 (startup-script-) remains running after unit stopped.
systemd google-startup-scripts.service: Unit process 1632 (apt-get) remains running after unit stopped.
systemd google-startup-scripts.service: Unit process 4500 (dpkg) remains running after unit stopped.
systemd google-startup-scripts.service: Unit process 4501 (sh) remains running after unit stopped.
systemd google-startup-scripts.service: Unit process 4502 (sh) remains running after unit stopped.
systemd google-startup-scripts.service: Unit process 4503 (dpkg-status) remains running after unit stopped.
systemd google-startup-scripts.service: Unit process 5377 (preinst) remains running after unit stopped.
systemd google-startup-scripts.service: Unit process 5382 (systemctl) remains running after unit stopped.
systemd Stopped Google Compute Engine Startup Scripts.
systemd google-startup-scripts.service: Consumed 25.932s CPU time.

手動運行“apt-get upgrade”后服務要求重啟

[*] apache2.service                                           
[*] chrony.service                                            
[ ] dbus.service                                              
[*] fail2ban.service                                          
[ ] getty@tty1.service                                        
[*] google-cloud-ops-agent-diagnostics.service                
[*] google-cloud-ops-agent-fluent-bit.service                 
[*] google-cloud-ops-agent-opentelemetry-collector.service    
[*] google-osconfig-agent.service                             
[*] packagekit.service                                        
[*] polkit.service                                            
[*] postfix@-.service                                         
[*] serial-getty@ttyS0.service                                
[*] systemd-udevd.service                                     
[*] tomcat8.service                                           
[ ] unattended-upgrades.service                              
[ ] user@1354759638.service    

顯然,我有一個實例模板引用了與新創建的實例不兼容的舊操作系統映像(ARM 而不是 x86)。 更新到新的 x86 操作系統映像后,問題自行解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM