virtualbox - Why can I not set custom resolution for Ubuntu 12.04 running in a virtual machine?

16
2014-04
  • user130003

    I have installed Ubuntu 12.04 on the latest VirtualBox release and I cannot change the resolution.

    Here are the commands that i run:

    -- in Windows

    VBoxManage setextradata "Ubuntu" "CustomVideoMode1" "1920x1080x32"
    

    -- in Ubuntu

    ~$ gtf 1920 1080 32 
    
    # 1920x1080 @ 32.00 Hz (GTF) hsync: 35.20 kHz; pclk: 86.17 MHz
      Modeline "1920x1080_32.00"  86.17  1920 1992 2184 2448  1080 1081 1084 1100  -HSync +Vsync
    
    ~$ xrandr --newmode "1920x1080_32.00"  86.17  1920 1992 2184 2448  1080 1081 1084 1100  -HSync +Vsync
    xrandr: Failed to get size of gamma for output default
    

    Because this fails, xrandr --addmode does not work either. I kept searching the webs and there's a common reccurent theme with a file /etc/X11/xconf.org but this is apparently missing from my image.

    Also the scroll doesn't work.

  • Answers
  • jdpipe

    I found that for this VM screen-resizing to work properly on Ubuntu 12.04 guest VMs, you need to have a fairly recent version of the VirtualBox guest additions. It is not enough to use the version of VirtualBox distributed in the Ubuntu package repostories. I think that you can use VBoxGuestAdditions 4.1.24 and it will work with Ubuntu 12.04 guests. You need to install the 'dkms' package, possibly also 'kernel-headers', and after that the guest additions 4.1.24 can be installed from the .iso


  • Related Question

    graphics - How to add display resolution fo an LCD in Ubuntu 12.04? xrandr problem
  • SeregaI

    I am fresh for Ubuntu and Linux in general. I have installed Ubuntu 12.04 and stuck trying to setup correct resolution for my LCD display. The native resolution for the LCD is 1920x1080

    here is the output from xrandr:

    $ xrandr
    Screen 0: minimum 320 x 200, current 1280 x 720, maximum 4096 x 4096
    LVDS1 connected 1280x720+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
    1280x720 60.0*+
    800x600 60.3 56.2 
    640x480 59.9
    VGA1 disconnected (normal left inverted right x axis y axis)
    

    Then I create new modeline:

    $ cvt 1920 1080 60
    1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
    Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
    

    So far so good. Then I create new mode using xrandr:

    $ xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
    

    But for some reason that new mode was created for VGA (VGA1) output instead of LCD output (LVDS1):

    $ xrandr
    Screen 0: minimum 320 x 200, current 1280 x 720, maximum 4096 x 4096
    LVDS1 connected 1280x720+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
    1280x720 60.0*+
    800x600 60.3 56.2 
    640x480 59.9 
    VGA1 disconnected (normal left inverted right x axis y axis)
    1920x1080_60.00 (0xbc) 173.0MHz <---------- ????!!!!!!
    h: width 1920 start 2048 end 2248 total 2576 skew 0 clock 67.2KHz
    v: height 1080 start 1083 end 1088 total 1120 clock 60.0Hz
    

    So, if I try to add mode to LVDS1, I get an error:

    $ xrandr --addmode LVDS1 "1920x1080_60.00"
    X Error of failed request: BadMatch (invalid parameter attributes)
    Major opcode of failed request: 149 (RANDR)
    Minor opcode of failed request: 18 (RRAddOutputMode)
    Serial number of failed request: 25
    Current serial number in output stream: 26
    

    Adding that new mode to VGA1 works fine, but I don't use that VGA1 output.


  • Related Answers
  • zvineyard

    You can add missing resolutions to Ubuntu 12.04 using xrandr.

    First, use cvt to create a new resolution mode.

    sudo cvt 1920 1080 60
    

    Part of the output should be similar to this: "Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync" (w/o the quotes).

    Next, declare a new resolution mode.

    sudo xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
    

    Next, find out the name of your video device.

    sudo xrandr -q
    

    Mine was named "Virtual1" (running a virtual machine). Once you know the name of your device, you can, finally, add your new resolution mode to the device/system.

    sudo xrandr --addmode Virtual1 1920x1080_60.00
    

    See more information in the "Adding undetected resolutions" section here: https://wiki.ubuntu.com/X/Config/Resolution/#Adding_undetected_resolutions

  • elomage

    This link helped me.

    In short: run xrandr and cvt like you did, then create the following file:

    /usr/share/X11/xorg.conf.d/10-monitor.conf
    

    In the file change the parameters in < > according to your specs:

    Section "Monitor"
      Identifier "Monitor0"
      <INSERT MODELINE HERE>
    EndSection
    Section "Screen"
      Identifier "Screen0"
      Device "<INSERT DEVICE HERE>"
      Monitor "Monitor0"
      DefaultDepth 24
      SubSection "Display"
        Depth 24
        Modes "<INSERT MODENAME HERE>"
      EndSubSection
    EndSection
    
  • badgerhill