QEMU on Linux works, but on Windows (probably 7/8) fails when -redir parameter is used - windows

I'm shipping my project via qemu static build and a Linux VM. My project uses port 4848 for server configuration and port 8080 for HTTP (tools) and ephermal ports (49152+) for spawned sub-projects that use p2p websockets.
Note that the qemu binary is the qemu-system-... binary from Linux and the qemu.exe on windows, all statically compiled.
On Linux, I'm starting everything with this command. It works like a charm as expected:
./qemu -curses \
-kernel ../vmlinuz \
-initrd ../root.gz \
-L ./ \
-redir tcp:4848::4848 \
-redir tcp:8080::8080 \
-redir tcp:49152::49152 \
-redir tcp:49153::49153 \
-redir tcp:49154::49154 \
-redir tcp:49155::49155 \
-redir tcp:49156::49156 \
-redir tcp:49157::49157 \
-redir tcp:49158::49158 \
-redir tcp:49159::49159 \
-redir tcp:49160::49160 \
-redir tcp:49161::49161 \
-redir tcp:49162::49162 \
-append "quiet autologin loglevel=3"
On my Windows XP VM (in VirtualBox), this command here works fine without issues once you have approved the Firewall popup, but it seems to not work on Windows 8:
start qemu.exe -kernel ..\vmlinuz -initrd ..\root.gz -L ./ -redir tcp:4848::4848 -redir tcp:8080::8080 -redir tcp:49152::49152 -redir tcp:49153::49153 -redir tcp:49154::49154 -redir tcp:49155::49155 -redir tcp:49156::49156 -redir tcp:49157::49157 -redir tcp:49158::49158 -redir tcp:49159::49159 -redir tcp:49160::49160 -redir tcp:49161::49161 -redir tcp:49162::49162 -append "quiet autologin loglevel=3"
I found out that there might be an issue with the NE2000 network card driver on Windows, which I read here: http://www.h7.dion.ne.jp/~qemu-win/HowToNetwork-en.html
When trying to bootup qemu.exe directly without the -redir stuff and the flags "-net nic,model=rtl8139 -net user", it boots up properly.
But when I start to add the -redir flags on Windows8, it crashes and not even shows a single message in the cmd / Terminal.
Question
How to properly redir ports of a VM guest to a Windows 8 host with qemu.exe in CMD?

Related

How to run QEMU with Fedora + Custom kernel

I am trying to run Fedora with QEMU, but with a custom kernel that i built by using the first steps from the readme.txt file from here. The kernel describes T-HEAD's C910 processor, and I want it in order to run benchmarks (Fedora was the first OS that I found that supports RISC-V).
Following the steps from Fedora's guide, QEMU finally successfully booted, but with the guide's suggested kernel. The command run is shown here.
qemu-system-riscv64 \
-bios none \
-nographic \
-machine virt \
-smp 8 \
-m 2G \
-kernel Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-device,rng=rng0 \
-device virtio-blk-device,drive=hd0 \
-drive file=Fedora-Developer-Rawhide-*.raw,format=raw,id=hd0 \
-device virtio-net-device,netdev=usernet \
-netdev user,id=usernet,hostfwd=tcp::10000-:22
Also, the command from the readme.txt file from the first link works as well, but it just boots into the kernel alone, no OS (hence the need for the OS).
LD_LIBRARY_PATH=./host/lib ./host/csky-qemu/bin/qemu-system-riscv64 -M virt -kernel fw_jump.elf -device loader,file=Image,addr=0x80200000 -append "rootwait root=/dev/vda ro" -drive file=rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -nographic -smp 1
I tried modifing the -kernel argument from the command at Fedora's guide to the path to the custom kernel. By executing the command, it hangs at the start, as shown in the image below:
It's probably a matter of arguments that are supplied to QEMU since it's clear that the one from readme.txt and the one from Fedora's guide differ by a lot

Vagrant keeps losing file doing provision

I'm running into an odd behavior on the latest version of vagrant in a Windows7/msys/Virtualbox environment setup, where after executing a vagrant up command I get an error with rsync; 'file has vanished: "/c/Users/spencerd/workspace/watcher/.LISTEN' doing the provisioning stage.
Since google, irc, and issue trackers have little to no documentation on this issue I wonder if anyone else ran into this and what would the fix be?
And for the record I have successfully build a box using the same vagrant file and provisioning script. For those that want to look, the project code is up at https://gist.github.com/denzuko/a6b7cce2eae636b0512d, with the debug log at gist.github.com/
After digging further into the directory structure and running into issues with git pushing code up I was able to find a non-existant file that needed to be removed after a reboot.
Thus, doing a reboot and a rm -rf -- "./.LISTEN\ \ \ \ \ 0\ \ \ \ \ \ 100\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ " did the trick.

How does "knife ec2 server create"'s expansion of --run-list work?

