在 Ubuntu 24.04 上运行 grub2-theme-preview 时出错:缺少 OVMF 映像文件

问题描述 投票:0回答:1

我在 Ubuntu 24.04 上运行 grub2-theme-preview 命令时遇到问题。当我在终端中执行以下命令时:

sudo .venv/bin/grub2-theme-preview . 

我收到此错误消息:

ERROR: [Errno 2] OVMF image file "/usr/share/[..]/OVMF_CODE.fd" is missing, please install package 'edk2-ovmf' or 'ovmf'.

我希望该工具能够正常启动,但它似乎无法找到 OVMF 映像文件。有关该工具的更多详细信息可以在其上找到: https://github.com/hartwork/grub2-theme-preview

采取的步骤:

  1. 我搭建了Python虚拟环境:
    python -m venv .venv
  2. 我使用apt安装了grub2-theme-preview:
    sudo apt install python3-grub2-theme-preview
  3. 我安装了所需的依赖项:
sudo apt install mtools
sudo apt install ovmf

当前包裹状态:

尝试安装 ovmf 时,我收到以下消息,表明它已安装:

sudo apt install ovmf

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ovmf is already the newest version (2024.02-2).
ovmf set to manually installed.
The following packages were automatically installed and are no longer required:
  python3-compose python3-docker python3-dockerpty python3-docopt python3-dotenv python3-texttable python3-websocket
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

额外的努力:

我尝试搜索 OVMF_CODE.fd 文件,但没有成功:

sudo find / -name 'OVMF_CODE.fd'
但是没有找到。

我还参考了这个文档,其中讨论了 openSUSE 上的类似问题,但找不到 Ubuntu 的相关解决方案。 https://powersnail.com/2022/grub2-theme-preview-opensuse/

请求帮助:

有人对我如何解决这个问题有建议吗?任何帮助将不胜感激!

python linux ubuntu grub
1个回答
0
投票

尝试以下几件事:

  1. 验证 OVMF 包

    dpkg -L ovmf
    此命令应列出 ovmf 软件包安装的所有文件。查找 OVMF_CODE.fd 和 OVMF_VARS.fd。

  2. 使用 github tianocore 中的 OVMF 手动安装它

    sudo apt-get install git
    然后
    git clone https://github.com/tianocore/edk2.git
    然后转到 OVMF 文件所在的位置(如果找不到)执行此操作
    cd edk2
    find . -name "OVMF_CODE.fd" -o -name "OVMF_VARS.fd"
    找到副本后
    sudo cp /path/to/OVMF_CODE.fd /path/to/OVMF_VARS.fd /usr/share/edk2.git/ovmf-x86_64/

  3. 现在检查环境变量

    echo $GRUB2_THEME_PREVIEW_UEFI_VARS
    ,如果未设置,请执行
    export GRUB2_THEME_PREVIEW_UEFI_VARS=/usr/share/edk2.git/ovmf-x86_64/

  4. 或者只是重新启动并重新安装

    sudo apt-get update
    sudo apt-get --reinstall install ovmf

我希望这有帮助! :D

© www.soinside.com 2019 - 2024. All rights reserved.