简体   繁体   English

用qemu运行alpine Linux

[英]Running alpine Linux with qemu

I have try to run an alpine Linux in an emulated environment this way:我尝试以这种方式在模拟环境中运行高山 Linux:

$ wget https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86/alpine-netboot-3.16.1-x86.tar.gz

I have untar the archive and run:我已经解压存档并运行:

qemu-system-i386 -m 256 -kernel boot/vmlinuz-lts -initrd boot/initramfs-lts -append "console=ttyAMA0 ip=dhcp alpine_repo=http://dl-cdn.alpinelinux.org/alpine/edge/main/" -virtfs local,path=/xxxx/mylocalfolder,mount_tag=mytag1,security_model=passthrough -nographic 

My terminal is blank.我的终端是空白的。 I need to remove the -nographic argument to make it work.我需要删除 -nographic 参数以使其工作。 It works fine without this argument?没有这个论点它工作正常吗? But i need to run it through ssh so how can How can i do ?但我需要通过 ssh 运行它,我该怎么办?

I want to share a folder between the host machine and the emulated computer (see virtfs option).我想在主机和模拟计算机之间共享一个文件夹(请参阅 virtfs 选项)。 Here is what i've type in the virtual machine:这是我在虚拟机中输入的内容:

mount -t 9p -o trans=virtio mytag1 /mnt

I get this error:我收到此错误:

mount: mounting mytag1 on /mnt failed: No such device挂载:在 /mnt 上挂载 mytag1 失败:没有这样的设备

I do not understand why.我不懂为什么。 Any idea?任何想法?

I will have to run several times the qemu-system-i386 command.我将不得不多次运行 qemu-system-i386 命令。 I How can i automatically run commands on the virtualized environnement when it is up?我如何在虚拟化环境启动时自动运行命令? (apk add for example) And is it possible to specify an alpine_repo which is a local file instead of http? (例如apk add)是否可以指定一个本地文件而不是http的alpine_repo?

Thanks a lot非常感谢

Something is strange about your command line.您的命令行有些奇怪。 You're running an i386 kernel, but you pass "console=ttyAMA0".您正在运行 i386 kernel,但您通过了“console=ttyAMA0”。 ttyAMA0 is the typical serial terminal device name for Arm boards, not for x86 PCs. ttyAMA0 是 Arm 板的典型串行终端设备名称,不适用于 x86 PC。 Where did you get this command line from?你从哪里得到这个命令行?

The terminal is therefore blank because you have not correctly told the guest to use a valid serial terminal device for the hardware it's running on.因此终端是空白的,因为您没有正确地告诉客人使用有效的串行终端设备来运行它的硬件。 (It's also possible that the guest needs further configuration to work with a serial terminal: typically x86 PCs do not use serial consoles, so guest OSes are often not set up to work that way out of the box.) (访客也可能需要进一步配置才能使用串行终端:通常 x86 PC 不使用串行控制台,因此访客操作系统通常不会设置为开箱即用。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM