ubuntu24.04虚拟机系统中挂载rootfs.img到rootfs_dir目录,使用chroot切换根目录到roofs_dir报错

报错信息:chroot:failed to run command "/bin/bash":Exec format error

解决:

安装qemu-user-static,qemu-user-static 是 ‌QEMU 用户模式仿真(User Mode Emulation)的静态链接版本‌,主要用于在一种 CPU 架构的系统中,直接运行另一种 CPU 架构的二进制程序(如 x86_64 主机上运行 ARM 程序)。

sudo apt update

sudo apt install qemu-user-static

之后,切至rootfs_dir目录下,执行:sudo chroot . 即可将根目录切至rootfs_dir目录下。这个可用于对rootfs.img进行修改,比如安装应用软件等,chroot切换根目录后可直接在rootfs_dir目录下通过执行apt install进行安装。

相关推荐
orion571 天前
Missing Semester Class1:course overview and introduction of shell
linux
用户120487221612 天前
Linux驱动编译与加载
linux·嵌入式
用户805533698032 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698032 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房2 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia3 天前
linux curl命令详解_curl详解
linux
扛枪的书生4 天前
Linux 网络管理器用法速查
linux
顺风尿一寸4 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode4 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫4 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux