LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   xrandr from remote through ssh? (https://www.linuxquestions.org/questions/linux-general-1/xrandr-from-remote-through-ssh-869084/)

UnknownUser 03-16-2011 11:12 PM

xrandr from remote through ssh?
 
I just tried to deactivate the VGA connection on my laptop remotely and received this result:

Code:

$ export DISPLAY=:0
$ xrandr
No protocol specified
Can't open display :0
$

I'm nearly certain I was able to use xrandr through ssh at some point in the past, but my memory of the exact time line is inadequate. It seems that what I attempted should be possible, does anyone know how to accomplish this? Searching the internet I found the procedure which I expected to work, the one which just failed for me.

corp769 03-17-2011 12:14 AM

Try using the following:
Code:

export DISPLAY=:0.0

UnknownUser 03-17-2011 01:02 AM

Code:

$ export DISPLAY=:0.0
$ xrandr
No protocol specified
Can't open display :0.0
$


jschiwal 03-17-2011 01:08 AM

The :0.0 display is local to my desktop. The :10.0 display is for my laptop. My laptop is the ssh client.

Code:

xrandr -display :0.0 -q
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 1920 x 1920
DFP1 disconnected (normal left inverted right x axis y axis)
DFP2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 287mm
  1920x1080      60.0*+
  1776x1000      60.0 +
  1680x1050      60.0 
  1400x1050      60.0 
  1280x1024      75.0    60.0 
  1440x900      59.9 
  1280x960      75.0    60.0 
  1280x800      75.0    60.0 
  1152x864      75.0    60.0 
  1280x768      74.9    59.9 
  1280x720      60.0 
  1024x768      75.0    70.1    60.0 
  800x600        72.2    75.0    70.0    60.3    56.2 
  720x480        60.0 
  640x480        75.0    72.8    60.0 
CRT1 disconnected (normal left inverted right x axis y axis)
CRT2 disconnected (normal left inverted right x axis y axis)
jschiwal@elite:~> xrandr -display :10.0 -q
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 320 x 175, current 1440 x 900, maximum 1440 x 900
default connected 1440x900+0+0 0mm x 0mm
  1440x900      50.0*
  1024x768      51.0    52.0    53.0    54.0    55.0 
  832x624        56.0 
  800x600        57.0    58.0    59.0    60.0    61.0    62.0    63.0    64.0 
  720x400        65.0 
  700x525        66.0    67.0 
  640x512        68.0    69.0    70.0 
  640x480        71.0    72.0    73.0    74.0    75.0    76.0 
  640x400        77.0 
  640x350        78.0 
  576x432        79.0 
  512x384        80.0    81.0    82.0    83.0    84.0 
  416x312        85.0 
  400x300        86.0    87.0    88.0    89.0    90.0 
  360x200        91.0 
  320x240        92.0    93.0    94.0    95.0 
  320x200        96.0 
  320x175        97.0


UnknownUser 03-17-2011 01:29 AM

I'm not sure what you have demonstrated. I only have one display per host. I can only access the client display by prefixing it with localhost, as in "localhost:12.0".
Code:

xrandr -display :0.0
is the equivalent of
Code:

export DISPLAY=:0.0
xrandr

could you please clarify how you have a display :0.0 and a display of :10.0?

To clarify, I'm not using the laptop in the traditional manner. My desktop is the ssh client, the laptop is serving as a display only with no keyboard or mouse, hence the need to manipulate things remotely.

I feel the "No protocol specified" is the important bit of information, but I don't understand what it means.

jschiwal 03-17-2011 02:52 AM

The ssh server creates a proxy for X11 connections. This proxy will had a DISPLAY of either :10.0 or :11.0.

For example, my laptop is named qosmio. My desktop is named elite. When I'm at my laptop and enter: "ssh -X elite konsole", a konsole shell is displayed on my laptop. It is running on my desktop (ssh server) and displayed on my laptop (ssh client).
Entering "echo $DISPLAY"
localhost:11.0

The program, konsole, is using localhost:11.0 for the display. The ssh server setup a proxy for my laptop's display on the desktop. It uses a different display.

Now if I enter in the ssh remote terminal:
mplayer video.mpg
the video will display on my laptop. (note: not the audio however)
If I run instead "mplayer -display :0.0 video.mpg" it will be displayed on my desktop's screen.

You are logging remotely into a laptop. The :0.0 display will refer to the laptop's first display. For a dual head interface the VGA port may be the localhost:0.1 display.

After logging in, enter:
xrandr -q :0.0
to display info on the LCD screen.
xrandr -q :0.1
to display info on the VGA screen. I'm not certain if a monitor needs to be connected. If not, a screen may not be setup for it.

If you use
xrandr -display :0.1 --prop
you may be able to see info on the VGA display, including verifying it is the VGA display.

On an HP laptop I once had, I would need to power cycle the laptop, after plugging in my TV, before the SVHS connector would be active. I found this was even true for the SVHS output on my Sony receiver with a Video switch.

UnknownUser 03-17-2011 03:24 AM

Alright, so we are indeed talking about the same thing. As I type this message into firefox using my desktop monitor (on the left) and my desktop keyboard and mouse, firefox is running on my laptop (a much more powerful machine with much much more memory). My laptop is connected to another monitor (on the right).

Usernames and hostnames removed:
Code:

$ ssh -X laptop
password:
Linux 2.6.32-5-amd64 #1 SMP Wed Jan 12 05:14:59 UTC 2011 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
No mail.
Last login: Thu Mar 17 05:19:42 2011 from
$ xrandr -d :0.0 -q
No protocol specified
Can't open display :0.0
$

I think we are all in consensus that this should be working? It isn't working.

Also, maybe worth mentioning is that on the laptop, X is no longer located on Alt+F7, it is now on Alt+F8. The desktop is still running Debian 5.0 (lenny) with X on Alt+F7.

Also, in case anyone was wondering, if I walk over to the laptop and open a terminal window in X I can use xrandr to manipulate display :0.0 without incident. However if I switch to tty1 I get the same errors as when coming in through ssh. From the desktop, if I use Alt+F1 to login through tty1 I can successfully manipulate it's display. Surely this is strange?

jschiwal 03-17-2011 03:38 AM

Try -d :0.1 if you switched to an external monitor. For example using a Fn key to cycle between displays may effect whether :0.0 or :0.1 exists.

Also check the /var/log/Xorg.0.log file on the laptop. It will tell you with displays are used.

One thing to note. Running firefox starts a wrapper script which may end up running firefox on the local machine if there is already an instance running, i.e. on ssh client. Use the "-no-remote" command line option if you want to run firefox remotely. (seems misnamed to me) I discovered this accidently. Entering "firefox --help" will show you what the command line options are.

UnknownUser 03-17-2011 03:44 AM

Trust me, firefox is running on the laptop, this desktop is a 1Ghz Athlon with 128 Mb of memory, I could tell the difference after waiting 5 minutes for the program to load.

See my last post, edited while you were posting.

UnknownUser 03-17-2011 03:49 AM

Perhaps I was confusing... what I typed looks confusing to me.

Do this:

Press Ctrl+Alt+F1 to access login screen of tty1
login
type xrandr -d :0.0 -q

it works right? It works on my desktop.

It isn't working on my laptop... something has changed and I don't understand what it is.

jschiwal 03-17-2011 06:00 AM

Is an X server running on the laptop?

Did you log in with ssh to the laptop before running "xrand -d :0.0 -q" and "xrand -d :0.1 -q".

Do you have physical access to the laptop? does the LCD screen work?

If you want to disable the VGA port on the laptop, why not just unplug it?

UnknownUser 03-17-2011 06:13 AM

Quote:

Originally Posted by jschiwal (Post 4293643)
Is an X server running on the laptop?

Yes, gdm is running so there is always an X server.
Code:

/usr/bin/Xorg :0 -br -verbose -audit 0 -novtswitch -auth /var/run/gdm3/auth-for-Debian-gdm-ROqYBW/database -nolisten tcp vt8
Quote:

Originally Posted by jschiwal (Post 4293643)
Did you log in with ssh to the laptop before running "xrand -d :0.0 -q" and "xrand -d :0.1 -q".

Yes. I also attempted logging in locally through tty1. It only works from a terminal window within the current X session on the laptop.

Quote:

Originally Posted by jschiwal (Post 4293643)
Do you have physical access to the laptop? does the LCD screen work?

Yes, it is cracked, but I can use it. See my previous post about switching to tty1.

Quote:

Originally Posted by jschiwal (Post 4293643)
If you want to disable the VGA port on the laptop, why not just unplug it?

That works, true. This isn't something that I can't work around, but seeing as how this worked in Debian 5.0 and now does not work in Debian 6.0 I'd like to discover why for my sanity's sake.

jschiwal 03-18-2011 08:07 AM

Power down the laptop, unplug the VGA cable, and power back up. I'm betting that the card won't enable the port if it's unplugged and "xrandr -display :0.1" won't have a result.

UnknownUser 03-28-2011 02:23 AM

Sorry, to have left this thread for so long. Some updates became available, and after installing them the problem disappeared. So, it's unsolved, but solved just the same.

stefank 06-11-2014 05:47 AM

As this was my first hit on google for a similar problem, I'd like to comment in this old thread.

In my case (Gentoo/KDE combination on the remote system) "xrandr -display :0.0 -q" would only work if the user (used for ssh) was actually logged in on the remote machine (i.e. had an active X session). "xrandr" did never work from ssh and always gave "Can't open display".

I don't know if this intended behaviour or can be fixed somehow.


All times are GMT -5. The time now is 06:14 AM.