OSX X11 Error cannot open display - macos

I am trying to run any GUI container I can on MacOS. With every container I try (firefox, chrome, tor, spotify, etc) I always get the error Error: cannot open display. And it's not specific to the docker run command where I pass the environment flag with my $DISPLAY. When I try to run xhost + I get the same error.
I have a fresh XQuartz installation. It is up and running. I have turned on "allow connections from network" under security. I've tried building my own images and pulling jessie frazelle's images. I do not suspect it is a docker issue or the Dockerfiles. It is something on the host, my laptop. I can't seem to figure out what it is.
MacOS Sierra 10.12.5
Docker 17.12.0 Stable
XQuartz 2.7.11 (xorg-server 1.18.4)
My local's $DISPLAY is set to :0.0

So I finally got this to work. And it seems it was pretty simple. I am not certain how this actually fixes the issue, but now the containers work.
How I fixed it was opening up XQuartz and then opening up the "Terminal" app from the "Applications" menu. Then running the command export DISPLAY=192.168.1.X:0, then xhost +. It outputted something like this "access control disabled, clients can connect from any host". After that I was able to run my docker run commands to launch the desired GUI containers.
I am still uncertain how this works and not running them from my laptops Terminal app, but it worked. It must be something I have set in my local env. Hopefully this helps someone else out who may be running into the same issues.

Based on #Byron's answer, I've found out that I could get it to work by running these 2 commands in the normal terminal:
export DISPLAY=:0
/opt/X11/bin/xhost +

Related

Can't run Fuchsia components with shell

So I am trying to get started developing on Fuchsia and I wanted to get the hello world component to run. However, following these steps doesn't work for me. I'm using core.qemu-x64 running on an Ubuntu 20.04 VM with Virtual Box. I have gotten the emulator to run with fx qemu -N but fx vdl start -N hasn't worked for me.
I run fx serve-updates but it just outputs "Discovery..." and never changes. Then I try to run fx shell run fuchsia-pkg://fuchsia.com/hello-world-cpp#meta/hello-world-cpp.cmx but it says "No devices found." It seem like this shouldn't be an issue because with Linux the device finder should automatically pick it up. Regardless I tried following the MAC instructions and setting the device with fx set-device 127.0.0.1:22. That just makes the run command say "ssh: connect to host 127.0.0.1 port 22: Connection refused". I also tried to set it to the device to the nodename outputted by the fx qemu -N command which is "fuchsia-####-####-####" but that just makes the run command say no devices are found again.
I have verified that I actually have the hello-world packages with the fx list-packages hello-world which outputs all the hello-world packages as expected.
Is there any way I can get the device to be discoverable by the shell command? Alternatively, can I run components like the hello-world component from the qemu emulator directly?
Please let me know if I can provide any additional information.
I guess I just wasn't patient enough. I assumed the emulator was done getting setup because it stopped giving console output and it allowed me to input commands but it seems I just had to wait longer. After 50 minutes of the fx qemu -N command running, the terminal that had fx serve-updates going finally picked up the device. Then I was able to execute the hello world component. It would be nice if the documentation at least gave an idea of how long the different commands would take before they'd be usable.

Cannot find the docker container running on port 80, tried everything usual

What happened:
I ran a container (vuejs-build website on a httpd:2.4) from shell (oh my zsh) on mac OS 11.2.2 using the previous docker release.
Then I updated the mac OS docker desktop.
Now the container is running but it's not showing on docker ps -a or docker container ls -a. I cannot find the process no matter what I try. Tried all the ps aux commands with grep, all lsof -wahtever, finding it in activity tool on mac. Even restarting the mac or stopping docker deamon does not stop it.
Has anybody a clue how to find it? I can open and refresh the webpage that is running in the container.
Docker version now says: Docker version 20.10.5, build 55c4c88.
PLEASE HELP!!
I solved it myself:
The container was stuck but restart seemed to have actually killed it.
However:
I realized that assets such as images are not being loaded despite JS and CSS is.
So I tried starting another httpd instance with docker run -p 80:80 httpd and reloaded. Firstly the same site as before appeared. But being able to start another httpd got me thinking.
The I opened dev tools in my browser. That disables Cache (using Chrome). Another hit on refresh then showed the "It works" page from httpd.
Some researching gave me the following theory: Vuejs stores the compiled Markup, JS and CSS on your browsers persistence storage. Probably for performance.

XQuartz $DISPLAY problems, cannot open xclock locally, cannot ssh -X

