amluto / virtme Goto Github PK
View Code? Open in Web Editor NEWAn easy way to virtualize the running system
License: GNU General Public License v2.0
An easy way to virtualize the running system
License: GNU General Public License v2.0
This may well just be me missing something obvious, but I'm running into this on attempting to boot a guest with virtme-run --installed-kernel --pwd
:
[ 0.339347] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -19
[ 0.340175] Please append a correct "root=" boot option; here are the available partitions:
[ 0.341045] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Using --show-command
yields:
/usr/local/bin/qemu-system-x86_64 -fsdev local,id=virtfs1,path=/,security_model=none,readonly -device virtio-9p-pci,fsdev=virtfs1,mount_tag=/dev/root -fsdev local,id=virtfs5,path=/lib/modules/4.1.1+,security_model=none,readonly -device virtio-9p-pci,fsdev=virtfs5,mount_tag=virtme.moddir -machine accel=kvm:tcg -watchdog i6300esb -cpu host -parallel none -net none -echr 1 -serial none -chardev stdio,id=console,signal=off,mux=on -serial chardev:console -mon chardev=console -vga none -display none -kernel /boot/vmlinuz-4.1.1+ -append 'init=/home/zev/src/virtme/virtme/guest/virtme-init earlyprintk=serial,ttyS0,115200 console=ttyS0 psmouse.proto=exps "virtme_stty_con=rows 77 cols 119 iutf8" TERM=screen virtme_chdir=home/zev/src/virtme rootfstype=9p rootflags=ro,version=9p2000.L,trans=virtio,access=any raid=noautodetect'
This is on CentOS 6 with Python 3.5.0, qemu 2.4.0.1, and a 4.1-based kernel. Any tips would be appreciated.
./virtme-run
Traceback (most recent call last):
File "./virtme-run", line 12, in <module>
from virtme.commands import run
File "/home/cov/prj/virtme/virtme/commands/run.py", line 97, in <module>
_ARGPARSER = make_parser()
File "/home/cov/prj/virtme/virtme/commands/run.py", line 31, in make_parser
const=uname.release, default=None, metavar='VERSION',
AttributeError: 'tuple' object has no attribute 'release'
From ipython3:
In [4]: os.uname()
Out[4]:
('Linux',
'RoyalPenguin',
'3.8.0-44-generic',
'#66~precise1-Ubuntu SMP Tue Jul 15 04:01:04 UTC 2014',
'x86_64')
In [5]: os.uname().release
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/cov/prj/virtme/<ipython-input-5-583f2db64b53> in <module>()
----> 1 os.uname().release
AttributeError: 'tuple' object has no attribute 'release'
In [6]: os.uname()[3]
Out[6]: '#66~precise1-Ubuntu SMP Tue Jul 15 04:01:04 UTC 2014'
On ubuntu 20.04 I get the following when booting a 5.7 kernel on QEMU:
qemu-system-x86_64: warning: 9p: Multiple devices detected in same VirtFS export, which might lead to file ID collisions and severe misbehaviours on guest! You should either use a separate export for each device shared from host or use virtfs option 'multidevs=remap'!
$ qemu-system-x86_64 --version
QEMU emulator version 4.2.0 (Debian 1:4.2-3ubuntu6.1)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
Sounds straight forward enough, however I'm not sure what the more backwards compatible approach is. Separate exports?
This is probably an upstream QEMU bug, but I think it'd be good to try and find a work around. The following command hangs indefinitely:
$ virtme-run --show-boot-console --kimg linux-5.2-rc4.bz --script-sh "echo foo" < /dev/null
...
[ 2.121087] virtme-init: udev is done
[ 2.237338] ip (184) used greatest stack depth: 12488 bytes left
[ 2.246030] virtme-init: starting script
If I change virtme-init
to strace what is happening, I can see that the script is hanging on writing "foo". Removing < /dev/null
makes everything work again.
Usually I wouldn't care, but Docker also redirects stdin to /dev/null
. On previous QEMU versions it was possible to work around this by closing stdin via 0<&-
, but as of 3.1.0 this breaks.
There is a work-around however:
$ virtme-run --show-boot-console --kimg linux-5.2-rc4.bz --script-sh "echo foo" < /dev/zero
This might end up flooding stdin with zeros, so I'm not sure what the implications of this are. cat | virtme-run
doesn't work, since cat just exits due to stdin being /dev/null
, which leads to stdin to QEMU being closed.
virtme-init
or similar?/dev/zero
?Hi guys! I'm new in virtme. I'm starting working with drivers and want to start virtme to try them into a container of Docker.
But I face this problem:
[ 1.982400] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[ 1.983271] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 2.003071] sr 1:0:0:0: Attached scsi generic sg0 type 5
[ 2.007171] md: Skipping autodetection of RAID arrays. (raid=autodetect will force)
[ 2.012089] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -19
[ 2.012675] Please append a correct "root=" boot option; here are the available partitions:
[ 2.013856] 0b00 1048575 sr0
[ 2.013927] driver: sr
[ 2.015327] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 2.015982] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.11.0-rc7+ #1
[ 2.016359] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
[ 2.017063] Call Trace:
[ 2.018535] dump_stack+0x57/0x6a
[ 2.018920] panic+0xf6/0x2b7
[ 2.019133] mount_block_root+0x196/0x21a
[ 2.019446] mount_root+0xec/0x10a
[ 2.019624] prepare_namespace+0x136/0x165
[ 2.019868] kernel_init_freeable+0x1c8/0x1d3
[ 2.020133] ? rest_init+0xa4/0xa4
[ 2.020323] kernel_init+0x5/0xfc
[ 2.020509] ret_from_fork+0x22/0x30
[ 2.021730] Kernel Offset: 0x30a00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 2.022684] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
Seems like virtme can't find /.
Is there something that I'm missing in the configuration? Is virtme supported for Docker?
Thanks!
I run virtme with:
virtme-run --kdir=$KBUILD_OUTPUT --mods=auto --rwdir=../blabla/ --cwd ../blabla --qemu-opts -m 10G
Then when loading a module with modprobe, I get the error:
modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/5.7.0-rc2+/modules.builtin.bin'
# virtme-configkernel --arch=x86_64 --defconfig
# make ARCH=x86 CROSS_COMPILE=x86_64-linux-gnu- -j12
# virtme-run --kdir .
Traceback (most recent call last):
File "/usr/local/bin/virtme-run", line 33, in <module>
sys.exit(load_entry_point('virtme==0.1.1', 'console_scripts', 'virtme-run')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/virtme-0.1.1-py3.11.egg/virtme/commands/run.py", line 587, in main
return do_it()
^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/virtme-0.1.1-py3.11.egg/virtme/commands/run.py", line 273, in do_it
kernel = find_kernel_and_mods(arch, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/virtme-0.1.1-py3.11.egg/virtme/commands/run.py", line 201, in find_kernel_and_mods
is_file_more_recent(mod_file, virtme_mod_file):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/virtme-0.1.1-py3.11.egg/virtme/commands/run.py", line 135, in is_file_more_recent
return os.stat(a).st_mtime > os.stat(b).st_mtime
^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './.virtme_mods/lib/modules/0.0.0/modules.dep'
Hi there,
I've encountered some qemu-system compatibility issue:
~/src/linux $ virtme-run --kimg arch/x86_64/boot/bzImage
qemu-system-x86_64: -watchdog: invalid option
This generates
/usr/bin/qemu-system-x86_64 -fsdev local,id=virtfs1,path=/,security_model=none,readonly=on,multidevs=remap -device virtio-9p-pci,fsdev=virtfs1,mount_tag=/dev/root -fsdev local,id=virtfs5,path=/usr/local/lib/python3.10/dist-packages/virtme-0.1.1-py3.10.egg/virtme/guest,security_model=none,readonly=on,multidevs=remap -device virtio-9p-pci,fsdev=virtfs5,mount_tag=virtme.guesttools -machine accel=kvm:tcg -watchdog i6300esb -parallel none -net none -echr 1 -serial none -chardev stdio,id=console,signal=off,mux=on -serial chardev:console -mon chardev=console -vga none -display none -kernel arch/x86_64/boot/bzImage -append 'earlyprintk=serial,ttyS0,115200 console=ttyS0 psmouse.proto=exps "virtme_stty_con=rows 61 cols 224 iutf8" TERM=screen rootfstype=9p rootflags=version=9p2000.L,trans=virtio,access=any raid=noautodetect ro init=/bin/sh -- -c "mount -t tmpfs run /run;mkdir -p /run/virtme/guesttools;/bin/mount -n -t 9p -o ro,version=9p2000.L,trans=virtio,access=any virtme.guesttools /run/virtme/guesttools;exec /run/virtme/guesttools/virtme-init"'
Turns out the -watchdog i6300esb
should be replaced as -device i6300esb -action watchdog=pause
, and then it works
Qemu version:
QEMU emulator version 7.2.0 (Debian 1:7.2+dfsg-1+b2)
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
Git commit of virtme: 3dfc002 (run.py: Fix deprecated qemu readonly statement)
Host OS: Debian Bullseye
Happy to provide more information :)
I'm running the following virtme-run command:
virtme-run --kimg "${tmp_dir}/${kernel}" --memory 2G --pwd --rwdir=/run/output="${output}" --script-sh "$(realpath "$0") --in-vm /run/output" --show-command --show-boot-console
and the following qemu command is output:
/usr/bin/qemu-system-x86_64
-fsdev local,id=virtfs1,path=/,security_model=none,readonly
-device virtio-9p-pci,fsdev=virtfs1,mount_tag=/dev/root
-fsdev local,id=virtfs5,path=/usr/local/lib/python3.6/dist-packages/virtme/guest,security_model=none,readonly
-device virtio-9p-pci,fsdev=virtfs5,mount_tag=virtme.guesttools
-fsdev local,id=virtfs9,path=/tmp/tmp.3cv8xBF24y,security_model=none
-device virtio-9p-pci,fsdev=virtfs9,mount_tag=virtme.initmount0
-machine accel=kvm:tcg
-watchdog i6300esb
-cpu host
-parallel none
-net none
-m 2G
-vga none
-display none
-serial none
-chardev file,id=console,path=/proc/self/fd/2
-serial chardev:console
-chardev stdio,id=stdio,signal=on,mux=off
-device virtio-serial-pci
-device virtserialport,name=virtme.scriptio,chardev=stdio
-no-reboot
-kernel /tmp/tmp.5xuUlk8erz/linux-5.0.13.bz
-append 'virtme_initmount0=/run/output virtme_chdir=root/go/src/github.com/newtools/ebpf init=/bin/sh -- -c "mkdir -p /run/virtme/guesttools;/bin/mount -n -t 9p -o ro,version=9p2000.L,trans=virtio,access=any virtme.guesttools /run/virtme/guesttools;exec /run/virtme/guesttools/virtme-init"'
-initrd /proc/self/fd/3
Looking through the boot console nothing seems to be out of the ordinary until I hit init spin up:
[ 1.220049] Run /init as init process
[ 1.221046] Failed to execute /init (error -2)
[ 1.222113] Run /bin/sh as init process
[ 1.223094] Kernel panic - not syncing: Requested init /bin/sh failed (error -2).
[ 1.224829] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.0.13 #1
[ 1.226258] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 1.228401] Call Trace:
[ 1.229025] dump_stack+0x46/0x60
[ 1.229826] ? rest_init+0x80/0x9a
[ 1.230632] panic+0xf6/0x287
[ 1.231352] ? __do_execve_file.isra.49+0xb3/0xa10
[ 1.232305] ? rest_init+0x9a/0x9a
[ 1.232946] kernel_init+0xa1/0xf6
[ 1.233860] ret_from_fork+0x35/0x40
[ 1.235036] Kernel Offset: 0x30a00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 1.237786] ---[ end Kernel panic - not syncing: Requested init /bin/sh failed (error -2). ]---
Any thoughts or recommendations?
It would be nice if virtme-configkernel
would not require source and output folders to be the same.
Supporting environment variable KBUILD_OUTPUT
(already works for kernel build system) or an extra flag would probably be the way.
It would help packagers to have a new release, after 5 years of the 0.0.1 tag.
Is there any sort of shortcut that can be used to access the QEMU Monitor through virtme?
Not sure if that's a valid use case or not. If not, is there any other way apart from using the QEMU monitor to Hot unplug a device?
Referring to - https://en.wikibooks.org/wiki/QEMU/Monitor
root@(none):/home/uss# mount -t iso9660 test.iso /media/ISO
mount: /media/ISO: mount failed: Operation not permitted.
root@(none):/home/uss# whoami
Similar to #35, but different:
[ 0.755127] Run /init as init process
[ 0.756056] Failed to execute /init (error -2)
[ 0.757149] Run /usr/bin/sh as init process
[ 0.757869] Kernel panic - not syncing: Requested init /usr/bin/sh failed (error -2).
[ 0.759166] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.3.4-1-default #1 openSUSE Tumbleweed (unreleased)
[ 0.760747] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58-rebuilt.opensuse.org 04/01/2014
[ 0.762685] Call Trace:
[ 0.763217] dump_stack+0x85/0xc0
[ 0.763981] ? csum_partial_copy_generic+0x3530/0x3560
[ 0.765115] panic+0x106/0x2e1
[ 0.765709] ? rest_init+0xaa/0xaa
[ 0.766287] kernel_init+0xab/0x106
[ 0.766912] ret_from_fork+0x3a/0x50
[ 0.767596] Kernel Offset: 0x32e00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 0.769520] Rebooting in 90 seconds..
Checking the config used to build the kernel (5.3.4-1), it contains all necessary modules requested in README, being them compiled as external modules or builtin.
I'm not sure if this has something related to modules. Here is the modfilter.py output of deps and the modprobe command output:
insmod /lib/modules/5.3.4-1-default/kernel/fs/fscache/fscache.ko.xz
insmod /lib/modules/5.3.4-1-default/kernel/net/9p/9pnet.ko.xz
insmod /lib/modules/5.3.4-1-default/kernel/fs/9p/9p.ko.xz
['/lib/modules/5.3.4-1-default/kernel/fs/fscache/fscache.ko.xz', '/lib/modules/5.3.4-1-default/kernel/net/9p/9pnet.ko.xz', '/lib/modules/5.3.4-1-default/kernel/fs/9p/9p.ko.xz']
insmod /lib/modules/5.3.4-1-default/kernel/net/9p/9pnet.ko.xz
insmod /lib/modules/5.3.4-1-default/kernel/net/9p/9pnet_virtio.ko.xz
['/lib/modules/5.3.4-1-default/kernel/net/9p/9pnet.ko.xz', '/lib/modules/5.3.4-1-default/kernel/net/9p/9pnet_virtio.ko.xz']
[]
[]
[]
builtin unix
[]
builtin i8042
[]
builtin atkbd
[]
I don't remember having this issue last week, so I'm afraid this maybe has something with the new tumbleweed kernel.
The problem exists with 0.0.3 and 0.1.1.
On python 3.5 I get this error
marek@mrnew:/build/virtme$ python3 ./virtme-run
Traceback (most recent call last):
File "./virtme-run", line 17, in <module>
from virtme.commands import run
File "/build/virtme/virtme/commands/run.py", line 37
g: Any
^
SyntaxError: invalid syntax
Hi Andy,
virtme is an awesome tool, but I try to reboot it by using virsh, the newly created VM doesn't show up to virsh list.
I'm testing some kernel stuff, so I need to reboot it a lot :)
Thanks!
I'm quite sure virtme requires at least
CONFIG_BLK_DEV_INITRD
Needed for the initrd to work at all. Otherwise only non-initrd stuff works. (shell)
CONFIG_INOTIFY_USER
Needed for proper udev /dev/virtio-port mounting. Without this you'll see error:
virtme-init: cannot find script I/O port; make sure virtio-serial is available
CONFIG_ACPI
Needed for shutdown to actually close the vm. otherwise it hangs on message reboot: System halted
On top of the already documented ones. This should probably be added to virtme/configkernel.
I did:
rm .config
make tinyconfig
make kvmconfig
./scripts/config \
-e EARLY_PRINTK \
-e 64BIT \
-e BPF -d EMBEDDED -d EXPERT \
-e INOTIFY_USER \
-e ACPI
./scripts/config \
-e VIRTIO -e VIRTIO_PCI -e VIRTIO_MMIO \
-e NET -e NET_CORE -e NETDEVICES -e NETWORK_FILESYSTEMS \
-e INET -e NET_9P -e NET_9P_VIRTIO -e 9P_FS \
-e VIRTIO_NET -e VIRTIO_CONSOLE \
-e DEVTMPFS -e SCSI_VIRTIO -e BINFMT_SCRIPT -e TMPFS \
-e UNIX -e TTY -e VT -e UNIX98_PTYS -e WATCHDOG -e WATCHDOG_CORE \
-e I6300ESB_WDT \
-e BLOCK -e SCSI_LOWLEVEL -e SCSI -e SCSI_VIRTIO \
-e BLK_DEV_SD -e BLK_DEV_INITRD \
-e VIRTIO_BALLOON \
-d CMDLINE_OVERRIDE \
-d UEVENT_HELPER \
-d EMBEDDED -d EXPERT \
-d MODULE_SIG_FORCE
make olddefconfig
make bzImage
I ran pretty much these commands:
➜ tmp>virtualenv --system-site-packages --python=python3 /tmp/virtme
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /tmp/virtme/bin/python3
Also creating executable in /tmp/virtme/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
➜ tmp>/tmp/virtme/bin/pip install 'git+http://github.com/amluto/virtme#egg=virtme'
Collecting virtme from git+http://github.com/amluto/virtme#egg=virtme
Cloning http://github.com/amluto/virtme to ./pip-install-5gz50xtg/virtme
Building wheels for collected packages: virtme
Running setup.py bdist_wheel for virtme ... done
Stored in directory: /tmp/pip-ephem-wheel-cache-dg8zx1ce/wheels/01/23/c1/8bb07c0ec32d4aad2e9b56850eb290ed2f4bf4850be4160f74
Successfully built virtme
Installing collected packages: virtme
Successfully installed virtme-0.0.3
➜ tmp>/tmp/virtme/bin/virtme-run
You must specify a kernel to use.
usage: virtme-run [-h] [--installed-kernel [VERSION] | --kimg KIMG | --kdir
KDIR] [-a KOPT] [--xen XEN] [--root ROOT] [--rw]
[--graphics] [--net] [--balloon] [--disk NAME=PATH]
[--name NAME] [--script-sh SHELL_COMMAND]
[--script-exec BINARY] [--arch ARCHITECTURE]
[--busybox PATH_TO_BUSYBOX] [-q QEMU_OPT] [--qemu-opts ...]
[--force-initramfs] [--dry-run] [--show-command] [--pwd]
[--rwdir RWDIR] [--rodir RODIR]
➜ tmp>/tmp/virtme/bin/virtme-run --kdir=~/vcs/linux
Traceback (most recent call last):
File "/tmp/virtme/bin/virtme-run", line 11, in <module>
sys.exit(main())
File "/tmp/virtme/lib/python3.6/site-packages/virtme/commands/run.py", line 205, in main
raise ValueError("couldn't find guest tools -- virtme is installed incorrectly")
ValueError: couldn't find guest tools -- virtme is installed incorrectly
➜ tmp>
I expected these to work. I'd appreciate if the readme had some more information regarding installation and usage.
I sort of works when I modify the path in virtme/guest_tools.py
and copy virtme/guest
to /tmp/virtme-guest0
or something.
Of course, I'd much rather like to see the pip installation just work™.
The DNS logic in virtme-init
uses test -f /etc/resolv.conf
for checking whether a resolv.conf exists and, if so, replace it with a writeable file supposedly s.t. the udhcp can write it s.t. name resolution works.
On my Ubuntu 18.04, however, /etc/resolv.conf
is a symlink:
lrwxrwxrwx 1 root root 39 Oct 13 2017 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
and that target directory does not exist (does systemd-tmpfiles not create it..?).
On top of that, it seems, that bind-mounting over a symlink doesn't work:
https://serverfault.com/questions/322906/how-do-i-do-a-bind-mount-over-a-symlink :(
This dirty patch makes it work for me:
diff --git a/virtme/guest/virtme-init b/virtme/guest/virtme-init
index 44a018a..82f6c89 100755
--- a/virtme/guest/virtme-init
+++ b/virtme/guest/virtme-initdiff --git a/virtme/guest/virtme-init b/virtme/guest/virtme-init
index 44a018a..d080aae 100755
--- a/virtme/guest/virtme-init
+++ b/virtme/guest/virtme-init
@@ -146,16 +146,18 @@ fi
ip link set dev lo up
if cat /proc/cmdline |grep -q -E '(^| )virtme.dhcp($| )'; then
- if [[ -f /etc/resolv.conf ]]; then
+ #if [[ test -f /etc/resolv.conf || test -h /etc/resolv.conf || test -e /etc/resolv.conf ]]; then
tmpfile="`mktemp --tmpdir=/tmp`"
chmod 644 "$tmpfile"
mount --bind "$tmpfile" /etc/resolv.conf
rm "$tmpfile"
- fi
+ #fi
# udev is liable to rename the interface out from under us.
virtme_net=`ls "$(ls -d /sys/bus/virtio/drivers/virtio_net/virtio* |sort -g |head -n1)"/net`
busybox udhcpc -i "$virtme_net" -t 1 -n -q -f -s "$(dirname $0)/virtme-udhcpc-script"
+ mkdir /run/systemd/resolve/
+ echo nameserver 10.0.2.3 | tee /run/systemd/resolve/stub-resolv.conf
fi
if [[ -x /run/virtme/data/script ]]; then
Hi @amluto !
The number of unmerged PRs and the last commit's date indicates that the project is no longer maintained. Is there any plan to continue the maintenance or invite someone else to maintain it and merge PRs?
Its quite unfortunate that this project is hosted on git.kernel.org which (for me at least) indicates its a safe bet for its purpose. However looking around in the PRs there are lots of useful features unmerged and fixes for breaking errors with newer kernels.
Am I missing something? Is there any successor of this project and got deprecated?
Thanks in advance!
Ferenc
I can't seem to get any output with virtme-run
's --script-exec
or --script-sh
flags. Without them I get kernel console message in my terminal as expected, but whenever I use either of these flags I get no output from either the guest kernel or my script -- or even any evidence that my script runs at all, actually. I put an infinite loop in a bash script (while :; do :; done
) and passed it to --script-exec
, hoping to see qemu continue to peg the CPU beyond a normal guest-boot duration, but its CPU consumption quieted down after about the same amount of time it does when booting into an interactive shell, so it seems like the script isn't getting executed.
I've tried both the cat |
prefix mentioned in the --help
output and < /dev/null
to redirect stdin, but haven't seen any difference in behavior either way. (Using the --force-initramfs
flag also hasn't made any difference, if it's relevant.)
Running with --show-command
prints:
/usr/local/qemu-2.7.0/bin/qemu-system-x86_64 -fsdev local,id=virtfs1,path=/,security_model=none,readonly -device virtio-9p-pci,fsdev=virtfs1,mount_tag=/dev/root -fsdev local,id=virtfs5,path=/home/zev/src/virtme/virtme/guest,security_model=none,readonly -device virtio-9p-pci,fsdev=virtfs5,mount_tag=virtme.guesttools -fsdev local,id=virtfs9,path=/lib/modules/4.7.0-bcfs-nopreempt+,security_model=none,readonly -device virtio-9p-pci,fsdev=virtfs9,mount_tag=virtme.moddir -machine accel=kvm:tcg -watchdog i6300esb -cpu host -parallel none -net none -vga none -display none -serial none -chardev file,id=console,path=/proc/self/fd/2 -serial chardev:console -chardev stdio,id=stdio,signal=on,mux=off -device virtio-serial-pci -device virtserialport,name=virtme.scriptio,chardev=stdio -no-reboot -kernel /boot/vmlinuz-4.7.0-bcfs-nopreempt+ -append 'virtme_chdir=home/zev init=/bin/sh -- -c "mount -t tmpfs run /run;mkdir -p /run/virtme/guesttools;/bin/mount -n -t 9p -o ro,version=9p2000.L,trans=virtio,access=any virtme.guesttools /run/virtme/guesttools;exec /run/virtme/guesttools/virtme-init"' -initrd /proc/self/fd/4
and the contents of /home/zev/test-script.sh
are:
#!/bin/bash
while :; do :; done
This is with python 3.5.0 and qemu 2.7.0, on a 4.7.0 kernel.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.