[Linux] 將 Ubuntu 的核心切換成舊版本做測試

[Linux] 將 Ubuntu 的核心切換成舊版本做測試

已經忘了之前是什麼原因,需要降版 Linux Kernel 核心版本,

(比較有可能是需要測試程式在舊版的 Linux 核心跑起來會怎樣)

發現之前有記錄下來,就順便記在網誌上吧~

 

先用  uname -a 看一下目前的核心版本是 4.15.0-112-generic:

# uname -a
Linux test-ubuntu16 4.15.0-112-generic #113~16.04.1-Ubuntu SMP Fri Jul 10 04:37:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

 

在 Ubuntu 上,用 apt 安裝舊版本的 Linux 核心,

像我選的是 4.15.0-66-generic:

apt install linux-image-4.15.0-66-generic linux-headers-4.15.0-66-generic

 

裝好之後,修改 /etc/default/grub,

把  GRUB_HIDDEN_TIMEOUT 的值改一下,

讓 Grub 開機選單有機會看的到:

GRUB_HIDDEN_TIMEOUT=10

 

執行  update-grub 指令來更新 Grub:

# update-grub

Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.15.0-133-generic
Found initrd image: /boot/initrd.img-4.15.0-133-generic
Found linux image: /boot/vmlinuz-4.15.0-112-generic
Found initrd image: /boot/initrd.img-4.15.0-112-generic
Found linux image: /boot/vmlinuz-4.15.0-66-generic
Found initrd image: /boot/initrd.img-4.15.0-66-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done

 

更新完後,就可以重開機,

在開機過程中按下 ESC 鍵跳出 Grub 選單,

選擇我剛安裝好的舊版核心檔案來開機~

 

開完機後,再次用  uname -a 確認一下,

確實是變成舊版的 4.15.0-66-generic 核心囉:

# uname -a

Linux test-ubuntu16 4.15.0-66-generic #75~16.04.1-Ubuntu SMP Tue Oct 1 14:01:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

 

(本頁面已被瀏覽過 597 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料