boot machine using qemu - virtualization

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

Related

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 can't run with --enable-trace-backends configured

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.

schroot is giving error on centos 6

When I'm using command: schroot -c 32bit -- bash --login -c "rm -rf ~/SC32 ;"
I'm getting these errors:
E: 20copyfiles: cp: cannot create regular file `/var/lib/schroot/mount/32bit-dcc62f68-de18-4d2a-95d9-b71f0be314ce/etc/resolv.conf': No such file or directory
E: 32bit-dcc62f68-de18-4d2a-95d9-b71f0be314ce: Chroot setup failed: stage=setup-start
Since i'm new to Linux Environment i don't know what to do to solve this error.
The Cent OS which I'm using is 6.3 with x64 architecture
Also i have configured 32bit in /etc/schroot/schroot.conf as
[32bit]
type=directory
description=CentOS 6.3 32bit
directory=/chroot/32bit
users=temp
root-groups=root
personality=linux32
Also I Have this directory available /chroot/32bit
I'm not the root user of the system.
Can anybody tell me what to do to resolve this error?
To debug problems with schroot, try running it verbosely:
schroot -v
or to make it really verbose
schroot -v --debug=notice
The actual failure here is to copy /etc/resolv.conf. There are two potential reasons for this
The source file isn't copyable. Normally unlikely, but try cp and cat by hand to check.
The destination doesn't exist. This is the usual cause of such errors.
Your chroot is /chroot/32bit and it's being (bind) mounted on /var/lib/schroot/mount/32bit-dcc62f68-de18-4d2a-95d9-b71f0be314ce. If /chroot/32bit/etc does not exist, then /var/lib/schroot/mount/32bit-dcc62f68-de18-4d2a-95d9-b71f0be314ce/etc won't exist either, and so the copy operation will fail. You must have a proper system available under /chroot/32bit with all the usual directories (/bin, /etc, /lib etc.).
Assuming that you do have a proper chroot in /chroot/32bit, then something has gone wrong during setup. Running with verbose or debug messages enabled may shed some light on the cause of the failure.
Regards,
Roger
(schroot author)
I followed #Roger 's solution and all is well. But I found another workaround solution:
Enter your schroot directory, maybe like this location: /chroot/32bit, you can find this path in "/etc/schroot/schroot.conf" setting file.
cd /chroot/32bit
mv /chroot/32bit/etc/resolv.conf /chroot/32bit/etc/resolv.conf.bk
Then you can try your schroot login command and check is success.
schroot -c 32bit
(32bit)WDan#linux-buildy01:~$
Enjoy it!

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