set headless ubuntu linux display resolution

957

Perhaps try creating an /etc/X11/xorg.conf file with something like:

Section "Device"
Identifier "VNC Device"
Driver "vesa"
EndSection

Section "Screen"
Identifier "VNC Screen"
Device "VNC Device"
Monitor "VNC Monitor"
SubSection "Display"
Modes "1280x1024"
EndSubSection
EndSection

Section "Monitor"
Identifier "VNC Monitor"
HorizSync 30-70
VertRefresh 50-75
EndSection

... where 1280x1024 would be replaced by the resolution you want.

I did not test it myself; this is from http://ubuntuforums.org/showthread.php?p=8636175 (first post).

Share:
957

Related videos on Youtube

Porcupious
Author by

Porcupious

Updated on September 18, 2022

Comments

  • Porcupious
    Porcupious over 1 year

    I am trying to convert ip addresses to hostnames. I tried the answer given here. While the linux command "host" works for all the ip addresess I have, this code only works for some of them. Why would this be?

      InetAddress addr = InetAddress.getByName("192.168.190.62");
      String host = addr.getHostName();
      System.out.println(host);
    
    • Tom Fishman
      Tom Fishman over 12 years
      The monitor's name is showing as "Laptop" for some reason.
    • Raptor
      Raptor over 9 years
      Where is your code ?
    • Porcupious
      Porcupious over 9 years
      I've just added in the code I'm using. I basically took it from the other answer on stackoverflow.
    • Raptor
      Raptor over 9 years
      The code works or not depend on your DNS.
    • Porcupious
      Porcupious over 9 years
      I'm on a corporate network. Is there a way/need for me to force the DNS server or such? I'm surprised that the command "host" and this work differently, I would have expected them to be identical.
    • Raptor
      Raptor over 9 years
      I just noticed you use private IP. Do you want to resolve computer host name instead (then this is not related to DNS, sorry for confusion). See this
    • Porcupious
      Porcupious over 9 years
      I'm actually not sure which one I want. However, it seems to me like the computer hostname works, but DNS resolves do not. Maybe host is smart enough to do reverse DNS but InetAddress is not? (for intranet dns server maybe)
  • Tom Fishman
    Tom Fishman over 12 years
    It doesn't work for me. My ubuntu is using remote desktop sharing for me to vnc. So the resolution is pre-determined at booting time. xorg.conf doesn't seem to affect the resolution so far.
  • Tom Fishman
    Tom Fishman over 12 years
    It doesn't work for me. My ubuntu is using remote desktop sharing for me to vnc. So the resolution is pre-determined at booting time. this "geometry" option doesn't affect the result.
  • sciurus
    sciurus over 12 years
    "My ubuntu is using remote desktop sharing for me to vnc." Can you try to explain this in more detail? How is TightVNC started?
  • Porcupious
    Porcupious over 9 years
    I tried using that, and I got the same result. Atleast, there are ip addresses that neither getHostName() or getCanonicalHostName() are unable to return a valid value, but "host" does.
  • Martin Frank
    Martin Frank over 9 years
    as mentioned in the doc, it says the result will be returned based in the system configuration name lookup service maybe you can edit this configuration (hosts.txt)?