Qemu killed

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Qemu killed

Post by PeterX »

I ran Qemu with OVMF, a HD image with 20GB and a Linux ISO. I tried three times now (two times with Xubuntu, one time with Manjaro XFCE).

And always the installation from virtual CD onto virtual HD aborts silently and suddenly (after a long time (like an hour or more) of installating files). I get the message "<Process ID> Killed" and no more info.

The qemu command is:

Code: Select all

qemu-system-x86_64 -pflash OVMF.fd -hda hd.img -net none -m 4g -cdrom linux.iso
What can I do to make this work?

I use Xubuntu 20.04 LTS with qemu-system-x86_64 4.2.1 (Debian 1:4.2-3ubuntu6.11) on x86_64 PC with Legacy BIOS.

Greetings
Peter
xeyes
Member
Member
Posts: 212
Joined: Mon Dec 07, 2020 8:09 am

Re: Qemu killed

Post by xeyes »

I'd first check the obvious issues that can cause any resource intensive app to suddenly get killed: did the host run out of memory and engage OOM killer? or was the disk img sparse and the host ran out of space? etc.

If no obvious issues from these checks. I'd run qemu itself under GDB. Yes it will run fine, even with KVM enabled (which you probably want to enable when running a "real" OS), you can even see that it has launched VCPU number of threads and all of them should be within kvm_cpu_exec () most of the time.

Only extra setup to run qemu under GDB is to ignore (noprint) SIGUSR1 as that is used during qemu's normal operation and happens frequent enough that you don't want to getting notified about it.

Then, sit back, relax, and see what gdb has to say about "aborts silently"
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Qemu killed

Post by PeterX »

Thanks!

[OK first dealing with the "obvious reasons": ]
I thought it couldn't be "normal" out of memory because then the error message would have said so. That was probably naive. How can I avoid out-of-memory? I already have a swap partition on my host OS. Maybe I should reduce the VM memory to 3GB to avoid that the VM eats up all host system's memory? What else can help getting the installation process done without crashing?

Yes, I'm trying to install a "real" OS (as I mentioned: Xubuntu and Manjaro). Are there some HD images I can download instead of installing it from CD/DVD?

Using "-accel kvm" crashes with a segmentation fault.

Greetings
Peter
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: Qemu killed

Post by austanss »

"qemu is kil"

"no"
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
xeyes
Member
Member
Posts: 212
Joined: Mon Dec 07, 2020 8:09 am

Re: Qemu killed

Post by xeyes »

error message would have said so
OOM killer's action is logged in the normal kernel log. It won't be in a position to print anywhere else when it needs to do its work.
How can I avoid out-of-memory?
If OOM is the issue, 2 easy soltuions:
1. Use less memory.
2. Buy more memory.
instead of installing
LiveCD doesn't work for you?


To be honest I've never installed Ubuntu in a VM so if you can't get GDB to watch it for you I'm not too sure what else to try either. But Ubuntu has an active community at https://askubuntu.com/ and I'm sure they'll be able to help with any issue installing it in a mainstream VMM like qemu.
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

[SOLVED] Re: Qemu killed

Post by PeterX »

xeyes wrote:OOM killer's action is logged in the normal kernel log.
Didn't know that. Thanks.
xeyes wrote:If OOM is the issue, 2 easy solutions:
1. Use less memory.
2. Buy more memory.
1. Ok, but how to use less memory? I tried it already, of course. I'm running the minimum programs. Just X and jwm and qemu and a X-terminal. (And all the stuff Linux insists on running in the background.)
2. I have 4GB, the maximum for my PC.
xeyes wrote:LiveCD doesn't work for you?
Good idea. I was so fixed on installing on HD that I didn't figure I could use Live CD!! Thanks. THis is probably a working solution, so I mark this thread as solved.

Greetings
Peter
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: [SOLVED] Re: Qemu killed

Post by klange »

