本文最后更新于 291 天前,其中的信息可能已经有所发展或是发生改变。
内容目录
之前重装过 NAS 的系统,重装为 Debian 12,并安装了桌面环境,然后尝试运行之前写好的脚本编译 OpenWrt,然后遇到报错:Install qemu-img to create VDI/VMDK images
:
...
echo '(hd0) /tmp/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.vmdk' > /tmp/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.vmdk.grub2/device.map
/tmp/openwrt/staging_dir/host/bin/grub-bios-setup -m "/tmp/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.vmdk.grub2/device.map" -d "/tmp/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.vmdk.grub2" -r "hd0,msdos1" /tmp/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.vmdk
if command -v qemu-img; then qemu-img convert -f raw -O vmdk /tmp/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.vmdk /tmp/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.vmdk.new; mv /tmp/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.vmdk.new /tmp/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.vmdk; else echo "WARNING: Install qemu-img to create VDI/VMDK images" >&2; exit 1; fi
WARNING: Install qemu-img to create VDI/VMDK images
make[5]: *** [Makefile:158: /tmp/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.vmdk] Error 1
make[5]: Leaving directory '/mnt/core/home/work/openwrt/openwrt/target/linux/x86/image'
make[4]: *** [Makefile:24: install] Error 2
make[4]: Leaving directory '/mnt/core/home/work/openwrt/openwrt/target/linux/x86'
make[3]: *** [Makefile:11: install] Error 2
make[3]: Leaving directory '/mnt/core/home/work/openwrt/openwrt/target/linux'
time: target/linux/install#153.06#27.07#139.58
ERROR: target/linux failed to build.
make[2]: *** [target/Makefile:30: target/linux/install] Error 1
make[2]: Leaving directory '/mnt/core/home/work/openwrt/openwrt'
make[1]: *** [target/Makefile:24: /tmp/openwrt/staging_dir/target-x86_64_musl/stamp/.target_install] Error 2
make[1]: Leaving directory '/mnt/core/home/work/openwrt/openwrt'
make: *** [/mnt/core/home/work/openwrt/openwrt/include/toplevel.mk:232:world] 错误 2
解决方案很简单,搜索你所使用的发行版的安装 qemu-img
安装方法,例如 Debian 12:
sudo apt install qemu-utils