OSMC ver 2016.01-1 -VNC Server doesn't autostart at boot

Got youtube working!!! Going to write up a post and create a new thread :slight_smile:

1 Like

Hi geedee,
and thanks for sharing your working configuration.
I’d like to give my little contribute providing a simple executable script that just executes all your command lines in one shot. Here it is:
// start of script file

sudo apt-get update
sudo apt-get install build-essential rbp-userland-dev-osmc libvncserver-dev libconfig+±dev

mkdir VNCserverOnOSMC
cd VNCserverOnOSMC/

sudo wget https://github.com/patrikolausson/dispmanx_vnc/archive/master.zip
unzip master.zip
cd dispmanx_vnc-master/

sudo cp dispmanx_vncserver /usr/bin/
sudo chmod +x /usr/bin/dispmanx_vncserver
sudo cp dispmanx_vncserver.conf.sample /etc/dispmanx_vncserver.conf

cp /boot/config.txt VNCserverOnOSMC/config.txt.orig
rm -rf VNCserverOnOSMC/dispmanx_vnc-master/

cp /boot/config.txt .
cat << EOF >> config.txt
// This enables HDMI resolutions when HDMI is not connected
// Group
// 1=CEA, used for connecting to consumer TV sets
// 2=DMT, used for connecting to a computer monitor
// CEA Modes
// 4 = 720p 60Hz
// 19 = 720p 50Hz
// 16 = 1080p 60Hz
// 31 = 1080p 50Hz
// DMT Modes
// 39 = 1360x768 60Hz
// 82 = 1920x1080 60Hz
sudo chown root:root config.txt
sudo mv config.txt /boot/config.txt

cat << EOF >> dispmanx_vncserver.service
Description=VNC Server
After=network-online.target mediacenter.service

ExecStartPre=/sbin/modprobe evdev

sudo chown root:root dispmanx_vncserver.service
sudo mv dispmanx_vncserver.service /etc/systemd/system/

sudo systemctl start dispmanx_vncserver.service
sudo systemctl enable dispmanx_vncserver.service
sudo systemctl daemon-reload

echo “”
echo ‘Type “sudo reboot”’
echo “”
echo “Once the RPi2 reboots you should be able to connect to it using a VNC viewer client.”
echo “Connect to RPi2 IP over port 5900”
echo “”
echo “command to disable auto start of vnc at system boot:”
echo " sudo systemctl disable dispmanx_vncserver.service"
echo “command to launch vnc server service manually:”
echo " sudo /usr/bin/dispmanx_vncserver"
echo “”
// end of script file

I think it’s faster than copy/past line by line

1 Like

This is awesome!!

Help me to use script how can i use hartigan script…

@galipy@hartigan has already modified my “mumbo jumbo” into a script.

from his post … copy the section of text between
// start of script file
// end of script file

save the file and execute the file on the osmc device.

You most likely will have to be execute the file as sudo (I did that)

To recap:

ssh to osmc device
sudo nano vncserver.sh
copy paste contents from above (@hartigan post)
Ctrl-O & Ctrl-X to save the file and exit
then run command to execute file
sudo vncserver.sh

I believe that is the exact steps I followed last week when I installed everything on the new pi3 device

Sudo vncserver.sh not working i am so noob ;)) pls describe me step by step pls… ; ((( may be attech .sh file pls…

Hi galipy,
as clearly explained by geedee … be sure that you started copying from line #!/bin/bash to line echo “” … that is to say:

If you copy and past the right lines, it will work for sure.
If not, please, report the error messages you get when execute sudo vncserver.sh … if any.

I copied from phone and all lines warped when i am get home i will try on pc thanks by the way ;))