问题现象:
升级内核后,重启虚拟机,虚拟机无法重启成功。报错显示:
[ 3.826251] Freeing unused kernel memory: 1984k freed
[ 3.828798] Write protecting the kernel read-only data: 12288k
[ 3.832157] Freeing unused kernel memory: 424k freed
[ 3.836805] Freeing unused kernel memory: 556k freed
[ 3.838921] Failed to execute /init
[ 3.841699] Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[ 3.848648] CPU: 5 PID: 1 Comm: swapper/0 Not tainted 3.10.0-1062.4.1.el7.x86_64 #1
[ 3.853159] Hardware name: OpenStack Foundation OpenStack Nova, BIOS 1.11.0-2.el7 04/01/2014
[ 3.857530] Call Trace:
[ 3.859070] [<ffffffffb5f78ba4>] dump_stack+0x19/0x1b
[ 3.861623] [<ffffffffb5f72947>] panic+0xe8/0x21f
[ 3.863758] [<ffffffffb5f67b60>] ? rest_init+0x80/0x80
[ 3.867169] [<ffffffffb5f67c56>] kernel_init+0xf6/0x100
[ 3.869291] [<ffffffffb5f8bd37>] ret_from_fork_nospec_begin+0x21/0x21
[ 3.871795] [<ffffffffb5f67b60>] ? rest_init+0x80/0x80
[ 3.874686] Kernel Offset: 0x34800000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 3.879078] ------------[ cut here ]------------
[ 3.881028] WARNING: CPU: 5 PID: 1 at arch/x86/kernel/smp.c:127 native_smp_send_reschedule+0x65/0x70
[ 3.884761] Modules linked in:
[ 3.886724] CPU: 5 PID: 1 Comm: swapper/0 Not tainted 3.10.0-1062.4.1.el7.x86_64 #1
[ 3.890840] Hardware name: OpenStack Foundation OpenStack Nova, BIOS 1.11.0-2.el7 04/01/2014
[ 3.895011] Call Trace:
[ 3.897809] <IRQ> [<ffffffffb5f78ba4>] dump_stack+0x19/0x1b
[ 3.900348] [<ffffffffb589a958>] __warn+0xd8/0x100
[ 3.902492] [<ffffffffb589aa9d>] warn_slowpath_null+0x1d/0x20
[ 3.904771] [<ffffffffb5858bf5>] native_smp_send_reschedule+0x65/0x70
[ 3.907228] [<ffffffffb58e9035>] trigger_load_balance+0x155/0x240
[ 3.909518] [<ffffffffb58d822a>] scheduler_tick+0x10a/0x150
[ 3.911674] [<ffffffffb590e6b0>] ? tick_sched_do_timer+0x50/0x50
[ 3.913992] [<ffffffffb58ae515>] update_process_times+0x65/0x80
[ 3.916085] [<ffffffffb590e420>] tick_sched_handle+0x30/0x70
[ 3.918009] [<ffffffffb590e6e9>] tick_sched_timer+0x39/0x80
[ 3.919958] [<ffffffffb58c95ae>] __hrtimer_run_queues+0x10e/0x270
[ 3.922050] [<ffffffffb58c9b0f>] hrtimer_interrupt+0xaf/0x1d0
[ 3.923987] [<ffffffffb585c2cb>] local_apic_timer_interrupt+0x3b/0x60
[ 3.926092] [<ffffffffb5f909d3>] smp_apic_timer_interrupt+0x43/0x60
[ 3.929510] [<ffffffffb5f67b00>] ? rest_init+0x20/0x80
[ 3.931280] [<ffffffffb5f8cefa>] apic_timer_interrupt+0x16a/0x170
[ 3.933293] <EOI> [<ffffffffb5f72a37>] ? panic+0x1d8/0x21f
[ 3.935323] [<ffffffffb5f72998>] ? panic+0x139/0x21f
[ 3.937051] [<ffffffffb5f67b60>] ? rest_init+0x80/0x80
[ 3.938821] [<ffffffffb5f67c56>] kernel_init+0xf6/0x100
[ 3.940620] [<ffffffffb5f8bd37>] ret_from_fork_nospec_begin+0x21/0x21
[ 3.942728] [<ffffffffb5f67b60>] ? rest_init+0x80/0x80
解决方案:
- 找一台带图形化界面主机CentOS7.
- 安装virt-manager组件
- 修改openstack宿主机,可通过密码登录
参数为:
PermitRootLogin without-password改为yes
PasswordAuthentication no改为yes
记住修改过的root密码
- 通过virt-manager连接至openstack宿主机,找到报错主机。
- 硬重启虚拟机的瞬间,打开console界面,按e或上下键。
- 调整启动CentOS的kernel,使用老一版的内核启动。再次确定虚拟机是否为关闭状态。否则导致虚拟机关闭。
- 虚拟机正常后,设置内核启动顺序。老版本。
Grub2-editenv list 查看当前版本
grub2-set-default "CentOS Linux (3.10.0-957.27.2.el7.x86_64) 7 (Core)"
- 在试着重启虚拟机,检测虚拟机是否恢复正常。