You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Debian11(Bullseye)升级到Debian12(Bookworm)时initramfs-tools升级失败,报错“E: /usr/share/initramfs-tools/hooks/growroot failed”

Debian11(Bullseye)升级到Debian12(Bookworm)时initramfs-tools升级失败,报错“E: /usr/share/initramfs-tools/hooks/growroot failed”

兄弟我之前在DigitalOcean上升级Debian的时候也踩过这个坑,growroot这个钩子脚本就是搞事情的元凶,别慌,咱们一步步来搞定它:

首先,先搞清楚到底是哪里出问题——直接手动运行这个钩子脚本,看看具体的错误提示:

/usr/share/initramfs-tools/hooks/growroot

这会帮你定位到底是缺依赖、脚本逻辑错了还是其他问题。

下面是几个实测有效的解决方法,按顺序试就行:

  • 先补全必要依赖
    DigitalOcean的growroot脚本依赖cloud-guest-utils和gdisk这些工具,升级到Bookworm后可能这些包没自动装上,先补装:

    apt install cloud-guest-utils gdisk
    

    装完之后重新配置卡住的包:

    dpkg --configure -a
    

    很多时候这一步就直接解决问题了。

  • 临时禁用growroot钩子(应急方案)
    如果补依赖没用,那大概率是脚本本身和Bookworm不兼容,咱们先把它移走,让initramfs能正常生成:

    mv /usr/share/initramfs-tools/hooks/growroot /usr/share/initramfs-tools/hooks/growroot.bak
    

    然后手动生成对应内核的initramfs:

    update-initramfs -u -k 6.1.0-28-amd64
    

    生成成功后再重新配置所有未完成的包:

    dpkg --configure -a
    

    等系统升级完,你可以再把备份的growroot脚本恢复,或者更新DigitalOcean的官方工具(比如do-agent)来修复这个脚本。

  • 检查cloud-init状态
    DigitalOcean的磁盘扩容依赖cloud-init,要是cloud-init出问题也会导致growroot失败,先看看它的状态:

    cloud-init status
    

    如果显示异常,重新安装cloud-init试试:

    apt reinstall cloud-init
    

    重启服务后再重新配置包:

    systemctl restart cloud-init
    dpkg --configure -a
    
  • 手动修复growroot脚本
    要是上面都没用,那就得自己改脚本了。先打开脚本看看内容:

    nano /usr/share/initramfs-tools/hooks/growroot
    

    根据之前手动运行脚本得到的错误提示修改,比如Debian12里某些命令的路径变了、参数改了,调整完保存后,再重新生成initramfs就行。

备注:内容来源于stack exchange,提问作者balleyne

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 11:07:59