
我在 Azure 雲端建立了 Ubuntu 12.04.5 LTS。我透過 Jenkins powershell 建置建立它: 1. 在 Azure 中建立 VM 2. 執行一些遠端 SSH 命令(其中包括 apt-get dist-upgrade) 3. 從 VM 建立虛擬映像
但建置在步驟 2 中掛起。
apt-get update
apt-get -q -y dist-upgrade
-y 的目的是避免互動式問題。如果我從 shell 手動運行apt-get -q -y dist 升級它工作正常,直到兩次卡住:
參數-y應該可以避免這種情況。如您所見,有問題的包是瓦代理,即 Microsoft Azure Linux Agent,當我完成步驟 1 時,它會預設安裝
我的問題是:我怎樣才能避免這些互動問題?(要么回答“是”,要么“否”,或者避免升級此軟體包或其他內容)
答案1
也許你也可以嘗試:
DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes
答案2
似乎與設定檔的衝突在 apt-get (dkpg) 中很常見,我透過使用以下方法解決了這個問題:
apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade
選項的含義是:
- --force-confdef:請 dpkg 在可以的情況下單獨決定,否則提示...
- --強制合併: 不要修改目前設定檔...