0

I guess this is maybe one simple command but I haven't found it so far.

I'm running an Ubuntu-Server 16.04 LTS. Usually I have no Display connected to it, but since it runs an application which needs a GUI I have a cronjob set up to start the xfce4 GUI:

@reboot startx

And in ~/.config/autostart/myscript.sh I'm starting the application.

This works all fine.


My problem is: Sometimes I have to change something in the configuration and I cannot do this via the terminal but have to use the GUI of the application.

But when I connect a display on the running Server it stays black.

After rebooting it recognizes the display again. But if I disconnect it now, xfce4 fails and ends the session (=> also terminates my application.)

So that until now I always have to go

  1. connect the display
  2. reboot the Server
  3. do stuff in the GUI
  4. disconnect the display
  5. reboot server again

This is ofcourse very stupid and the application shouldn't go down just because of a little config change so: Is there any way to make the server recognize the display without a reboot?

I found this answer and running

xrandr --query -display :0.0

actually says

Screen 0: minimum 8 x 8, current 1024 x 768, maximum 32767 x 32767
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 connected (normal left inverted right x axis y axis)
   1920x1080     60.00 +  50.00    59.94
   1920x1080i    60.00    50.00    59.94
   1680x1050     59.88
   1400x1050     59.95
   1600x900      60.00
   1280x1024     75.02    60.02
   1440x900      59.90
   1280x800      59.91
   1152x864      75.00
   1280x720      60.00    50.00    59.94
   1024x768      75.08    60.00
   800x600       75.00    60.32
   720x576       50.00
   720x480       60.00    59.94
   640x480       75.00    60.00    59.94
   720x400       70.08
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

But the display is still saying

No signal

and goes black.


Update
As suggested by dessert I ran

xrandr --output HDMI2 --auto

This responds

Can't open display

7
  • 1
    There is no option -display, it's either -d or --display, did you mean that? “Connected” is not the same as “enabled”, please try enabling the output with xrandr --output HDMI2 --auto.
    – dessert
    Mar 7, 2018 at 11:36
  • @dessert Thanks I don't know, in the answer I linked there is a comment from Nikola Malešević who used -display :0.0 and it actually gave me information about the connected display so I guess it also works. I'll try the --output HDMI2 --auto asap
    – derHugo
    Mar 8, 2018 at 6:12
  • Interesting, an undocumented option style, and therefore something like -d:0 without a space doesn't work in xrandr, that's an unusual design decision. Whatevs, in general for a connected output the output of xrandr reads just e.g. HDMI2 connected (normal…, an enabled one lists the currently used and available resolution modes, e.g. HDMI2 connected 1280x800+0+0 (normal… with a list of resultions including the refresh rate below. Ping me if it helps and I'll extend it to an answer.
    – dessert
    Mar 8, 2018 at 9:32
  • Are there any news, did you manage to solve the issue?
    – dessert
    Mar 16, 2018 at 18:46
  • Hi I'm very sorry coming back so late .. I had a lot of other things this month ;) Please see my update: I tried "xrandr --output HDMI2 --auto" from ssh (since I have no other option) but it says "Can't open display". My guess is that I still have to tell xrand somehow which display to use since the ssh shell obviously doesn't have one
    – derHugo
    Mar 19, 2018 at 13:24

1 Answer 1

0

The suggestens by dessert pointed in the right direction.

I just had to add -display :0.0 again to make it work so the complete command was

xrandr -display :0.0 --output HDMI2 --auto

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .