You are not logged in.

#1 2016-10-15 06:16:57

arthurg
Member
Registered: 2015-09-05
Posts: 23

[SOLVED]Problem in running GUI application with root after update

Hello,

I've updated my system today and stumbled across an error when launching a GUI application with mono..
I used to run it:

sudo ./MercuryProgrammer.exe

I know its not the right way, but it worked and never gave me any problems

After the system update, when I try to run this line on a terminal, I get this error:

No protocol specified

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---> System.ArgumentNullException: Could not open display (X-Server required. Check your DISPLAY environment variable)
Parameter name: Display
  at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) <0x40de3ae0 + 0x00ba7> in <filename unknown>:0 
  at System.Windows.Forms.XplatUIX11..ctor () <0x40de1c70 + 0x001df> in <filename unknown>:0 
  at System.Windows.Forms.XplatUIX11.GetInstance () <0x40de1970 + 0x0008b> in <filename unknown>:0 
  at System.Windows.Forms.XplatUI..cctor () <0x40de10d0 + 0x00137> in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Windows.Forms.Application.EnableVisualStyles () <0x40ddef00 + 0x00027> in <filename unknown>:0 
  at JM_Programmer.Program.Main () <0x40dded90 + 0x0000b> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---> System.ArgumentNullException: Could not open display (X-Server required. Check your DISPLAY environment variable)
Parameter name: Display
  at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) <0x40de3ae0 + 0x00ba7> in <filename unknown>:0 
  at System.Windows.Forms.XplatUIX11..ctor () <0x40de1c70 + 0x001df> in <filename unknown>:0 
  at System.Windows.Forms.XplatUIX11.GetInstance () <0x40de1970 + 0x0008b> in <filename unknown>:0 
  at System.Windows.Forms.XplatUI..cctor () <0x40de10d0 + 0x00137> in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Windows.Forms.Application.EnableVisualStyles () <0x40ddef00 + 0x00027> in <filename unknown>:0 
  at JM_Programmer.Program.Main () <0x40dded90 + 0x0000b> in <filename unknown>:0 

I checked my enviroment variable $DISPLAY and it is as follows:

echo $DISPLAY
:0

I've tried running gksu but got basically the same error, with one change only in the first line.
Instead of giving me a "No protocol specified" message, this came up

Invalid MIT-MAGIC-COOKIE-1 key

I've given a fair look in google and tried several approaches that could have helped me, but still no succes..

Does anyone have an idea of what might it be? When I run this program as my user, it opens, but i really need to open it as a root.

Thanks in advance.

Last edited by arthurg (2016-10-15 17:08:18)

Offline

#2 2016-10-15 07:10:52

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: [SOLVED]Problem in running GUI application with root after update

This is run under wine, right?  What if you invoke wine with sudo or gksu, passing wine the name of your mono program.

Now, <soapbox> What the hell are you doing?  Running large GUI apps as root is a bad idea.  Running Windows .NET crap under wine as root is a really, *really* bad idea.  Every time you run a GUI app as root, God kills a kitten; I don't even want to contemplate the consequences of running a dot-nyet in something that is not an emulator with root privileges.  </soapbox> Hey, but it is your system.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2016-10-15 16:36:59

arthurg
Member
Registered: 2015-09-05
Posts: 23

Re: [SOLVED]Problem in running GUI application with root after update

ewaller wrote:

This is run under wine, right?  What if you invoke wine with sudo or gksu, passing wine the name of your mono program.

Now, <soapbox> What the hell are you doing?  Running large GUI apps as root is a bad idea.  Running Windows .NET crap under wine as root is a really, *really* bad idea.  Every time you run a GUI app as root, God kills a kitten; I don't even want to contemplate the consequences of running a dot-nyet in something that is not an emulator with root privileges.  </soapbox> Hey, but it is your system.


Yeah I know it's really bad, but i only got to know that while researching on how to do it. Hehe
It is not a large GUI tho, it is a simple program to pass the code to an FPGA flash device. The thing is I cannot connect to the FPGA USB if i do not run it as sudo (I should figure out a way to do so).


EDIT: Did try running it by invoking wine and still no success... I think this new update is just forcing me to do the right thing then >.< Will create another thread to try and figure out how to connect to the board without root privileges

Last edited by arthurg (2016-10-15 16:42:29)

Offline

Board footer

Powered by FluxBB