如果要在記憶體只有 512MB 的機器上裝 Ubuntu 19.10 或以上的版本,要使用傳統的安裝程式安裝。
最近為了模擬 VPS,在自己的電腦上開了一台 CPU 一核心、記憶體只有 512MB 的虛擬機。
準備安裝 Ubuntu,掛載 ISO 檔之後,在開機時出現下面的錯誤:
[ 0.995337] Initramfs unpacking failed: write error[ 1.169571] Failed to execute /init (error -2)[ 1.169868] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.[ 1.170501] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.3.0-18-generic #19-Ubuntu[ 1.170833] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS ?-20191223_100556-anatol 04/01/2014[ 1.171233] Call Trace:[ 1.171398] dump_stack+0x63/0x8a[ 1.171578] ? csum_partial_copy_generic+0x38f0/0x3930[ 1.171858] panic+0x101/0x2d7[ 1.172037] ? do_execve+0x25/0x30[ 1.172215] ? rest_init+OxbO/OxbO[ 1.172394] kernel_init+Oxfb/Ox100[ 1.172576] ret_from_fork+0x35/0x40[ 1.172882] Kernel Offset: Oxa000000 from Oxffffffff81000000 (relocation range: Oxffffffff80000000-Oxffffffffbfffffff)[ 1.173337] ---[ end Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]---
用網路搜尋之後發現,發生 Initramfs unpacking failed: write error
這個錯誤的原因是記憶體不足。自從 17.10 開始,Ubuntu 開始導入新的安裝程式——Subiquity。Subiquity 需要至少 1GB 的記憶體才能正常運作。如果記憶體只有不到 1GB 的話,只能選擇傳統的安裝程式(debian-installer)才能正常安裝。
傳統安裝程式載點:http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/
官方打算從 20.04 開始不再繼續使用舊的安裝程式。使用 debian-installer 的映像檔檔名(以 amd64 架構為例)已經從 19.10 時的 ubuntu-19.10-server-amd64.iso 改成了 ubuntu-20.04-legacy-server-amd64.iso,照這樣以後可能不會再繼續提供舊的 debian-installer 安裝程式。
如果沒有 debian-installer 的話要怎麽在 512MB 記憶體的伺服器上裝 Ubuntu?如果是虛擬機的話,其實可以先將記憶體設成 1GB,等到裝完之後再調回來。另外一個方法是用 Ubuntu Cloud Images,這個東西是已經預先安裝的磁碟映像,所以不用安裝就可以用。既然不需要安裝,也就不用在意安裝程式的系統需求了。
參考資料
- https://askubuntu.com/questions/1230191/20-04-server-install-not-booting-on-low-memory-vm
- https://ubuntu.com/server/docs/installation - Ubuntu 系統需求
- https://bbs.archlinuxcn.org/viewtopic.php?pid=30418#p30418 - 指出錯誤原因是記憶體不足
- https://discourse.ubuntu.com/t/server-installer-plans-for-20-04-lts/13631 - 官方對伺服器安裝程式的計劃