I am trying to solve a cascading series of bugs that started with me not able to copy to my macOS clipboard from remote ssh and has lead me to realize my X11 situation is seriously messed up. I have read a few other stackoverflow threads and they do not address my particular problems.
First my setup is macOS Mojave 10.14.5. I have xquartz 2.7.11 installed from the website. When I run echo $DISPLAY locally (on macOS) I get /private/tmp/com.apple.launchd.waagOnO6Qm/org.macosforge.xquartz:0.
Since I don't know where the error actually is I will list two problems I can identify currently.
Two problems:
If I run xclock locally nothing happens inside my terminal. I do notice that an "active" dot appears under the XQuartz dock icon for a second and then disappears. But after this happens my terminal still just hangs at xclock as though it is running.
If I try to ssh -X remote into a remote machine my terminal is locked out. I cannot keyboard interrupt. I ran this with -vvv to try to debug and I see that it hangs with xauth:
debug2: client_x11_get_proto: /opt/X11/bin/xauth -f /var/folders/jw/ltyk9x9n0_xb61jhdnct27fr0000gn/T//ssh-vcqwT7qh5yk2/xauthfile generate /private/tmp/com.apple.launchd.waagOnO6Qm/org.macosforge.xquartz:0 MIT-MAGIC-COOKIE-1 untrusted timeout 1260 2>/dev/null
Attempts to Solve
Other related stack threads have suggested reinstalling XQuartz, which I have done, both manually and with Homebrew. I have logged back out and in following reinstallation.
This thread suggested I solve my xauth problem by deleting .XAuthority file and recreating it. However, when I
xauth generate :0 . trusted
My XQuartz pops up a window saying XQuartz quit unexpectedly which I can provide the Report for if it helps. Then in the terminal it says
xauth: (argv):1: unable to open display ":0". Also I'm not sure this is the problem anyway because my .XAuthority file already contained an entry that it looks like this is trying to produce:
$HOST/unix:0 MIT-MAGIC-COOKIE-1 db7738324ca3662767b20b97b4a68680
Though it is concerning that running xauth is causing my xquartz to repeatedly quit unexpectedly (this dialog box is appearing multiple times).
This has been very frustrating to debug because I am not sure where the problem is, with xauth or xquartz somehow even though it is newly installed. Further, existing StackOverflow threads I have found detail the problem only with ssh -X but clearly I'm having problems locally, given that I can't even run xclock.
Any help is greatly appreciated.
The dot appearing and disappearing quickly indicates that the server process is terminating. This means that either the server crashed, the managing client (eg ~/.xinitrc) terminated, or we failed to even start xinit.
Almost every case I have ever seen of this has been due to someone doing something wrong in their init scripts (eg: ~/.bash*, ~/.profile, ~/.xinitrc).
Remove those and try again, then bisect to figure out the underlying issue.
However, the crash dialog from your "ssh" case indicates that it is likely the server crashing. You will need to look at the crash log for more information (or provide it here if you want help with that).

ERROR:browser_gpu_channel_host_factory.cc(121)] Failed to launch GPU process

i am trying to configure debugging port for google chrome extension for Visual studio for client side debugging in terminal using below commands and getting the below error,
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
[96138:85251:0321/103001.249367:ERROR:browser_gpu_channel_host_factory.cc(121)] Failed to launch GPU process.
Created new window in existing browser session.
i have tried export BROWSER=google-chrome too, but its not working. i hope i have to type this command in terminal . I am using MAC high Sierra , How can i resolve it.
I had a similar error when working with the bokeh python3 library on Ubuntu 16.04. I found a solution on a thread for jupyter notebook on github.
From: Github Issue
I had this same error
("ERROR:browser_gpu_channel_host_factory.cc(108)] Failed to launch GPU
process"). After running jupyter notebook, I would get a new tab in
google-chrome, but it would be blank.
Following but slightly modifying #wewan's advice, I ran "export
BROWSER=google-chrome". Then running jupyter notebook worked as
expected. I am using Ubuntu 16.04, Google Chrome 62.0.3202.62, and
Jupyter 4.3.0. Also, if this works, you'll obviously want to add the
export command to your .bashrc or .bash_profile
I did a raw export at the command line, and it corrected my issue.
export BROWSER=google-chrome
If this works, you will want to add this to your profile. I am not well-versed with Macs, but I believe there is a .bashrc file to which you can add the export.

PyCharm Docker Compose Debug Django

I've followed Jetbrains tutorial for setting up Docker Compose with remote python interpreter on Mac OS
https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html#debug
Everything works well - starting and composing services, manage.py commands etc. apart from debugging. Pycharm just won't stop on specific breakpoint and prints in PyCharm status bar - "Waiting for connection"
Did anyone experienced same issue?
This has happened to me, running docker network prune (to force docker to remap ips), then doing "invalidate cache and restart" has worked for me.

Resources