Disable internal laptop display (Debian/Squeeze)

I have an HP nc6220 laptop that is constantly docked and attached to an external display via DVI. I only want to use the external display, and leave the internal LCD off/black/unused. This used to work perfectly and automatically in Ubuntu 11.04.

A few days ago the hard drive broke. I replaced the hard drive and decided to use Debian 6.0 Squeeze instead. Unfortunately Debian decided to insist on using the built-in LCD as primary display. I could correct it using the Monitor application under Preferences, but as soon as the screen was locked or resolution was changed (Flash video or something) things broke and I had to go back to the internal display to reconfigure using the Monitor application.

xrandr
There is a little utility called xrandr that can configure the display from the command line. For example, this is how to list available displays:

zo0ok@debian-workstation:~$ xrandr 
Screen 0: minimum 320 x 200, current 1600 x 1200, maximum 4096 x 4096
VGA1 disconnected (normal left inverted right x axis y axis)
LVDS1 disconnected (normal left inverted right x axis y axis)
DVI1 connected 1600x1200+0+0 (normal left inverted right x axis y axis) 408mm x 306mm
   1600x1200      60.0*+
   1280x1024      85.0     75.0     60.0  
   1280x960       60.0  
   1152x864       75.0  
   1024x768       85.0     75.1     70.1     60.0  
   832x624        74.6  
   800x600        85.1     75.0     60.3  
   640x480        85.0     75.0     60.0  
   720x400        70.1  
TV1 disconnected (normal left inverted right x axis y axis)

It is possible to disable displays and change resolution like this:

zo0ok@debian-workstation:~$ xrandr --output LVDS1 --off
zo0ok@debian-workstation:~$ xrandr --output DVI1 --mode 1600x1200

However, this is lost as soon as the display is locked or a full screen video is played.

xorg.conf
Years ago fixing xorg.conf was always the way to make video work in Linux. Nowadays, you should not need to. But, to disable the internal display completely, hacking xorg.conf was needed. I was assisted using this article.

This is what I did:

$ xrandr (to list my video devices: DVI1 and LVDS1)

CTRL-ALT-F1 (to leave X)
(login as root)

(turn off X video)
# /etc/init.d/gdm3 stop

(to generate a sample /etc/X11/xorg.conf)
# Xorg -configure
# cp /root/xorg.conf.new /etc/X11/xorg.conf

(edit xorg.conf)
# vim /etc/X11/xorg.conf

(start X again)
# /etc/init.d/gdm3 start

Of course, I needed to edit xorg.conf and restart gdm3 several times until I was satisfied.

One thing to note is how the Option “Monitor-XXX” contains the device name from xrandr.
The entire file xorg.conf follows, it is mostly auto generated, the critical parts are bold:

Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen      0  "Screen1" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
        ModulePath   "/usr/lib/xorg/modules"
        FontPath     "/usr/share/fonts/X11/misc"
        FontPath     "/usr/share/fonts/X11/cyrillic"
        FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"
        FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"
        FontPath     "/usr/share/fonts/X11/Type1"
        FontPath     "/usr/share/fonts/X11/100dpi"
        FontPath     "/usr/share/fonts/X11/75dpi"
        FontPath     "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
        FontPath     "built-ins"
EndSection

Section "Module"
        Load  "record"
        Load  "glx"
        Load  "dri"
        Load  "dbe"
        Load  "extmod"
        Load  "dri2"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/input/mice"
        Option      "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
        Identifier   "External DVI"
        Option "Enable" "true"
        Option "PreferredMode" "1600x1200"
EndSection

Section "Monitor"
        Identifier   "Integrated LCD"
        Option "Ignore" "true"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "AccelMethod"               # [<str>]
        #Option     "DRI"                       # [<bool>]
        #Option     "ColorKey"                  # <i>
        #Option     "VideoKey"                  # <i>
        #Option     "FallbackDebug"             # [<bool>]
        #Option     "Tiling"                    # [<bool>]
        #Option     "Shadow"                    # [<bool>]
        #Option     "SwapbuffersWait"           # [<bool>]
        #Option     "XvMC"                      # [<bool>]
        #Option     "XvPreferOverlay"           # [<bool>]
        #Option     "DebugFlushBatches"         # [<bool>]
        #Option     "DebugFlushCaches"          # [<bool>]
        #Option     "DebugWait"                 # [<bool>]
        Identifier  "Card0"
        Driver      "intel"
        VendorName  "Intel Corporation"
        BoardName   "Mobile 915GM/GMS/910GML Express Graphics Controller"
        BusID       "PCI:0:2:0"
        Option      "Monitor-DVI1" "External DVI"
        Option      "Monitor-LVDS1" "Integrated LCD"
EndSection

Section "Screen"
        Identifier "Screen1"
        Device     "Card0"
        Monitor    "External DVI"
        SubSection "Display"
                Viewport   0 0
                Depth     1
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     4
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     8
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     15
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     16
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     24
        EndSubSection
EndSection
  1. Hans Linkels

    xrandr is genial. I was used to the NVIDIA GUI applet but I was always afraid that it would fail at a presentation. I also assumed that it was for NVIDIA cards only which is probably a valid assumption. Now I have laptop with an i915 and xrandr simply does what I want it does with my displays.

  2. Samuel Orr

    This post helped me out, thanks! In my laptop the internal monitor stopped working. It was messing with external during boot and login. I just needed a sane config example to go off of so I didn’t break anything. Once again thanks. 🙂

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.