xrandr interview questions
Top xrandr frequently asked interview questions
If I have only the internal monitor (LVDS1
) with an xrandr -o left
command. Now I want to attach a second monitor, say to HDMI1
. Then I'd like to rotate only the internal monitor, but not the external one. I tried the following (with no external attached though, since I am mobile currently), but that does not do anything:
xrandr --output LVDS1 -o left
How can I rotate only one monitor?
I do need some command line, since I want to put this into a script.
Source: (StackOverflow)
Some background: My old, well-loved laptop has kicked the bucket. The normally well-backlit screen is entirely, illegibly darkened. It seems to my inexpert inspection to be a hardware problem well beyond my ken.
My actual question regards my adaptation to this situation: I can still use the computer by attaching another monitor to the laptop and using that to satisfy my graphical needs. The default dual-screen behavior of Ubuntu is to treat the screens as a side-by-side affair, which is irksome since i can only see what's being displayed on one of the screens. I would like to configure Ubuntu (or xorg
, or what have you) to treat an attached screen as the single working screen, such that it does not attempt to use the built-in screen in any way.
I've considered (but not actually tried to make the default) the Mirror Displays option available in System Settings (in 14.04), but this seems to result in awkward resolution changes in an attempt to accommodate both screens (even though one of them I'm not concerned with in the slightest). I figure that if I'm lugging this laptop about to plug into many other available monitors, this would probably lead to some hair-splittingly weird visual inconsistency.
My more reasonable solution is to just try to use xrandr
to turn off the offending screen. In particular,
xrandr --output LVDS1 --off
appears to do what I was hoping, but this seems like a rather low-hanging, impermanent fix. (LVDS1 is the name of my built-in screen as X knows of it, as revealed by xrandr -q
.) I'm hoping to use something a bit deeper, so that I can be certain that I can use this laptop even in situations where I wouldn't have an X server running, say.
Source: (StackOverflow)
In xfce, I can run Settings -> Display to change my preferred output monitor. What I haven't found an option for is to have it automatically adjust to a change in available outputs.
For example, if I'm using a DVI display, but undock my laptop, XFCE will not automatically realize that I no longer have a working display and change the output. Gnome did do this, though I'm not sure through what service. I'd like to have some way of making sure I always have at least one working output automatically.
SIDE NOTE: This is related to another question of mine, If I just use a window manager and not a desktop environment, how do I get automatic dock/undock resolution updates?, but is for xfce, not any generic window manager.
Source: (StackOverflow)
I have not found a single solution to such errors, despite the rather large number of users out there who have them.
So I want to try to find a solution myself. However, I have no idea why they occur...
Is there anyone who knows why? You don't have say why each error occurs, just one would be great!
Examples:
BadMatch error:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 150 (RANDR)
Minor opcode of failed request: 18 (RRAddOutputMode)
Serial number of failed request: 18
Current serial number in output stream: 19
BadName error:
Error of failed request: BadName (named color or font does not exist)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 11 (RRQueryOutputProperty)
Serial number of failed request: 39
Current serial number in output stream: 39
Gamma Failed error:
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1920 x 1080, current 1920 x 1080, maximum 1920 x 1080
default connected primary 1920x1080+0+0 0mm x 0mm
1920x1080 0.0*
Source: (StackOverflow)
I have the following rule call my script when I dock or un-dock my ThinkPad:
# /lib/udev/rules.d/81-thinkpad-dock.rules
KERNEL=="dock.0", ATTR{docked}=="0", RUN+="/usr/bin/think-dock-hook off"
KERNEL=="dock.0", ATTR{docked}=="1", RUN+="/usr/bin/think-dock-hook on"
That is the script that will be called:
# /usr/bin/think-dock-hook
# Find the user who is currently logged in on the primary screen.
user="$(who -u | grep -F '(:0)' | head -n 1 | awk '{print $1}')"
su -c "bash -x /usr/bin/think-dock $setto" "$user" >> /root/think-dock.log 2>&1 &
And the script that is then called does something with xrandr
.
The thing is that I can run think-dock on
as my user (mu
) and it works. I can sudo -i
and run think-dock-hook on
and it works too. But when I let udev
run it, it just get the following error from xrandr
:
# output of bash -x think-dock on
+ xrandr --output LVDS1 --auto
Can't open display
Now if I call xrandr
from my sudo -i
shell, I get:
No protocol specified
No protocol specified
Can't open display :0
However, if I do su -c xrandr mu
from my sudo -i
shell, I get the expected output.
So I do not really understand, the script called from udev
fails.
Source: (StackOverflow)
Does the i915 driver support "overscan compensation"? If so, how can I enable it?
EDIT: Or is there any other driver for Intel's HD4000 graphic that supports "overscan compensation"?
Source: (StackOverflow)
I'm trying to adjust resolution on my new MSI GT70 2OC. In settings, only one resolution is available: 1920x1080. This is fine, except that I need to decrease the resolution and make it more rectangular for the laptop to work well with my old PL-550 tablet.
Here's what I do:
cvt 1200 1000 60
# 1200x1000 59.91 Hz (CVT) hsync: 62.19 kHz; pclk: 99.50 MHz
Modeline "1200x1000_60.00" 99.50 1200 1280 1400 1600 1000 1003 1013 1038 -hsync +vsync
sudo xrandr --newmode "1200_1000_60" 99.50 1200 1280 1400 1600 1000 1003 1013 1038 -hsync +vsync
xrandr: Failed to get size of gamma for output default
How do I get past this step?
UPDATE
Here's the output of xrandr
:
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1920 x 1080, current 1920 x 1080, maximum 1920 x 1080
default connected primary 1920x1080+0+0 0mm x 0mm
1920x1080 0.0*
Source: (StackOverflow)
I've been trying to set up an external monitor for a bit, finally got it mostly working except the resolution is off. My monitor's native res is 1600x900, which I finally got to show up in xrandr:
user:~$ xrandr
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 640 x 480, current 1024 x 768, maximum 1600 x 900
default connected 1024x768+0+0 0mm x 0mm
1024x768 0.0*
800x600 0.0
640x480 0.0
1600x900 59.9
However when I try to change the resolution I get the following error:
user:~$ xrandr --output default --mode 1600x900
xrandr: Failed to get size of gamma for output default
xrandr: Configure crtc 0 failed
Source: (StackOverflow)
I have a laptop connected to a second monitor using a vga port. No proprietary drivers used. When I go to System Preferences --> Monitor and I turn that on it doesn't look as it should, and it's rotated 90 degrees clockwise or anti-clockwise. I can't choose Normal on the rotation dropdown menĂ¹ in the monitor preferences.
I wonder if there is a workaround to make it look normal.
Source: (StackOverflow)
I want my screen to flash red so that it looks similar to getting hit by a rocket in Doom II, preferably using cli tools. I've seen that redshift does something similar just way too slow so I tried using xrandr but couldn't figure out how to do what I want properly.
Can xrandr (cli) do this and if so, how?
Also I'm using compiz. Maybe there is a way to do it with compiz using dbus-send?
Source: (StackOverflow)
I just installed some updates and restarted and after this then Ubuntu doesn't detect the external display. It's connected with HDMI. What can I do about it? It doesn't appear in display settings. I use a laptop and the builtin display is working and detected, but the external display quit workin after today's update. The computer is a Dell Latitude E7450.
$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Broadwell-U Integrated Graphics (rev 09)
~$ dmesg | grep -E 'VGA|HDMI'
[ 0.882972] fb0: VESA VGA frame buffer device
[ 5.718803] fb: switching to inteldrmfb from VESA VGA
[ 5.719040] [drm] Replacing VGA console driver
[ 6.224466] input: HDA Intel HDMI HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.0/sound/card0/input16
[ 6.224530] input: HDA Intel HDMI HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.0/sound/card0/input17
[ 6.224590] input: HDA Intel HDMI HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.0/sound/card0/input18
$ dmesg | grep -iE 'fail|error|skip'
[ 0.000022] Calibrating delay loop (skipped), value calculated using timer frequency.. 5187.65 BogoMIPS (lpj=10375316)
[ 3.285636] psmouse serio1: Failed to enable mouse on isa0060/serio1
[ 4.077454] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[ 5.849972] init: failsafe main process (612) killed by TERM signal
[ 7.787412] systemd-logind[854]: Failed to start unit user@123.service: Unknown unit: user@123.service
[ 7.787417] systemd-logind[854]: Failed to start user service: Unknown unit: user@123.service
[ 8.418720] systemd-logind[854]: Failed to start unit user@125.service: Unknown unit: user@125.service
[ 8.418725] systemd-logind[854]: Failed to start user service: Unknown unit: user@125.service
[ 9.170491] vboxdrv: module verification failed: signature and/or required key missing - tainting kernel
[ 16.373837] systemd-logind[854]: Failed to start unit user@1000.service: Unknown unit: user@1000.service
[ 16.373842] systemd-logind[854]: Failed to start user service: Unknown unit: user@1000.service
$ xrandr
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 173mm
1920x1080 60.0*+ 59.9 48.0
1680x1050 60.0 59.9
1600x1024 60.2
1400x1050 60.0
1280x1024 60.0
1440x900 59.9
1280x960 60.0
1360x768 59.8 60.0
1152x864 60.0
1024x768 60.0
800x600 60.3 56.2
640x480 59.9
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
Update
The following procedure solved the problem: Boot Ubuntu 14 live from a usb stick. Then reboot to the native installed Ubuntu and the external screen works.
Source: (StackOverflow)
What satisfactory solutions are there to achieve three monitors on Ubuntu? I know some ATI cards (Eyefinity) can support 3 monitors from a single card, but I don't know how well this is supported under Linux and besides, I've never had much luck with ATI on Linux.
The alternative is to try two cards, but there seem to be problems there too. It looks to me like xrandr cannot support 2 GPUs. I believe you'll end up with two separate "Screens" across which you cannot move applications or windows, unless you enable Xinerama which as I understand it disables some acceleration and probably compositing too.
I've found so much conflicting information on this online, I'm really confused. Please advise!
Source: (StackOverflow)
I am trying to run a script located in usr/local/bin/
when I connect an external monitor to my laptop. I have tried to add a new udev
rule but that did not work. I created a new file in /etc/udev/rules.d
called vga-monitor-connect.rules
. The contents of the file were
SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/panel-fix"
I took the line from this answer
After searching online I also tried the following rule
KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/rumesh/.Xauthority", RUN+="/usr/local/bin/panel-fix"
However this didn't work either.
I have run the script manually and I can confirm that it works so it is not a problem with my script.
I also want to make it clear that I do not know much about udev
so the rule I have used may be wrong. If anyone knows the proper rule for my problem please leave an answer.
My graphics card is an Intel GM965 integrated chipset
Source: (StackOverflow)
My notebook is connected to a HDTV through a KVM Switch (one other notebook also connected to the same HDTV). The problem seems to be that Ubuntu doesn't recognize the HDTV to be turned on and therefore doesn't enable the VGA output. As far as I understand it has something to do with EDID information not being send trough the KVM Switch.
xrandr won't enable the VGA output through xrandr --output VGA1 --auto
, it just keeps showing as disconnected.
Can I somehow force the VGA port to send a signal?
My Graphics Controller:
Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)
Source: (StackOverflow)
I tried to use xrandr
to set 1680x1050 as a new mode to VGA output, but it says:
sudo xrandr --addmode VGA-0 1680
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 18 (RRAddOutputMode)
Serial number of failed request: 35
Current serial number in output stream: 36
Source: (StackOverflow)