PeterX wrote:qemu-system-x86_64 -pflash OVMF.fd -hda hd.img -net none -m 4g -cdrom linux.iso
PeterX wrote:2. I have 4GB, the maximum for my PC.
I think I see the problem.
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: [SOLVED] Re: Qemu killed

Post by austanss »

klange wrote:
PeterX wrote:qemu-system-x86_64 -pflash OVMF.fd -hda hd.img -net none -m 4g -cdrom linux.iso
PeterX wrote:2. I have 4GB, the maximum for my PC.
I think I see the problem.
:shock: :shock: :shock:
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Qemu killed

Post by PeterX »

That's why I earlier already asked to reduce to 3GB ("-m 3g"). So that's probably a reason, ok, good to know.

My main mistake was probably that I assumed I would get a nice error message if out-of-memory was the reason. Now I know better.
User avatar
eekee
Member
Member
Posts: 891
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: [SOLVED] Re: Qemu killed

Post by eekee »

klange wrote:
PeterX wrote:qemu-system-x86_64 -pflash OVMF.fd -hda hd.img -net none -m 4g -cdrom linux.iso
PeterX wrote:2. I have 4GB, the maximum for my PC.
I think I see the problem.
Me too. :) -m 3g is a good start, but I just want to add that virtualization typically uses much more memory than it gives to the guest. (I'm not sure why.) Years ago, I found VMware using more than 4 times the RAM it gave to the guest. Qemu was much better, but still wanted more memory than I expected. I'd go down to -m 2g or even 1g on a 4GB host. Or, you know, install a Real Operating System as the guest; not the giant puffballs they make these days. :lol:
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: [SOLVED] Re: Qemu killed

Post by PeterX »

eekee wrote: -m 3g is a good start, but I just want to add that virtualization typically uses much more memory than it gives to the guest. (I'm not sure why.) Years ago, I found VMware using more than 4 times the RAM it gave to the guest. Qemu was much better, but still wanted more memory than I expected. I'd go down to -m 2g or even 1g on a 4GB host.
Thanks for the tip!
eekee wrote:Or, you know, install a Real Operating System as the guest; not the giant puffballs they make these days. :lol:
If you mean FreeDOS: No, that's too limited imho. But I agree on the giant puffballs comment :)

Greetings
Peter
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: Qemu killed

Post by nexos »

Shouldn't Linux just start swapping pages instead of killing QEMU? Performance would be horrible, but that makes more sense to me.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Qemu killed

Post by PeterX »

nexos wrote:Shouldn't Linux just start swapping pages instead of killing QEMU? Performance would be horrible, but that makes more sense to me.
I was kind of relying on that. Especially as I have a swap partition. But I guess in extreme memory situation Linux pulls the emergency brake. That's already better than old Linux which crashed in such situations :(

Greetings
Peter
User avatar
eekee
Member
Member
Posts: 891
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Qemu killed

Post by eekee »

I've seen Linux in some extremely heavy swap situations. I don't think I ever saw the kernel panic over memory, but there was something nearly as bad. When the OOM killer was first introduced it would just kill the biggest memory user, presumably on the assumption that it was a runaway process. However, on desktop systems of that era, the biggest memory user was invariably the X server. :) Killing the X server was nearly as bad as bringing down the entire system. I just turned off the OOM killer.

Detail recalled: With no OOM killer and very heavy swap, processes are somewhat more likely to crash. I'm not entirely sure why.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

Re: Qemu killed

Post by nullplan »

nexos wrote:Shouldn't Linux just start swapping pages instead of killing QEMU? Performance would be horrible, but that makes more sense to me.
The swap space is added to physically available memory for the purpose of OOM calculation. But if both RAM and swap space have run dry, the OOM killer will run. And the OOM killer will kill the biggest offender first, and on a 4GB system that will be the QEMU instance that is consuming at least 3GB.
Carpe diem!
Post Reply