Open
【openEuler-22.03-LTS】20-grub.install脚本删除initrd失败 #21
AtomGit-BotAdd on  Aug 8, 2024
A
AtomGit-Bot
Aug 8, 2024 Create

Linux主线内核当前spec中已经移除了installkernel,改用kernel-install命令

[root@localhost aarch64]# cat /etc/os-release
NAME="openEuler"
VERSION="22.03 (LTS-SP2)"
ID="openEuler"
VERSION_ID="22.03"
PRETTY_NAME="openEuler 22.03 (LTS-SP2)"
ANSI_COLOR="0;31"
[root@localhost aarch64]# rpm -qa | grep grub
grub2-common-2.06-28.oe2203sp2.noarch
grub2-tools-minimal-2.06-28.oe2203sp2.aarch64
grub2-tools-2.06-28.oe2203sp2.aarch64
grub2-tools-extra-2.06-28.oe2203sp2.aarch64
grubby-8.40-31.oe2203sp2.aarch64
grub2-efi-aa64-2.06-28.oe2203sp2.aarch64
[root@localhost aarch64]# rpm -qf /usr/lib/kernel/install.d/20-grub.install
grub2-common-2.06-28.oe2203sp2.noarch

为了安装主线内核,手动拷贝了kernel-install脚本到机器中。现发现如下问题:
卸载内核时,initramfs-6.11.0-rc1-vanilla-LSE+.img文件系统并没有卸载。
下面是定位过程:
kernel-install遍历系统中install命令,最后选择了/usr/lib/kernel/install.d/20-grub.install执行
在20-grub.install中文件系统生成命令:

/sbin/new-kernel-pkg --package "kernel${flavor}" --mkinitrd --dracut --depmod --update "$KERNEL_VERSION" || exit $?

文件系统卸载命令:

/sbin/new-kernel-pkg --package "kernel${flavor+-$flavor}" --rminitrd --rmmoddep --remove "$KERNEL_VERSION" || exit $?

生成命令包含了--dracut参数,而卸载命令没有;该参数影响了/sbin/new-kernel-pkg中INITRD_NAME_PREFIX参数的值。

[root@localhost aarch64]# grep -C 2 INITRD_NAME_PREFIX /sbin/new-kernel-pkg
# set the initrd file based on arch; ia64 is the only currently known oddball
if [ -z "$initrdfile" ]; then
    INITRD_NAME_PREFIX="initrd"
    if [ -n "$dracut" ]; then
        INITRD_NAME_PREFIX="initramfs"
    fi

    if [ `uname -m` = "ia64" ]; then
        initrdfile="/boot/efi/EFI/redhat/$INITRD_NAME_PREFIX-$version.img"
    else
        initrdfile="/boot/$INITRD_NAME_PREFIX-$version.img"
    fi

所以通过/usr/lib/kernel/install.d/20-grub.install调用/sbin/new-kernel-pkg时,生成的文件系统是initramfs-6.11.0-rc1-vanilla-LSE+.img;而卸载时目标却是initrd-6.11.0-rc1-vanilla-LSE+.img,这很明显是异常的。

likedislike
AAtomGit-Bot
Aug 8, 2024 创建了缺陷
openeuler-ci-bot
openeuler-ci-botCollaborators
Aug 8, 2024 Comments:

Hi liujie-248683921, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: sig-OS-Builder, and any of the maintainers: @t_feng , @yanan-rock , @openeuler-basic , @overweight , @anonymous_z , @compile_success , @zhangqiumiao , @zhuchunyi

likedislike
openeuler-ci-botopeneuler-ci-botCollaborators
Aug 8, 2024 添加了   sig/sig-OS-Builder 标签
AAtomGit-Bot
Aug 8, 2024 修改了描述
AAtomGit-Bot
Aug 8, 2024 修改了描述
AAtomGit-Bot
Aug 8, 2024 修改了描述
AAtomGit-Bot
Aug 8, 2024 修改了描述
AAtomGit-Bot
Aug 8, 2024 修改了描述
AAtomGit-Bot
Aug 8, 2024 修改了描述
AAtomGit-Bot
Aug 8, 2024 修改了描述
zhangqiumiao
zhangqiumiaoCollaborators
Aug 19, 2024 Comments:

openEuler-22.03-LTS-SP2的内核是5.10版本,无适配6.x内核的相关计划,请勿在22.03-SP2中使用高版本内核。

likedislike
A
AtomGit-Bot
Aug 29, 2024 Comments:

openEuler-22.03-LTS-SP2的内核是5.10版本,无适配6.x内核的相关计划,请勿在22.03-SP2中使用高版本内核。

@zhangqiumiao 就算不适配高版本内核 这个工具,我提到的地方也是有问题的。--dracut这个参数不应该只有生成内核才添加,卸载内核时也应该添加

likedislike
zhangqiumiao
zhangqiumiaoCollaborators
Sep 9, 2024 Comments:

openEuler-22.03-LTS-SP2的内核是5.10版本,无适配6.x内核的相关计划,请勿在22.03-SP2中使用高版本内核。

@zhangqiumiao 就算不适配高版本内核 这个工具,我提到的地方也是有问题的。--dracut这个参数不应该只有生成内核才添加,卸载内核时也应该添加

Patch welcome.

likedislike
zhangqiumiaozhangqiumiaoCollaborators
Sep 18, 2024 将任务状态从 待办的 修改为已挂起