小发现:Ubuntu使用kexec重启系统

kexec使用Unix系统调用exec()的覆盖哲理,它产生一个新的内核覆盖正在运行的内核。这个过程不用启动机器上的固件(firmware),所以可以节省一些重启时间。

因为启动固件需要走查总线和标识设备,节省了这些时间就会加速系统的启动。

知道了这些就解决一下我的系统不能重启的问题吧,如图: 

小发现:Ubuntu使用kexec重启系统


怎么会启动不了呢?

1.grep一下/etc目录

apple@Ubuntu:~$ sudo grep -r kexec /etc
grep: /etc/alternatives/smbstatus.1.gz: No such file or directory
/etc/rc6.d/K18kexec-load:# Provides:            kexec-load
/etc/rc6.d/K18kexec-load:# Required-Stop:       $remote_fs kexec
/etc/rc6.d/K18kexec-load:# Short-Description: Load kernel image with kexec
/etc/rc6.d/K18kexec-load:test -r /etc/default/kexec && . /etc/default/kexec
/etc/rc6.d/K18kexec-load:       test -x /sbin/kexec || exit 0
/etc/rc6.d/K18kexec-load:       test "x`cat /sys/kernel/kexec_loaded`y" = "x1y" && exit 0
/etc/rc6.d/K18kexec-load:               kexec -l "$KERNEL_IMAGE" --append="$REAL_APPEND"
/etc/rc6.d/K18kexec-load:               kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$REAL_APPEND"
/etc/rc6.d/S85kexec:# Provides:         kexec
/etc/rc6.d/S85kexec:# Short-Description: Execute the kexec -e command to reboot system
/etc/rc6.d/S85kexec:test -r /etc/default/kexec && . /etc/default/kexec
/etc/rc6.d/S85kexec:    test "x`cat /sys/kernel/kexec_loaded`y" = "x1y" || exit 0
/etc/rc6.d/S85kexec:    test -x /sbin/kexec || exit 0
/etc/rc6.d/S85kexec:    log_action_msg "Will now restart with kexec"
/etc/rc6.d/S85kexec:        kexec -e
/etc/rc6.d/S85kexec:        log_failure_msg "kexec failed"
/etc/rc6.d/S60umountroot:# Should-Stop:       halt reboot kexec
/etc/init.d/kexec-load:# Provides:              kexec-load
/etc/init.d/kexec-load:# Required-Stop: $remote_fs kexec
/etc/init.d/kexec-load:# Short-Description: Load kernel image with kexec
/etc/init.d/kexec-load:test -r /etc/default/kexec && . /etc/default/kexec
/etc/init.d/kexec-load: test -x /sbin/kexec || exit 0
/etc/init.d/kexec-load: test "x`cat /sys/kernel/kexec_loaded`y" = "x1y" && exit 0
/etc/init.d/kexec-load:         kexec -l "$KERNEL_IMAGE" --append="$REAL_APPEND"
/etc/init.d/kexec-load:         kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$REAL_APPEND"
/etc/init.d/kexec:# Provides:           kexec
/etc/init.d/kexec:# Short-Description: Execute the kexec -e command to reboot system
/etc/init.d/kexec:test -r /etc/default/kexec && . /etc/default/kexec
/etc/init.d/kexec:      test "x`cat /sys/kernel/kexec_loaded`y" = "x1y" || exit 0
/etc/init.d/kexec:      test -x /sbin/kexec || exit 0
/etc/init.d/kexec:      log_action_msg "Will now restart with kexec"
/etc/init.d/kexec:        kexec -e
/etc/init.d/kexec:        log_failure_msg "kexec failed"
/etc/init.d/umountroot:# Should-Stop:       halt reboot kexec
/etc/init.d/kdump:# Short-Description: Load crashkernel image with kexec
/etc/init.d/kdump:      test -x /sbin/kexec || exit 0
/etc/init.d/kdump:      kexec -p "$KERNEL_IMAGE" --initrd="$INITRD" --append="$APPEND"
/etc/rc2.d/S00kdump:# Short-Description: Load crashkernel image with kexec
/etc/rc2.d/S00kdump:    test -x /sbin/kexec || exit 0
/etc/rc2.d/S00kdump:    kexec -p "$KERNEL_IMAGE" --initrd="$INITRD" --append="$APPEND"
/etc/default/kexec:# Defaults for kexec initscript
/etc/default/kexec:# sourced by /etc/init.d/kexec and /etc/init.d/kexec-load
/etc/default/kexec:# Load a kexec kernel (true/false)
/etc/rc0.d/S60umountroot:# Should-Stop:       halt reboot kexec
apple@ubuntu:~$

看来系统重启需要借用/etc/init.d/kexec这个脚本

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/27718.html