Home > other >  Qemu - system - x86_64 command to create a virtual machine, the GTK initialization failed problem fo
Qemu - system - x86_64 command to create a virtual machine, the GTK initialization failed problem fo

Time:01-10

The younger brother today based on packages platform, using the QEMU tool to create a virtual machine, as follows:
1. Create qcow2 vm images
Qemu - img create -f qcow2/images/vm1 qcow2 8 g
2. The qemu - system - x86_64 command is as follows:
Qemu - system - x86_64 -m 512-4 - enable - KVM SMP - the boot order=dc - hda/root/howl/vm1 qcow2 cdrom/root/howl/SLES_SP1_x 86 _64. Iso

Get an error message is as follows:
Unable to init server: Could not connect: connection refused.
GTK initialization failed.

Please advise, where is the problem? Or what additional information is needed? Thank you,

CodePudding user response:

Increase the options - nographic

CodePudding user response:

Hi,

Ps -u

The process of sudo kill off xorg

CodePudding user response:

The above said is wrong, and change, ps - e not ps -u

CodePudding user response:

Recently had the wrong, in the absence of xwindow run qemu, according to the need to use - nographic to disable can, otherwise the error,
If you execute xrandr can find the correct display, that there is no need to disable display, if it is in the code calls the executable file,
For example:
Arge [itr++]=const_cast & lt; Char * & gt; (image_path c_str ());
Arge [itr++]=NULL;
Pid_t id=fork ();
If (id==0)
{
Execve ("/usr/bin/qemu - system - x86_64 ", arge, envp);
} the else
{
return id;
}
This code will be submitted to the error of the building Lord, because execve environment variable is not set in the display, you need to use the third into the ginseng to add: char * envp [2]={0} "display=: 0.0,;
  • Related