登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
AI 队友
登录
注册
Gitee 2025 年度开源项目评选中
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
9
Star
2
Fork
107
src-openEuler
/
grub2
代码
Issues
2
Pull Requests
1
Wiki
统计
流水线
服务
JavaDoc
PHPDoc
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
【openEuler-22.03-LTS】20-grub.install脚本删除initrd失败
已挂起
#IAIRIQ
缺陷
刘杰
创建于
2024-08-08 16:20
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,这很明显是异常的。
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,这很明显是异常的。
评论 (
4
)
登录
后才可以发表评论
状态
已挂起
待办的
已挂起
修复中
已确认
已完成
已验收
已取消
负责人
未设置
标签
sig/sig-OS-Builder
未设置
项目
未立项任务
未立项任务
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (30)
标签 (41)
master
openEuler-20.03-LTS-SP4
openEuler-22.03-LTS-SP3
openEuler-24.03-LTS
openEuler-24.03-LTS-SP3
openEuler-24.03-LTS-SP2
openEuler-24.03-LTS-SP1
openEuler-24.03-LTS-Next
openEuler-22.03-LTS-SP4
openEuler-25.09
openEuler-22.03-LTS-SP1
openEuler-25.03
openEuler-24.09
openEuler-22.03-LTS-Next
openEuler-20.03-LTS-SP1
openEuler-22.03-LTS
openEuler-22.03-LTS-SP2
openEuler-20.03-LTS-SP3
openEuler-23.09
openEuler-23.03
openEuler-22.03-LTS-LoongArch
openEuler-22.09
openEuler-20.03-LTS-SP2
openEuler-20.03-LTS-Next
openEuler-21.09
openEuler-20.03-LTS
openEuler-21.03
openEuler-20.09
openEuler1.0
openEuler1.0-base
openEuler-25.09-release
openEuler-24.03-LTS-update-20250627
openEuler-24.03-LTS-SP2-release
openEuler-24.03-LTS-update-20250425
openEuler-22.03-LTS-SP3-update-20250425
openEuler-24.03-LTS-SP1-update-20250425
openEuler-24.03-LTS-SP1-update-20250428
openEuler-22.03-LTS-SP4-update-20250425
openEuler-20.03-LTS-SP4-update-20250425
openEuler-25.03-release
openEuler-22.03-LTS-SP3-update-20250307
openEuler-22.03-LTS-SP4-update-20250307
openEuler-24.03-LTS-update-20250228
openEuler-24.03-LTS-SP1-update-20250228
openEuler-20.03-LTS-SP4-update-20250228
openEuler-24.03-LTS-SP1-release
openEuler-24.03-LTS-update-20241227
openEuler-22.03-LTS-SP1-update-20241227
openEuler-22.03-LTS-SP3-update-20241227
openEuler-22.03-LTS-SP4-update-20241227
openEuler-24.03-LTS-update-20241108
openEuler-22.03-LTS-SP4-release
openEuler-24.09-release
openEuler-24.03-LTS-release
openEuler-22.03-LTS-SP3-release
openEuler-23.09-rc5
openEuler-22.03-LTS-SP1-release
openEuler-22.09-release
openEuler-22.09-rc5
openEuler-22.09-20220829
openEuler-22.03-LTS-20220331
openEuler-22.03-LTS-round5
openEuler-22.03-LTS-round3
openEuler-22.03-LTS-round2
openEuler-22.03-LTS-round1
openEuler-20.03-LTS-SP3-release
openEuler-20.03-LTS-SP2-20210624
openEuler-21.03-20210330
openEuler-20.09-20200929
openEuler-20.03-LTS-20200606
openEuler-20.03-LTS-tag
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
预计工期
(小时)
参与者(1)
1
https://gitee.com/src-openeuler/grub2.git
git@gitee.com:src-openeuler/grub2.git
src-openeuler
grub2
grub2
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册