本文主要介紹ECS執行個體無法啟動的原因以及解決方案。
問題現象
執行個體無法正常啟動,且出現類似如下的錯誤資訊。
[ OK ] Reached target Remote File Systems (Pre).
[ OK ] Reached target Remote File Systems.
[ 1.575629] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: (null)
[ OK ] Mounted /sysroot.
[ OK ] Reached target Initrd Root File System.
Starting Reload Configuration from the Real Root...
[ OK ] Started Reload Configuration from the Real Root.
[ OK ] Reached target Initrd File Systems.
[ OK ] Reached target Initrd Default Target.
Starting dracut pre-pivot and cleanup hook...
[ 1.661164] tsc: Refined TSC clocksource calibration: 2499.915 MHz
[ OK ] Started dracut pre-pivot and cleanup hook.
Starting Cleaning Up and Shutting Down Daemons...
[ OK ] Stopped dracut pre-pivot and cleanup hook.
[ OK ] Stopped target Timers.
[ OK ] Stopped target Remote File Systems.
[ OK ] Stopped target Remote File Systems (Pre).
Starting Plymouth switch root service...
[ OK ] Stopped dracut initqueue hook.
[ OK ] Stopped target Initrd Default Target.
[ OK ] Stopped target Basic System.
[ OK ] Stopped target System Initialization.
Stopping udev Kernel Device Manager...
[ OK ] Stopped target Sockets.
[ OK ] Stopped target Paths.
[ OK ] Stopped Apply Kernel Variables.
[ OK ] Stopped target Slices.
[ OK ] Stopped target Local File Systems.
[ OK ] Stopped udev Coldplug all Devices.
[ OK ] Stopped target Swap.
[ OK ] Stopped udev Kernel Device Manager.
[ OK ] Stopped dracut pre-udev hook.
[ OK ] Stopped dracut cmdline hook.
[ OK ] Stopped Create Static Device Nodes in /dev.
[ OK ] Stopped Create list of required sta...ce nodes for the current kernel.
[ OK ] Closed udev Control Socket.
[ OK ] Closed udev Kernel Socket.
Starting Cleanup udevd DB...
[ OK ] Started Cleaning Up and Shutting Down Daemons.
[ OK ] Started Cleanup udevd DB.
[ OK ] Reached target Switch Root.
[ OK ] Started Plymouth switch root service.
Starting Switch Root...
[FAILED] Failed to start Switch Root.
See 'systemctl status initrd-switch-root.service' for details.問題原因
/boot目錄下缺少核心映像
vmlinuz或者根檔案系統(rootfs)映像initramfs等關鍵開機檔案,導致執行個體系統無法正常啟動。/etc/os-release和/usr/lib/os-release檔案均不存在,導致系統初始化程式
systemd無法正確識別系統所在位置,從而導致執行個體系統無法正常啟動。
說明
以下操作已在Alibaba Cloud Linux 3.2 64位作業系統中進行驗證。其它作業系統操作可能有所差異,具體情況請參閱相應發行版的官方文檔。
方法一
恢複系統硬碟快照。
具體操作,請參見更換系統硬碟後如何通過原系統硬碟快照恢複系統硬碟中的資料。
使用快照復原雲端硬碟。
具體操作,請參見使用快照復原雲端硬碟。
方法二
執行個體已經啟動
在其它同鏡像的執行個體上使用scp或者OSS中轉複製開機檔案到該ECS執行個體中。
執行個體無法啟動
從其它同鏡像的執行個體上複製並恢複開機檔案。
尋找缺少檔案。
建立相同鏡像的ECS執行個體。
具體操作,請參見使用自訂鏡像或共用鏡像建立執行個體。
將異常執行個體的系統硬碟卸載,並記錄磁碟ID。
具體操作,請參見卸載系統硬碟。
將卸載下來的系統硬碟掛載到新的ECS執行個體上。
具體操作,請參見掛載資料盤。
將開機檔案複製到系統中。
將修複後的系統硬碟重新掛載到原執行個體上。