How to change virtual screen resolution on Ubuntu (connecting via VNC without real display connected)?

493

Solution 1

It sounds like you are using the vino server to share the desktop via VNC. Although I think you can change your /etc/X11/xorg.conf, or whatever the X config file is now, I have another suggestion. Leave the X config alone and create another session for your vnc.


Install vnc

$ sudo apt-get install vnc4server

Create vnc start and stop scripts

vnc.sh

#!/bin/sh

vncserver :12 -name "My-Server" -geometry 1600x1100

vnc-kill.sh

#!/bin/sh

vncserver -kill :12

12 is just an arbitrary display number. You will use this when you connect to the server. It can be any number except 0. That is what the vino server uses by default (I think). Don't forget to chmod +x the scripts.

Optional: Start vnc session on boot

Add the vnc.sh to your /etc/rc.local so that the session will start when the computer starts. sudo vi /etc/rc.local and add this to the end before the "exit 0"

su - YourUserName -c "/home/YourUserName/bin/vnc.sh"

I run the vnc server as a user here. I don't want the server to run under the root context. Replace the "YourUserName", of course. Alternatively, you do not need to put this here, you could ssh in and run the "vnc.sh" script manually. Your call.

Set your vnc password

(this is separate from the other vnc desktop password)

$ vncpasswd

Edit your vnc session file

$ vi ~/.vnc/xstartup

Comment out everything and put this at the end

gnome-session &

Test it

Run your vnc.sh script and connect from another computer.

vncviewer.exe -connect Server:12

Solution 2

You could consider changing the resolution on the VNC server? I'm not sure of your setup but if the VNC server is on the virtualized machine you could check the vncserver instantiation point and change the -geometry flag there?

Alternatively, I would look at xorg.conf and add the mode you are looking for, since xrandr is saying its not availiable. This article covers the basics of xorg.conf editing

Solution 3

I'm able to change my vncserver resolution at will with the following command:

vncconfig -set randr=1552x1175 ; xrandr -s 1552x1175

( HT Matt D.)

Share:
493

Related videos on Youtube

prabu
Author by

prabu

Updated on September 17, 2022

Comments

  • prabu
    prabu over 1 year

    I have the below procedure were the loop is breaking if the cursor does not have any record in it. I would like to contine the iteration even if the cursor does not have any record.

    My procedure is,

    CREATE OR REPLACE PROCEDURE "MAPSADMIN"."FORECAST_MAINTENANCE_SCH" (
      in_carrierCode VARCHAR2,
      in_WindowPeriodStr VARCHAR2,
      out_forecastRecords OUT types.cursortype
    )
    IS
      vtailAndCheckCur types.cursortype;
      vForecastRecsCursor types.cursortype; 
      vtailNo VARCHAR2(10);
      vmaintCheckType VARCHAR2(10);
      vforcastRecords forecastObjectsList := forecastObjectsList();
      forcastRec forecastObjectsList := forecastObjectsList();
    BEGIN
    dbms_output.enable(null);
       OPEN vtailAndCheckCur FOR
          select td.tail_number,mpm.maint_check_type 
          from tail_details td, maint_plan_tail_map mptm, maint_plan_master mpm
          where td.tail_number = mptm.tail_number
          and mpm.maint_plan_code = mptm.maint_plan_code
          and mpm.carrier_code = in_carrierCode
            UNION
          select td.tail_number,mpm.maint_check_type 
          from tail_details td, maint_plan_subfleet_map mptm, maint_plan_master mpm
          where td.subfleet_code = mptm.subfleet_code
          and mpm.maint_plan_code = mptm.maint_plan_code
          and mpm.carrier_code = in_carrierCode;
        LOOP
          FETCH vtailAndCheckCur INTO vtailNo, vmaintCheckType;
          dbms_output.put_line( vtailNo||' '||vmaintCheckType );
          FORECAST_OBJS_LIST(vtailNo,vmaintCheckType,in_WindowPeriodStr,vForecastRecsCursor);
              LOOP           
                forcastRec.EXTEND;
                forcastRec(forcastRec.COUNT) := FORECASTOBJECT(null,null,null,null,null,null,null,null,null,null);
                 dbms_output.put_line( 'test');
                FETCH vForecastRecsCursor INTO 
                    forcastRec(forcastRec.COUNT).maintNextPlanCode,
                    forcastRec(forcastRec.COUNT).tailNumber,
                    forcastRec(forcastRec.COUNT).maintNextCheckType,
                    forcastRec(forcastRec.COUNT).maintNextCycleCheckLabel,
                    forcastRec(forcastRec.COUNT).maintNextStartDate,
                    forcastRec(forcastRec.COUNT).maintNextEndDate,
                    forcastRec(forcastRec.COUNT).maintNextDueDate,
                    forcastRec(forcastRec.COUNT).maintNextCalendarDays,
                    forcastRec(forcastRec.COUNT).maintForecastFactor,
                    forcastRec(forcastRec.COUNT).maintCheckColor;
                    dbms_output.put_line( forcastRec(forcastRec.COUNT).maintNextPlanCode);
                EXIT WHEN vForecastRecsCursor%NOTFOUND;
              END LOOP;
    
          EXIT WHEN vtailAndCheckCur%NOTFOUND;
    
        END LOOP;
    
       CLOSE vtailAndCheckCur;
        OPEN out_forecastRecords FOR
          SELECT tailNumber,maintNextCheckType,maintNextPlanCode,maintNextCycleCheckLabel,maintNextStartDate,
          maintNextEndDate,maintNextDueDate,maintNextCalendarDays,maintForecastFactor,maintCheckColor
          FROM TABLE(CAST(forcastRec AS forecastObjectsList));
     EXCEPTION
      WHEN OTHERS THEN
      dbms_output.put_line(DBMS_UTILITY.FORMAT_ERROR_STACK);
    END FORECAST_MAINTENANCE_SCH;
    

    /

    Here if vForecastRecsCursor returns without 0 records in it i am getting ORA-01001: invalid cursor. Anyone please explain how to iterate further by ignoring the error.

    Thanks in advance

  • GJ.
    GJ. over 13 years
    Thanks, it works great for a new desktop. However, I need to use an existing desktop with various open windows already there. Is there a way I can connect to the original display :0 with a different geometry?
  • GJ.
    GJ. over 13 years
    ... alternatively is there a way to move all windows in a single batch operation from the the main display to this new VNC display?
  • SuperJames
    SuperJames over 13 years
    Although I have not tried it yet, I believe that you can use "x11vnc" in the place of the "vncserver" above, with a specific -geometry parameter. This should give you access to the :0 display. I looked for parameters to the gnome vino server, but could not find any.
  • alexs
    alexs over 10 years
    I would not advise you to close a cursor in the WHERE OTHERS section without checking for cursor%ISOPEN. Just imagine that an error was triggered before, or when, you open one of the the cursors!
  • Wale Bayo
    Wale Bayo over 9 years
    What is vncconfig? You mean vnc4config?
  • Ross Rogers
    Ross Rogers over 9 years
    Suse calls it vncconfig.
  • Wale Bayo
    Wale Bayo over 9 years
    Ah, right then :)