screen resolution as headless server

Jan 02, 2018 40 Replies

I am new to the raspberry pi but not to Linux. My plan is to connect to the Raspberry Pi through VNC but with no screen, keyboard etc attached to the RP.



I have managed to do this using my Ubuntu machine as client and it works fine except for the screen resolution.



When I have a screen physically attached to the RP, the image on my client screen is fine. However, when there is no screen attached the image on my client drops to 640X480 which means that icons look huge and windows overlap the screen size.



I need to tell the RP that it has a high resolution screen even when none is attached.



Any ideas?



Best Regards, Jack Fearnley, enthusiastic new user.


The simplest way I've found is to edit /boot/config.txt and add:

framebuffer_width=1920 framebuffer_height=1080

or whatever size you want.

Knute Johnson

Curiosity: why use VNC when you can use SSH? The RPi default installation starts sshd and IIRC "X11Forwarding yes" is set by default - more or less has to be otherwise you couldn't run GUI programs on the RPi.

IME the screen colour palette is usually better with a forwarded X11 connection than it is with VNC.

I just ran a test here by executing "zenity --calendar", both locally and over X11 from my RPi and it looks very much as if the copy of zenity running on the RPi is getting the screen size passed to it from this laptop because the zenity calendar display put up by the RPi is very similar in size and font size to that shown by a locally run copy.

To double check, I ran up a full screen application on this laptop and another copy via ssh on my house server: both put up identical sized windows containing identical font sizes: this laptop is a Lenovo T440 with an 1600x900 display while the house server has an ancient flat VGA display.

I'm running Raspbian on the RPi and 64-bit Fedora 27 on both laptop and house server, but I'd be surprised if Ubuntu doesn't do exactly the same as Fedora.

HTH

Martin | martin at Gregorie | gregorie | dot org

which vnc server/client do you use?

I use whatever comes with the RP. It's called VNC server.

On Ubuntu I have used Remmina but am currently using Vinagre which renders the screen wallpaper better.

Jack

I looked at /boot/config and uncommented the relevant lines and it worked perfectly.

Many thanks, Jack

Thanks for this.

I am using VNC because I want an exact image of the RPi screen on my Ubuntu. I am learning about networking which has always been a mystery to me. Perhaps your approach is simpler but I would probably need some hand holding to get it working.

I bought the RPi so that I could do these kind of experimental setups without compromising my main computer.

Jack

Sorry to bump in on conversation. Question at end

Knute Johns>> the Raspberry Pi through VNC but with no screen, keyboard etc attached to

I _usually_ use the Raspberry Pi through VNC from my desktop, where I have a FHD screen and would like that res. But on the RPi I also have mouse, KB and screen connected. On that, the screen is an old Viewsonic

19" 1440*900, so it gives that res to VNC-connection.

Can I have different resolutions for local and remote connections??

----------------------------------------------------- Thomas Wendell Helsinki, Finland Translation to/from FI/SWE not always accurate -----------------------------------------------------

That's exactly what I have always done, probably because I started doing this sort of thing before VNC existed! :-)

However I agree about display etc., it always seems a bit clunky when using VNC. Horses for courses though, if you want to run a number of GUI programs remotely then VNC probably makes sense. I tend to simply run a couple of ssh connections to command line on the Pi and maybe just one or two GUI programs as needed.

Chris Green

I've always used ssh -X (or -Y) to get a forwarded X connection when running GUI applications remotely, for example my Calibre server runs headless so when I need the GUI I just run ...

ssh -Y calibre@library

... from any machine with a display and the authorised keys (the calibre user has shell set to the calibre GUI). There are no other X clients in that jail, in particular no desktop environment, window manager or even terminal. The only things the server exports are the GUI application and a web interface, you can get to the console with physical access but the console runs in text mode and can't display the calibre GUI.

It always seemed wrong to forward the desktop when all you want is the application(s), even more so when there is no desktop to forward.

Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. | http://www.sohara.org/

I have been using the facility of X apps to fowraed to a remote server.

This is the script I use to start and redirect an X application (kaffeine) to a machine that has logged in with ssh

#!/bin/sh # start in the right place cd /var/videos # this fixes some errors that I don't understand export $(dbus-launch) #detect IP address of remote client IP=`echo $SSH_CONNECTION | awk '{print $1}'` #redirect pulse audio to it PULSE_SERVER=$IP:'4713' # set default X display to remote client DISPLAY=$IP:0.0 # DBUS_SESSION_BUS_ADDRESS="" export PULSE_SERVER export DISPLAY #kaffeine > /dev/null 2>&1 kaffeine

On the client machines you need something like

xhost + ssh -t myserver pathtomyscript

assuming you have passwordless ssh set up.

Ex of gigabit ethernet, this isn't fast enough to play movies, but its good enough for most other purposes

"Women actually are capable of being far more than the feminists will let them."

You're doing the same as I do, however there are cases where this doesn't work too well.

For example if you have a relatively slow connection running X across the connection is very slow indeed (try running a web browser using X, it's not really practical). Using VNC in this case make things usable.

I still, like you, nearly always use 'ssh -X .....'.

Chris Green

I seem to have started quite a fruitful conversation.

Just to add to the mix, I notice that the Minecraft program just produces a black screen on my Ubuntu client running VNC.

What makes this different?

Jack

VNC doesn't forward e.g. openGL direct rendering.

VNC uses the actual desktop. TightVNC does make virtual desktops and they can be any size. It may be possible with VNC too but I've never tried it.

Knute Johnson

You can download the RealVNC viewer from realvnc.com for Linux or Windows. I like it better than vinagre.

Knute Johnson

That's horribly insecure.

Remove the references to DISPLAY above, and just do:

ssh -X -C

to tunnel the X session back over ssh, rather than making the X server available for the whole world to see what you're doing and tamper.

Andrew Gabriel [email address is not usable -- followup in the newsgroup]

Understood, though as I said, you may find the colour resolution a bit ropey since IME vnc crams the colour info into fewer bits than SSH uses.

I think its worth looking at, since you can use the scp and sftp utilities for scriptable or command-line file transfers. In addition, quite a lot of GUI ftp clients, such as gftp, also implement the SFTP file transfer protocol, so don't need an ftp server to be running on the RPi.

It may also be worth knowing that a networked RPi can also use source version control systems, e.g. csv and git, to access code repositories on your other hosts.

Martin | martin at Gregorie | gregorie | dot org

Oh dear.

The whole world?

That would be me and just who?

No one else is on the network

And any car parked near enough to have the wifi would be extremely visible, and there are no cars along this lane

New Socialism consists essentially in being seen to have your heart in the right place whilst your head is in the clouds and your hand is in someone else's pocket.

This may be teaching grandma to suck eggs, but... are you sure - IOW do you know that your external LAN interface is secure? Have you tested it?

A surprising number of them aren't, having 'features' such as exposing their admin port to the outside world as well as to the LAN and default admin passwords which a lot of people never change.

I hardened mine so that, according to Gibson Research Labs Shields-Up tool [*], it now leaves nothing visible to the outside world. This required configuration changes from its default setup as well as a password change.

[*]
formatting link
Martin | martin at Gregorie | gregorie | dot org

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required