我想問一下我用 packer 在 GCP 上跑 sudo apt-get update 會噴這個錯誤,但重跑幾次又可以過,想問一下其他人有什麼建議 🙏
googlecompute: Get:40 http://archive.ubuntu.com/ubuntu jammy-backports/universe Translation-en [15.0 kB]
googlecompute: Get:41 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 c-n-f Metadata [548 B]
googlecompute: Get:42 http://archive.ubuntu.com/ubuntu jammy-backports/multiverse amd64 c-n-f Metadata [116 B]
==> googlecompute: E: Could not open file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy_restricted_cnf_Commands-amd64 - open (2: No such file or directory)
==> googlecompute: Traceback (most recent call last):
==> googlecompute: File "/usr/lib/cnf-update-db", line 32, in <module>
自問自答 拔掉 jammy-backports 後好像有改善
sudo sed -i.bak '/jammy-backports/ s|^deb |# deb |' /etc/apt/sources.list
cnf 是 command-not-found,也就是執行 Ubuntu 軟體庫有提供但未安裝的命令時會提示你要安裝哪個軟體包的東西
至於為什麼會報錯就不知道了,這種東西的資料應該不是必定要存在的才是
我也不懂…為什麼會錯
一模一樣的腳本重跑幾次就過了 🤔
如果是容器的話說不定因為容器輕量化的原因在建置期間容器映像有被移除了額外的檔案,重新跑一次 apt-get update 或許可以解決