I'm trying to run gedit in cygwin, but receiving error - cygwin

I'm trying to run some normal text editor in cygwin (version 2.4.1(0.293/5/3)).
I've really disappointed and frustrated with emacs :( So I downloaded and installed gedit as a part of cygwin package, but when I'm trying to run it, I receive:
$ gedit
Unable to init server: Could not connect to 127.0.0.1: Connection refused
(gedit:8196): Gtk-WARNING **: cannot open display:
I understand that it can be somehow connected with security issues (it runs on multiuser win10 PC), but I cannot find out how to solve it....
Please help!

I was having the same problem and was able to solve. Your case may be the same
install Cygwin/X
open cygwin and start x11 server by typing
startxwin >/dev/null 2>&1 &
set DISPLAY environment variable as explained here by typing
export DISPLAY=:0.0
Start gedit normally

This (startxwin >/dev/null 2>&1 & export DISPLAY=:0.0) work for temporary, not permanent. It is needed to type each time I close terminal.

Related

MATE Terminal; has stopped working; returns "Failed to parse arguments: Cannot open display:"

I installed the MATE desktop environment into my onprem EC2 instance as per this URL;
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-linux-2-install-gui/
And was able to kick-off terminal commands such as;
mate-terminal --window --zoom=2 --geometry=30x12 --command timer.sh &
Which opened a terminal window and looped over printing the date and time until killed.
Now, I get
Failed to parse arguments: Cannot open display:
I think this might be due to the following, as it caused problems with TigerVNC ;
$> chmod 775 /home/ec2-user
I have tried setting DISPLAY to "localhost:0.0" and ":0.0" but to no avail.
I know its related to gnome but I just can't find enough documentation, so any help is appreciated?
Chris

adding tk-8.6.8 package for cygwin

I install and run PWgui-6.2 in cygwin, and get this message
"couldn't load file "/usr/bin/tk86.dll": No such file or directory
while executing
"load /usr/bin/tk86.dll Tk"
("package ifneeded Tk 8.6.8" script)".
I guess the package tk-8.6.8 is lacked in cygwin so I try to add this package. However I can't find out this package from repository.
Could you help me to solve this problem?
The answer is here: Cannot launch git gui using cygwin on windows, and this is essentially a duplicate question. The problem is that
gitk and git gui require X11 in Cygwin.
Solution
Install some of the Cygwin X11 packages:
Run the Cygwin installer again.
Install "xinit" under the X11 category, accepting all the dependencies.
(Windows Start menu should now include: Cygwin-X)
Start menu > run XWin Server
In Cygwin shell, run
export DISPLAY=:0.0
At this point I got "Authorization required, but no authorization protocol specified", so to fix that set
enable_xauth=0 in \bin\startxwin
(Note:)
Will need to run XWin Server every time you reboot, and set export DISPLAY=:0.0 every time you open a new Cygwin shell. (Run echo "export DISPLAY=:0.0" >>~/.profile to have it run automatically whenever a new shell is started).
If you get couldn't connect to display ":0.0", mouse over the X that should be in Windows taskbar tray, the pop-up should say something like Cygwin/X Server:1.0. Use that ":1.0" (or similar) instead as the value for export DISPLAY.
Install windows Git.
Uninstall git from cygwin repo.
Set the environment Path for Git "C:\Program Files\Git\cmd" and move it above C:\cygwin64\bin

Using tmux through Cygwin: "open terminal failed: not a terminal"

I'm trying to use tmux on a Windows Computer. I successfully installed tmux using
apt-cyg install tmux
I can confirm successful installation because I get the following:
$ tmux -V
tmux 2.3
However, when I try to type "tmux" in the console, I get the following error:
open terminal failed: not a terminal
Any thoughts?
It sounds like the terminal you're using doesn't support full tty emulation. Clients like mintty (comes with Cygwin---or should, anyway), putty, rxvt for Windows, &c. will handle that. CMD, ConEmu, and Cmder won't.
There's not much to be done here without a huge ordeal (See second comment: https://news.ycombinator.com/item?id=8577817). Unsatisfying though it may be, the best answer is to make sure you're running mintty. CYGWIN.bat should run it out of the box, so if that's not working, try running it directly from Explorer instead of from CMD. Otherwise, you might need to poke around in the batch file and make sure C:\Cygwin64\bin\mintty (or what have you) is being called.

cygwin/X version 1.17 xinit version 1.3.* breaks run.exe

i have been using cygwin/X for many years and have not had any major problems, until the upgrade of xinit to version 1.3.x, it breaks everything without any warning at all. people wonder why open source gets such a bad reputation, it's this kind of blindsiding that does it...
anyway, prior to xinit 1.3.x i started Xwin via the Xwin icon. i could then start xterm (or emacs or any X application) using run.exe which i would pin to the taskbar. my command line is as such:
D:\cygwin\bin\run.exe -p /bin bash ~/scripts/xterm.sh
my xterm.sh is as follows:
export DISPLAY=127.0.0.1:0.0
xterm &
exit
this has worked like a charm for YEARS, now it doesn't do anything.
even doing this in a windows cmd:
set DISPLAY=127.0.0.1:0.0
d:\cygwin\bin\run.exe -p /usr/X11R6/bin xterm
doesn't work anymore...
does anyone know how to start an Xwin application (xterm, emacs ...) via the dos command line ...
Try to set DISPLAY to :0.0 (not 127.0.0.1:0.0). Source.

Raspberry Pi Tkinter via shh and xming

I'm trying to run a Tkinter script from a raspberry, via an ssh client and xming. Once I've logged into the pi via shh I use the command:
gksudo python3 home/pi/PythonScripts/TkinterTest.py
This is the error that is given on my PC:
(gksudo:2700): Gtk-WARNING **: cannot open display:
and a different error on my laptop running the same software:
(gksudo:3227): GLib-CRITICAL **: g_str_has_prefix: assertion 'str != NULL' failed
I have tried to change the display with the command:
export DISPLAY=:0.0
But this had no effect on the output.
First of all be sure that the X forwarding is actived on your raspberry, you can check that in /etc/ssh/sshd_config: X11Forwarding yes
ssh -X username#<raspberry> (-X flag for the X11 forwarding)
Run your script : (su) python /path/to/script.py
Sometimes when you try to run program via sudo you can have some error, you need to check the permissions of .Xauthority file
I had a similar problem. I know this Question is 3 years old. But my search landed me here. So just answering the question
sudo cp ~pi/.Xauthority ~root/
This just copies the X11 authority file directly to root without the xauth command management. This will make all active user pi X11 connections available for use by root without having to sort through and find the correct one.
P.S : I'm just copy pasting, credit goes to this answer in this forum

Resources