QEMU can't run with --enable-trace-backends configured - trace

I complied QEMU using:
./configure --enable-kvm --target-list=x86_64-softmmu --enable-trace-backends=simple
Then I started a VM using simply just:
qemu-system-x86_64 -nographic -vnc :1 -hda /home/cloud/ubuntu-rr.img -m 2048 -smp 4 --enable-kvm -smp 4 -monitor stdio
Nothing happened. I even couldn't call out the monitor with Ctrl+A C. It didn't work when I added -trace events=/tmp/events, either. What's wrong here? What should be the right way to utilize the QEMU tracing capability?
Thanks very much!

File /tmp/events should be created before start of qemu. So please create at least empty file or fill it with events you are going to trace.

Related

Diagnose watch utility

I have a script that runs in the background which uses watch to monitor a directory for changes. This works just fine. However, I had a need for the script which runs the monitoring script to be run as daemon. The daemon is running as the same user, but now watch is returning "1 Various failures."
I suspect that there is some environment variable that is not set right, but there are too many to use trial and error to diagnose the issue. And unfortunately, "Various failures" is not very helpful. Any ideas how I might diagnose this?
The command is
watch -d -t -g ls -l
I think something like the following can be used as a work-around.
diff <(ls -l) <(sleep 1; ls -l)
I finally discovered the following on stderr.
Error opening terminal: unknown.
It was easily resolved by the answer to error opening terminal. So it did turn out to be an environment variable. I don't see this error message in the code. Perhaps it occurs when making a system call that needs the terminal.

qemu-system-arm run barebox image

may I ask? I need to build a barebox image inside yocto and run it in qemu, I can’t build a qemuarm image in yocto, there is no such recipe, in general, the question is, is it possible to somehow slip under such a dts into the barebox assembly that qemu-system-arm with -M mcimx6ul-evk option will be able to run barebox builded in yocto?
You can enable CONFIG_BOARD_ARM_GENERIC_DT=y in the barebox config and barebox will generate an images/barebox-dt-2nd.img file that is bootable like a Linux kernel: You can pass it to QEMU -kernel and it will receive a device tree from the outside.
barebox contains a test/emulate.pl script that can spawn QEMU VMs for you. Passing it --dryrun will print the options used (edited for formatting):
$ ./test/emulate.pl --no-tuxmake --dry-run virt#vexpress_defconfig
/usr/bin/qemu-system-arm -M virt -cpu cortex-a7 -m 1024M -kernel \
./build/images/barebox-dt-2nd.img -serial mon:stdio -trace file=/dev/null
In the above case, QEMU will provide the device tree, but you can pass your own as well (make sure to build barebox with a config that enables board and platform support in line with the FDT and QEMU machine you configure). See the barebox documentation on Emulated targets for more information.

How to get XDP program into kernel with iproute2?

I am using "ip link" command to put xdp program into kernel, in my virtual machine(kernel-version:4.18)
command like this:
ip link set dev ens33 xdp obj xdpsock_kern.o sec .text
but after this command, the error said:
No ELF library support compiled in.
what should I do to solve this problem?
I solve this problem by reconfigure the iproutes.
git clone git://git.kernel.org/pub/pub/scm/network/iproute2/iproute2.git
cd iproute2/
./configure --prefix=/usr
make
sudo make install

QEMU - redirect guestOS booting to host machine

I used QEMU to bring CentOS.img (downloaded some where). I find the boot screen of CentOS.img took over the console session of the current terminal and I could see CentOS booting up process and prompts me to the login screen of the guestVM CentOS. This is really helpful for me as I ran QEMU instance from remote console machine.
Now, I created a new RHEL.img using iso and when I try to boot it; I was not able to see anything in the screen other then some symbol of (Y) :(
$>/usr/libexec/qemu-kvm -hda ./RHEL.img -bios bios.bin -nographic -net nic,model=e1000,macaddr=00:AD:BE:EF:4F:BD -net tap,script=./qemu-ifup -m 1024 -smp 2
...Y
on investigation, I find we can do it by redirecting RHEL boot to console using
# virt-edit RHEL_VM /boot/grub/grub.conf
...
title rhel (2.6.38.6-26.rc1.fc15.x86_64)
root (hd0,0)
kernel /vmlinuz ro [...] console=ttyS0
...
but nothing worked out. I am trying to bring the rhel VM session to the same console where I invoked qemu-kvm from remote terminal. Thanks in advance.
NOTE: I don't have GUI enabled on the physical host machine.
You could try adding a serial port and sending output to that. Although you do have to be able to boot it at least once to do these steps...
You might get lucky if you just add a serial port to the qemu command line and then telnet to that; hoping linux detects this and sends output there
edit /etc/init/ttyS0.conf and add
respawn
console none
start on (local-filesystems)
stop on [!12345]
script
exec start ttyS0
end script
then
ln -s /etc/init/ttyS0.conf /etc/rc2.d/S99ttyS0.conf
ln -s /etc/init/ttyS0.conf /etc/rc0.d/S99ttyS0.conf
ln -s /etc/init/ttyS0.conf /etc/rc6.d/S99ttyS0.conf
then do this to enable grub
Edit /etc/default/grub
1. Edit the GRUB_CMDLINE_DEFAULT="" line to start the console on /dev/ttyS0
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"
2. Add a serial console section
# Serial console
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"
3. Rebuild the grub.cfg file
sudo sh
grub-mkconfig > /boot/grub/grub.cfg

boot machine using qemu

I am trying to boot vm using qemu, the command that I use is
qemu-system-x86_64 -kernel /boot/vmlinuz-2.6.32-21-generic -hda /music/1gbfile
and its giving a error : Please append a correct "root=" boot option.
What does root mean here?
Thanks
Try this:
qemu-system-x86_64 -kernel /boot/vmlinuz-2.6.32-21-generic -hda /music/1gbfile -append "root=/dev/hda"
You are basically making /dev/hda (which you provide with -hda argument) as your system's root directory. You can find more information here