Page 1 of 1
How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Tue Nov 07, 2017 5:28 pm
by Bosse_B
I have an RPi3 with Raspbian Stretch that I have worked on via the command line (SSH using PuTTY).
Now I want to use PiClone to make a backup of the system before I leave it in place, but I have no HDMI enabled monitor and PiClone is a GUI utility as far as I understand it...
So I thought of using VNC instead, but I don't know if one can enable it using the command line only?
Since it is Linux my guess is that it is possible, but how?
I believe that in Raspbian Pixel VNC was enabled by default but I don't know on this Stretch version. In any case my VNC viewer cannot connect to it so I guess it is non-active.
If it is not possible to enable using PuTTY there is a hen-and-egg problem here,,,
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Tue Nov 07, 2017 5:53 pm
by klricks
Find VNC in interface menu:
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Tue Nov 07, 2017 6:02 pm
by FTrevorGowen
Although I've not used/tried it, IIRC, there is a "command-line" version of "Pi-clone" (rpi-clone or similar?). Also, in principle, when connected via SSH (PuTTY) with x-forwarding enabled (and an X-windows compatible desktop on the remote machine) any "X-gui program" should display and be usable on the remote machine. (I've used such an approach for many years with other Unix/Linux boxes long before the Pi, and have continued to do so with my "headless" Pi's).
Trev.
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Tue Nov 07, 2017 6:07 pm
by Bosse_B
klricks wrote: ↑Tue Nov 07, 2017 5:53 pm
Find VNC in interface menu:
Thanks, raspi-config did the trick, but now I have a
very small screen to work inside...
If I measure correctly it is only 655x380 pixels...
Can the screen size on VNC be adjusted?
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Tue Nov 07, 2017 6:15 pm
by FTrevorGowen
Bosse_B wrote:
klricks wrote: ↑Tue Nov 07, 2017 5:53 pm
Find VNC in interface menu:
Thanks, raspi-config did the trick, but now I have a
very small screen to work inside...
If I measure correctly it is only 655x380 pixels...
Can the screen size on VNC be adjusted?
It's likely that the VNC server (by default) is using a "physical" display size/resolution defined in
config.txt or a "composite video" default due to there being no HDMI connection. What does
tvservice -s report? It's possible to launch a VNC mode that does not "clone" the "connected" (or presumed connected) display settings, IIRC, that's one of the VNC options (but don't recall the full details, sorry**).
Trev.
** Edit: Some more info. here:
https://www.realvnc.com/en/connect/docs ... y-pi-setup (Virtual Mode)
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Tue Nov 07, 2017 6:42 pm
by klricks
Bosse_B wrote: ↑Tue Nov 07, 2017 6:07 pm
klricks wrote: ↑Tue Nov 07, 2017 5:53 pm
Find VNC in interface menu:
Thanks, raspi-config did the trick, but now I have a
very small screen to work inside...
If I measure correctly it is only 655x380 pixels...
Can the screen size on VNC be adjusted?
Also use sudo raspi-config to set a forced screen resolution of your choice.
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Tue Nov 07, 2017 6:50 pm
by Bosse_B
klricks wrote: ↑Tue Nov 07, 2017 6:42 pm
Also use sudo raspi-config to set a forced screen resolution of your choice.
Right, I googled for some advice and found this solution so I could set it to a comfortable size!
Only "problem" was that I had to reboot afterwards. So before that I had to adjust the persistent iptables rules I had changed after the last boot so that the faulty firewall would not hit back in again....
Now working though.
Thanks for your help!
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Tue Nov 07, 2017 8:31 pm
by Bosse_B
Sorry to get back to this thread, but the reason I wanted to access the Pi desktop was that I read somewhere that Stretch includes a disk cloning utility that runs off the GUI screen. I think it is called PiClone, but now I cannot find this on any of he GUI menus and when I google Pi Clone I get to all kinds of unrelated old postings, not dealing with this new utility.
Can someone here please help me finding it?
Or should I open a new thread for this?
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Tue Nov 07, 2017 8:37 pm
by FTrevorGowen
Bosse_B wrote:
Sorry to get back to this thread, but the reason I wanted to access the Pi desktop was that I read somewhere that Stretch includes a disk cloning utility that runs off the GUI screen. I think it is called PiClone, but now I cannot find this on any of he GUI menus and when I google Pi Clone I get to all kinds of unrelated old postings, not dealing with this new utility.
Can someone here please help me finding it?
Or should I open a new thread for this?
The "GUI version" is (still) referred to as "SD Card Copier" in the menu system IIRC**.
Trev.
** I only have an old Jessie screenshot in my webpages:
http://www.cpmspectrepi.uk/raspberry_pi ... Screenshot
and it might (now) be in a different menu area.
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Tue Nov 07, 2017 9:03 pm
by Bosse_B
Indeed it is!
And I found a blog outlining the usage too:
Latest updates to Raspbian
SD Card Copier is the 3rd item down from the top.
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Mon May 06, 2019 1:16 pm
by ItayGal
The pure cli version would be:
Code: Select all
sudo ln /usr/lib/systemd/system/vncserver-x11-serviced.service /etc/systemd/system/multi-user.target.wants/vncserver-x11-serviced.service
sudo systemctl start vncserver-x11-serviced
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Thu Jul 11, 2019 5:00 pm
by c3pop
I suppose the following code using a symbolic link, with 'ln -s', is easier to understand.
Code: Select all
sudo ln -s /usr/lib/systemd/system/vncserver-x11-serviced.service /etc/systemd/system/multi-user.target.wants/vncserver-x11-serviced.service
sudo systemctl start vncserver-x11-serviced
Re: How to enable VNC on RPi3/Raspbian Stretch from command line?
Posted: Thu Jul 11, 2019 7:31 pm
by Bosse_B
I think this is a very old conversation.
I started it in Nov 2017 and since then RPi4 and Raspbian Buster are out....