I'm unable to bootstrap my server because "knife ec2 server create" keeps expanding my runlist to "roles".
knife ec2 server create \
-V \
--run-list 'role[pgs]' \
--environment $1 \
--image $AMI \
--region $REGION \
--flavor $PGS_INSTANCE_TYPE \
--identity-file $SSH_KEY \
--security-group-ids $PGS_SECURITY_GROUP \
--subnet $PRIVATE_SUBNET \
--ssh-user ubuntu \
--server-connect-attribute private_ip_address \
--availability-zone $AZ \
--node-name pgs \
--tags VPC=$VPC
Consistently fails because 'roles[pgs]' is expanded to 'roles'. Why is this? Is there some escaping or alternative method I can use?
I'm currently working around this by bootstrapping with an empty run-list and then overriding the runlist by running chef-client once the node is registered.
This is a feature of bash. [] is a wildcard expander. You should can escape the brackets using "\".

rpm can't find configure no such file

I have a problem with my spec file. When I run it with rpmbuild it says it can't find ./configure no such file or directory. Here is a part of the code of my spec file. Can someone help me?
...
BuildRequires: gd-devel > 1.8, mailx, libjpeg-devel, libpng-devel
Requires: httpd php53 gcc
%description
Nagios is a program that will monitor hosts and services on your
network.
%package common
Group: Applications/System
Summary: Provides common directories, uid and gid among nagios-related packages
Requires(pre): shadow-utils
Requires(post): shadow-utils
Provides: user(nagios)
Provides: group(nagios)
%description common
Provides common directories, uid and gid among nagios-related packages.
%prep
%setup -q -n %{name}-%{version}
%build
%configure \
--prefix=%{_datadir}/%{name} \
--exec-prefix=%{_localstatedir}/lib/%{name} \
--with-init-dir=%{_initrddir} \
--with-cgiurl=/%{name}/cgi-bin/ \
--with-htmlurl=/%{name} \
--with-lockfile=%{_localstatedir}/run/%{name}.pid \
--libdir=%{_libdir}/%{name} \
--with-nagios-user=nagios \
--with-nagios-grp=nagios \
--bindir=%{_sbindir} \
--libexecdir=%{_libdir}/%{name}/plugins \
--sysconfdir=%{_sysconfdir}/%{name} \
--localstatedir=%{_localstatedir}/log/%{name} \
--datadir=%{_datadir}/%{name}/html \
--with-gd-lib=%{_libdir} \
--with-gd-inc=%{_includedir} \
--enable-embedded-perl \
--with-perlcache \
...
I am not familiar with nagios, but have you confirmed that when you extract the distribution tarball, there is a configure file in the top-level directory? If not, you need to add the steps to get there.

How to get better performance with Qt4.5 on arm platform

I just finished porting the QT4.5.3 GUI lib with touchscreen lib tslib1.4.1 to arm9 based S3C2440;but I find programs are running slow.How to make Qt4.5.3 run more smoothly?
I have already read the references on http://doc.trolltech.com/4.7-snapshot/fine-tuning-features.html and http://doc.trolltech.com/4.7-snapshot/qt-performance.html Any other suggestion according to your experience?Thanks!
I use the S3C24xx too. I use Qt 4.6.2. Here is my compile configuration
#host:/qt-everywhere-opensource-src-4.6.2#./configure \
-opensource \
-confirm-license \
-release -shared \
-embedded arm \
-xplatform qws/linux-arm-g++ \
-depths 16,18,24 \
-fast \
-optimized-qmake \
-pch \
-qt-sql-sqlite \
-qt-libjpeg \
-qt-zlib \
-qt-libpng \
-qt-freetype \
-little-endian -host-little-endian \
-no-qt3support \
-no-libtiff -no-libmng \
-no-opengl \
-no-mmx -no-sse -no-sse2 \
-no-3dnow \
-no-openssl \
-no-webkit \
-no-qvfb \
-no-phonon \
-no-nis \
-no-opengl \
-no-cups \
-no-glib \
-no-xcursor -no-xfixes -no-xrandr -no-xrender \
-no-separate-debug-info \
-nomake examples -nomake tools -nomake docs \
-qt-mouse-tslib -I/usr/local/tslib/include -L/usr/local/tslib/lib
#host:/qt-everywhere-opensource-src-4.6.2# make
#host:/qt-everywhere-opensource-src-4.6.2# make install
Also notice that, if you change optimization level of compiler in file qt-everywhere-opensource-src-4.6.2/mkspecs/common/g++.conf from -O2 to -O0 may cause the Qt library run very slow.
Hope it is useful for you.
I suggest running a profiling tool to see what your program is actually doing. It might be that another part of your program is hogging the CPU. Performance problems are often first noticed through the GUI since it is something that the user sees and interacts with. Oprofile is a good tool to try out.

Resources