20200112更新
卸载旧内核那一步是有问题的,警告信息表示正在卸载当前使用的内核。之前一直没问题是因为在卸载内核前安装了其他的内核,所以重启后会去自动使用另外的内核。
另外一种更换选择启动内核的方法如下,感觉更安全…参考:
安装内核
此步骤与之前一样
dpkg -i linux-image-3.16.0-4*.deb
查看当前内核的启动顺序
cat /boot/grub/grub.cfg
回显会显示当前grub.cfg
的配置
# # DO NOT EDIT THIS FILE # # It is automatically generated by grub-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub # ### BEGIN /etc/grub.d/00_header ### if [ -s $prefix/grubenv ]; then set have_grubenv=true load_env fi if [ "${next_entry}" ] ; then set default="${next_entry}" set next_entry= save_env next_entry set boot_once=true else set default="0" fi if [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" else menuentry_id_option="" fi export menuentry_id_option if [ "${prev_saved_entry}" ]; then set saved_entry="${prev_saved_entry}" save_env saved_entry set prev_saved_entry= save_env prev_saved_entry set boot_once=true fi function savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi } function load_video { if [ x$feature_all_video_module = xy ]; then insmod all_video else insmod efi_gop insmod efi_uga insmod ieee1275_fb insmod vbe insmod vga insmod video_bochs insmod video_cirrus fi } if [ x$feature_default_font_path = xy ] ; then font=unicode else insmod part_msdos insmod ext2 set root='hd0,msdos1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 833770f7-7a64-497d-8241-b6c609c4b16e else search --no-floppy --fs-uuid --set=root 833770f7-7a64-497d-8241-b6c609c4b16e fi font="/usr/share/grub/unicode.pf2" fi if loadfont $font ; then set gfxmode=auto load_video insmod gfxterm set locale_dir=$prefix/locale set lang=en_US insmod gettext fi terminal_output gfxterm if [ "${recordfail}" = 1 ] ; then set timeout=-1 else if [ x$feature_timeout_style = xy ] ; then set timeout_style=menu set timeout=5 # Fallback normal timeout code in case the timeout_style feature is # unavailable. else set timeout=5 fi fi ### END /etc/grub.d/00_header ### ### BEGIN /etc/grub.d/05_debian_theme ### set menu_color_normal=cyan/blue set menu_color_highlight=white/blue ### END /etc/grub.d/05_debian_theme ### ### BEGIN /etc/grub.d/10_linux ### function gfxmode { set gfxpayload="${1}" } set linux_gfx_mode= export linux_gfx_mode menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-833770f7-7a64-497d-8241-b6c609c4b16e' { load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 833770f7-7a64-497d-8241-b6c609c4b16e else search --no-floppy --fs-uuid --set=root 833770f7-7a64-497d-8241-b6c609c4b16e fi echo 'Loading Linux 3.16.0-6-amd64 ...' linux /boot/vmlinuz-3.16.0-6-amd64 root=UUID=833770f7-7a64-497d-8241-b6c609c4b16e ro quiet echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-3.16.0-6-amd64 } submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-833770f7-7a64-497d-8241-b6c609c4b16e' { menuentry 'Debian GNU/Linux, with Linux 3.16.0-6-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-6-amd64-advanced-833770f7-7a64-497d-8241-b6c609c4b16e' { load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 833770f7-7a64-497d-8241-b6c609c4b16e else search --no-floppy --fs-uuid --set=root 833770f7-7a64-497d-8241-b6c609c4b16e fi echo 'Loading Linux 3.16.0-6-amd64 ...' linux /boot/vmlinuz-3.16.0-6-amd64 root=UUID=833770f7-7a64-497d-8241-b6c609c4b16e ro quiet echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-3.16.0-6-amd64 } menuentry 'Debian GNU/Linux, with Linux 3.16.0-6-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-6-amd64-recovery-833770f7-7a64-497d-8241-b6c609c4b16e' { load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 833770f7-7a64-497d-8241-b6c609c4b16e else search --no-floppy --fs-uuid --set=root 833770f7-7a64-497d-8241-b6c609c4b16e fi echo 'Loading Linux 3.16.0-6-amd64 ...' linux /boot/vmlinuz-3.16.0-6-amd64 root=UUID=833770f7-7a64-497d-8241-b6c609c4b16e ro single echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-3.16.0-6-amd64 } menuentry 'Debian GNU/Linux, with Linux 3.16.0-4-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-4-amd64-advanced-833770f7-7a64-497d-8241-b6c609c4b16e' { load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 833770f7-7a64-497d-8241-b6c609c4b16e else search --no-floppy --fs-uuid --set=root 833770f7-7a64-497d-8241-b6c609c4b16e fi echo 'Loading Linux 3.16.0-4-amd64 ...' linux /boot/vmlinuz-3.16.0-4-amd64 root=UUID=833770f7-7a64-497d-8241-b6c609c4b16e ro quiet echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-3.16.0-4-amd64 } menuentry 'Debian GNU/Linux, with Linux 3.16.0-4-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-4-amd64-recovery-833770f7-7a64-497d-8241-b6c609c4b16e' { load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 833770f7-7a64-497d-8241-b6c609c4b16e else search --no-floppy --fs-uuid --set=root 833770f7-7a64-497d-8241-b6c609c4b16e fi echo 'Loading Linux 3.16.0-4-amd64 ...' linux /boot/vmlinuz-3.16.0-4-amd64 root=UUID=833770f7-7a64-497d-8241-b6c609c4b16e ro single echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-3.16.0-4-amd64 } } ### END /etc/grub.d/10_linux ### ### BEGIN /etc/grub.d/20_linux_xen ### ### END /etc/grub.d/20_linux_xen ### ### BEGIN /etc/grub.d/30_os-prober ### ### END /etc/grub.d/30_os-prober ### ### BEGIN /etc/grub.d/30_uefi-firmware ### ### END /etc/grub.d/30_uefi-firmware ### ### BEGIN /etc/grub.d/40_custom ### # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. ### END /etc/grub.d/40_custom ### ### BEGIN /etc/grub.d/41_custom ### if [ -f ${config_directory}/custom.cfg ]; then source ${config_directory}/custom.cfg elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then source $prefix/custom.cfg; fi ### END /etc/grub.d/41_custom ###
其中的submenu那一部分为二级菜单,在下面的缩进内可以看到当前安装的两个内核。实际上二级菜单那里也是通过字符串拼接而成的,后面带的是变量$menuentry_id_option
记录下二级菜单前面的字符串Advanced options for Debian GNU/Linux
和后面自己想要手动指定启动的内核名称Debian GNU/Linux, with Linux 3.16.0-4-amd64
修改grub文件
修改/etc/default/grub中的GRUB_DEFAULT=0部分,改为
GRUB_DEFAULT="Advanced options for Debian GNU/Linux>Debian GNU/Linux, with Linux 3.16.0-4-amd64"
更新引导
注释表示#If you change this file, run ‘update-grub’ afterwards to update
update-grub
相关文章:Centos 7更换内核以支持锐速
参考:
https://stillso.com/4.html
https://touko.moe/blog/fast-change-kernel-in-deb
PS:更新锐速许可证
1.更新许可证(有效期为6个月)
wget -qO '/appex/etc/apx.lic' "https://api.moeclub.org/lotServer?ver=1&mac=00:00:00:00:00:00"
使用 ifconfig 查看网卡 mac 地址,替换 00:00:00:00:00:00 (当内核版本号小于等于 3.11.20.10 时, 请设置 ver=0)
参考:
https://www.zhangfangzhou.cn/2019/04/22
https://www.hostloc.com/thread-541194-1-1.html
下载3.16.0.4-deb内核
根据文档得知锐速支持3.16.0.4内核
wget http://security-cdn.debian.org/pool/updates/main/l/linux/linux-image-3.16.0-4-amd64_3.16.43-2+deb8u5_amd64.deb
由于官方已经停止Debian8的支持,遂将内核下载地址换为镜像
wget https://debian.sipwise.com/debian-security/pool/main/l/linux/linux-image-3.16.0-4-amd64_3.16.43-2+deb8u5_amd64.deb
安装内核
dpkg -i linux-image-3.16.0-4*.deb
查看已安装的内核
dpkg -l|grep linux-image
删除旧内核
apt-get purge 旧内核的名字
注:这一步会跳出询问是否跳过卸载内核,当然是不跳过。卸载所有多余内核,只保留用的。
更新引导
update-grub
重启即可