Azure and RHEL – “Can’t open display :1″… sometimes

azurerhel7vncx11

I have an RHEL image on Azure that we launch to perform some specialized tasks. There is not an option to actually keep the service running.

However, sometimes on startup, when I attempt to run even just xeyes, I get the following error:

$ xeyes
No protocol specified.
Error: Can't open display: :1

Other times, when we start it up using the exact same methodology everything works just fine. I can run everything from xeyes to VNC and all is just fine. I even take special precautions when creating the VM before running the waagent command since we launch the image in a Scale Set like creating the VNC instance (detailed later) and whatnot under a new user I add strictly for that purpose.

So here's my questions:

  • Does anyone know of any oddities that would cause this erratic behavior?
  • Is there anything anyone does to ensure that X starts?
  • Is there anything I can do to force VNC, etc. to start after X?

Note: I don't need to set up remote X access, just local.

The basic instructions that I followed are the Red Hat RHEL 7 TigerVNC instructions on the Red Hat site itself.

My workaround, at this point, is to build the VM with Chef and then kick off a process to rebuild everything using those instructions.

Best Answer

I can't comment yet, so I am putting this here.

I know this has a down-vote, but I tried this on my Azure account. I scaled up about 20 instances of the VM and not all of them worked - some did, some didn't. When I launched it again, I got a different number of up/down instances.

I added a shell script that follows the instructions link you provided to set up VNC in the request for launch. That seemed to work.

It works, but the only caveat was I had to wait for the network to become available. All I did special was add a ping -c 1 -W 1 SOME_REPO_URL and check the response code to wait for the network to become available (I had some issues with that).

It's a hacky work-around, but it at least functions.

Related Topic