在AWS (ec2)上使用Ubuntu20.04,我希望将内核从AWS更改为通用内核。当我试着用建议的方式改变Grub时,它就停止了机器。
这是因为Jibri (Jitsi视频记录器)要求使用ALSA并对snd进行调制,但是任何想要低延迟或不同内核的内核都有相同的需求--想要使用与AWS内核不同的内核。
抓取图像:
sudo apt install linux-image-extra-virtual
您将看到它引用了类似Linux5.4.0-84之类的内容--在安装包中是通用的,稍后会有所帮助。现在,列出新的通用内核的引导条目。
grep -A200 submenu /boot/grub/grub.cfg |grep -P '^(?=.*menuentry)(?=.*generic)'
我看到:
菜单条目' ubuntu,with Linux5.4.0-84-泛型‘--类Ubuntu--类gnu-linux -class gnu -class os 'gnulinux-5.4.0-84-generic-advanced-e8070c31-bfee-4314-a151-d1332dc23486’{ menuentry 'Ubuntu,使用Linux5.4.0-84-泛型(恢复模式)‘--类ubuntu --类gnu-linux -class gnu -class os $menuentry_id_option $menuentry_id_option{
在最可能的行中,而不是提到恢复模式的行中,在行的开头复制它的菜单条目。在我的网站上,看起来像Ubuntu,Linux5.4.0-84是通用的,但每个人都不一样。
现在,我将编辑/etc/默认/grub,
注释掉GRUB_DEFAULT=0 (加载grub引导列表中的第一个条目),并将其更改为我们前面找到的字符串。对我来说,该文件的这一部分现在看起来如下:
#GRUB_DEFAULT=0
GRUB_DEFAULT="Ubuntu, with Linux 5.4.0-84-generic"这还不是一个正确的设置--我们使用它来让grub检查并告诉我们最佳的方法。
在这一点上,我们可以做更新-grub,这将给我这样一个友好的警告(这很好!)
Warning: Please don't use old title `Ubuntu, with Linux 5.4.0-84-generic' for GRUB_DEFAULT, use `Advanced options for Ubuntu>Ubuntu, with Linux 5.4.0-84-generic' (for versions before 2.00) or `gnulinux-advanced-e8070c31-bfee-4314-a151-d1332dc23486>gnulinux-5.4.0-84-generic-advanced-e8070c31-bfee-4314-a151-d1332dc23486' (for 2.00 or later)再说一遍,这很好!我们知道我们已经指明了它能识别的东西。现在每个人运行的grub都比2.00更新,所以我们现在再次编辑/etc/default/grub,并将其更改为它的最终值:
(我的价值观和你的不一样)
#GRUB_DEFAULT=0
#GRUB_DEFAULT="Ubuntu, with Linux 5.4.0-84-generic"
GRUB_DEFAULT="gnulinux-advanced-e8070c31-bfee-4314-a151-d1332dc23486>gnulinux-5.4.0-84-generic-advanced-e8070c31-bfee-4314-a151-d1332dc23486"数独更新-grub,我看到警告现在消失了。
现在我做sudo reboot now
此时,grub给了我一个配置,它应该尝试引导通用内核,回到正常的内核。
相反,它被卡在一个引导循环中。
在串行控制台中,我在它的引导循环中多次看到这一点。
[ 0.000000] Linux version 5.4.0-84-generic (buildd@lgw01-amd64-050) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021
(Ubuntu 5.4.0-84.94-generic 5.4.133)
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.0-84-generic root=PARTUUID=5198cbc0-01 ro console=tty1 console=ttyS0 nvme_core.io_timeout=4294967295 panic=-
1
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Hygon HygonGenuine
[ 0.000000] Centaur CentaurHauls
[ 0.000000] zhaoxin Shanghai
... lots of cpu init that's hard to copy ..
[ 10.366218] rtc_cmos 00:00: setting system clock to 2021-09-21T11:25:30 UTC (1632223530)
[ 10.373185] md: Waiting for all devices to be available before autodetect
[ 10.460173] md: If you don't use raid, use raid=noautodetect
[ 10.464642] md: Autodetecting RAID arrays.
[ 10.468024] md: autorun ...
[ 10.470867] md: ... autorun DONE.
[ 10.473906] VFS: Cannot open root device "PARTUUID=5198cbc0-01" or unknown-block(0,0): error -6
[ 10.562806] Please append a correct "root=" boot option; here are the available partitions:
[ 10.569825] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 10.674637] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.4.0-84-generic #94-Ubuntu
[ 10.682527] Hardware name: Amazon EC2 t3.small/, BIOS 1.0 10/16/2017
[ 10.686735] Call Trace:
[ 10.691100] dump_stack+0x6d/0x8b
[ 10.759061] panic+0x101/0x2e3
[ 10.761974] mount_block_root+0x23f/0x2e8
[ 10.765568] mount_root+0x38/0x3a
[ 10.768584] prepare_namespace+0x13f/0x194
[ 10.771873] kernel_init_freeable+0x23f/0x263
[ 10.775368] ? rest_init+0xb0/0xb0
[ 10.859141] kernel_init+0xe/0x110
[ 10.862101] ret_from_fork+0x35/0x40
[ 10.865843] Kernel Offset: 0x36a00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)它告诉我,它找不到引导设备或根据它的partuuid。此时,我几乎不得不终止实例,然后再试一次,因为我无法轻松地恢复它。
是否有更好的方法将我的内核更改为通用内核?我很乐意在这个时候使用通用映像,如果它启动的话。
发布于 2022-03-01 09:01:04
如日志跟踪中所述:
FS: Cannot open root device "PARTUUID=5198cbc0-01" or unknown-block(0,0): error -6
[ 10.562806] Please append a correct "root=" boot option; here are the available partitions:
[ 10.569825] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)问题主要在于强制PARTUUID设置在/etc/default/grub.d/40-force-partuuid.cfg中。
解决办法是:
linux-generic内核(最新版本为sudo apt install linux-generic)。您可以使用命令linux-version list检查可用的内容。GRUB_DEFAULT="1>2"或相应地更改为grub.cfg菜单顺序列表。("1>2")解释:第一个是“高级Ubuntu”(从零开始的第二个菜单条目),第二个是“”中的第三个子菜单选项(从零开始),这是应该在我的示例中使用的通用内核。
GRUB_FORCE_PARTUUID中注释/etc/default/grub.d/40-force-partuuid.cfg行sudo update-grub && sudo update-grub2Reboothttps://askubuntu.com/questions/1365369
复制相似问题