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

I installed ver 2016.01-1 a cpl of days ago and have been “tweaking it” to look and work the way my OCD feels somewhat comfortable :grin: :grin:

I found and followed all the documentation in the forums for doing the following tasks:

  1. Changing the password of osmc correctly
  2. Mounting external hdd to /mnt/blah and not /media/blah
  3. adding record in smb-shares.conf so I can browse from my window laptop
  4. Installing VNC server for remote access to the GUI forum link to install VNC

VNC server works fine if I manually start it, but it doesn’t auto start on boot.

The exact steps and order in which I installed VNC are:


//install vnc server on osmc
osmc@lmc:~$ sudo apt-get install build-essential rbp-userland-dev-osmc libvncserver-dev libconfig+±dev
osmc@lmc:~$ sudo wget https://github.com/patrikolausson/dispmanx_vnc/archive/master.zip
osmc@lmc:~$ unzip master.zip -d /home/osmc/
osmc@lmc:~$ sudo rm master.zip
osmc@lmc:~$ cd /home/osmc/dispmanx_vnc-master/
osmc@lmc:~$ make
osmc@lmc:~$ sudo cp dispmanx_vncserver /usr/bin
osmc@lmc:~$ sudo chmod +x /usr/bin/dispmanx_vncserver
osmc@lmc:~$ sudo modprobe evdev
osmc@lmc:~$ sudo cp dispmanx_vncserver.conf.sample /etc/dispmanx_vncserver.conf
osmc@lmc:~$ cd

osmc@lmc:~$ sudo nano /etc/modules
evdev
Ctrl-O & Ctrl-X to save the file and exit

osmc@lmc:~$ sudo nano /boot/config.txt
// This enables HDMI resolutions when HDMI is not connected
hdmi_force_hotplug=1

// Group
// 1=CEA, used for connecting to consumer TV sets
// 2=DMT, used for connecting to a computer monitor
hdmi_group=1

// CEA Modes
//  4 =  720p     60Hz
// 19 =  720p     50Hz
// 16 = 1080p     60Hz
// 31 = 1080p     50Hz
// DMT Modes
// 39 = 1360x768    60Hz
// 82 = 1920x1080   60Hz
hdmi_mode=16

Ctrl-O & Ctrl-X to save the file and exit

osmc@lmc:~$ sudo nano /etc/systemd/system/dispmanx_vncserver.service
[Unit]
Description=VNC Server
After=network-online.target mediacenter.service
Requires=mediacenter.service

[Service]
Restart=on-failure
RestartSec=30
Nice=15
User=root
Group=root
Type=simple
ExecStartPre=/sbin/modprobe evdev
ExecStart=/usr/bin/dispmanx_vncserver
KillMode=process

[Install]
WantedBy=multi-user.target

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

Ctrl-O & Ctrl-X to save the file and exit

//command to launch vnc server service manually
osmc@lmc:~$ sudo /usr/bin/dispmanx_vncserver


In the above steps, I am not sure if I need to add the last 3 lines
" sudo systemctl start dispmanx_vncserver.service
sudo systemctl enable dispmanx_vncserver.service
sudo systemctl daemon-reload
"
to the end of ‘dispmanx_vncserver.service’.

Maybe the order of commands is wrong? Not sure. I know enough about Linux to know when I am running around in circles chasing my tail, which I appear to be doing trying to get the vnc service to auto start.

Hopefully someone can tell me what I am doing wrong based on my steps above. If I need to add some logs or get outputs of any commands that will aid in troubleshooting do let me know.

Thanks
GD

2 Likes

These are the commands you have to execute on the command line after you have created the service file, they should not be part of the service file

1 Like

Gahhhhh!!! I feel so dumb … :disappointed:

Thanks a ton for helping me fix this!!!

Now on to more OCD stuff … :grin:

1 Like

Working config for anyone else who is trying to configure VNC on ver 2016.01-1.

Thanks fzinken once again!!


//install vnc server on osmc
osmc@lmc:~$ sudo apt-get install build-essential rbp-userland-dev-osmc libvncserver-dev libconfig+±dev
osmc@lmc:~$ sudo wget https://github.com/patrikolausson/dispmanx_vnc/archive/master.zip
osmc@lmc:~$ unzip master.zip -d /home/osmc/
osmc@lmc:~$ sudo rm master.zip
osmc@lmc:~$ cd /home/osmc/dispmanx_vnc-master/
osmc@lmc:~$ make
osmc@lmc:~$ sudo cp dispmanx_vncserver /usr/bin
osmc@lmc:~$ sudo chmod +x /usr/bin/dispmanx_vncserver
osmc@lmc:~$ sudo modprobe evdev
osmc@lmc:~$ sudo cp dispmanx_vncserver.conf.sample /etc/dispmanx_vncserver.conf
osmc@lmc:~$ cd
osmc@lmc:~$ sudo nano /etc/modules
evdev
Ctrl-O & Ctrl-X to save the file and exit

osmc@lmc:~$ sudo nano /boot/config.txt
// This enables HDMI resolutions when HDMI is not connected
hdmi_force_hotplug=1
// Group
// 1=CEA, used for connecting to consumer TV sets
// 2=DMT, used for connecting to a computer monitor
hdmi_group=1
// CEA Modes
// 4 = 720p 60Hz
// 19 = 720p 50Hz
// 16 = 1080p 60Hz
// 31 = 1080p 50Hz
// DMT Modes
// 39 = 1360x768 60Hz
// 82 = 1920x1080 60Hz
hdmi_mode=16
Ctrl-O & Ctrl-X to save the file and exit

osmc@lmc:~$ sudo nano /etc/systemd/system/dispmanx_vncserver.service
[Unit]
Description=VNC Server
After=network-online.target mediacenter.service
Requires=mediacenter.service
[Service]
Restart=on-failure
RestartSec=30
Nice=15
User=root
Group=root
Type=simple
ExecStartPre=/sbin/modprobe evdev
ExecStart=/usr/bin/dispmanx_vncserver
KillMode=process
[Install]
WantedBy=multi-user.target
Ctrl-O & Ctrl-X to save the file and exit

osmc@lmc:~$ sudo systemctl start dispmanx_vncserver.service
osmc@lmc:~$ sudo systemctl enable dispmanx_vncserver.service
// output rcvd. after previous command is executed … Created symlink from /etc/systemd/system/multi-user.target.wants/dispmanx_vncserver.service to /etc/systemd/system/dispmanx_vncserver.service.//
osmc@lmc:~$ sudo systemctl daemon-reload
osmc@lmc:~$ sudo reboot

// Once the RPi2 reboots you should be able to connect to it using a VNC viewer client. Connect to RPi2 IP over port 5900

//command to launch vnc server service manually
osmc@lmc:~$ sudo /usr/bin/dispmanx_vncserver

// disable auto start of vnc at system boot (CPU hog!!!)
osmc@lmc:~$ sudo systemctl disable dispmanx_vncserver.service
// output rcvd when service is disabled … Removed symlink /etc/systemd/system/multi-user.target.wants/dispmanx_vncserver.service.//

fzinken :raised_hands:


Just a main reminder vnc is eating quite some CPU so only install it as a service if it is what you use on a daily base. Otherwise just manually start it via ssh when you need it

1 Like

I noticed that yesterday when I was using it. thanks for the heads up!! I am going to leave it so that it auto starts at boot for a week or so while I get everything setup and working.

To undo the auto start at system boot, is it safe to assume that one only has to comment out these lines

Under [Unit]
After=network-online.target mediacenter.service
Under [Service]
Restart=on-failure
RestartSec=30

Thanks,
GD

To disable the service leave the script untouched just execute. sudo systemctl disable

1 Like

Thats why i suggested to install the vnc server from that github repo instead, in my guide.

It has cpu optimization.


As you can see i am running VNC to post that image…and on the background i am also running PHP and Mysql…look how low my cpu is.

I agree the new vncserver has much better idle CPU but anyhow question really is if it make sense to have it running 24/7 if you only use it from time to time.

Since with the new server it stays idle until you connect, i dont see why. Logging in through ssh just to enable/disable it before making a connecting is just so…80’s :stuck_out_tongue:

Still havent figured out how to allow copy/paste from PC->Pi though…If anyone has any insights about this ?!

@Sandbird - I am pretty sure I used the link from github repo that you asked folks to use.

When I was running it the other day, I noticed the CPU’s fluctuate between 10% - 21% constantly. Maybe something else that I was doing on the device at the same time was causing the fluctuations, but I am not sure.

I am still “tinkering around” with the system but once I have everything figured out I’ll install everything from scratch and verify if the CPU’s are still dancing to their own tune or it was my “tinkering” that was the culprit :slight_smile:

1 Like

Are you sure you are not moving the mouse when you are checking the cpu ? Even in Windows if you move the mouse the cpu spikes. I usually leave htop running a few seconds without doing anything to get a more stable reading.

:frowning: … forgot to post my followup and final update …

after a fresh install I didn’t see the CPU spikes I was seeing initially when I started this post.

As much as I hate to admit it, I did something or had a process running in the background that was the culprit :frowning: :pensive:

But, the good thing is I now know how to convert it to a manual process if I ever need to do so :slight_smile: :slight_smile:

hehe nice. I have 4 backups of my pi2 image now. Each backup after a huge milestone. I’ve learned the hard way to always ‘save’ my progress. Now that you have a stable system, back it up…cause if you mess it up tomorrow you’ll have to start over again :stuck_out_tongue:

yes sir, I make sure I take a backup of the device before I login via ssh now :slight_smile:

lol, ok you’ve gone to the far side of paranoid now but yeah…i feel your pain :stuck_out_tongue:

Yep, went to the other end of the spectrum :):slight_smile: Crashing the device without knowing how I did it made me go … hmmmm, lol

Trying to figure out if I will gain anything from moving the ‘thumbnails’ folder or not currently.
Next on the agenda is to see if I can get the youtube addon to work without the dreaded “daily limit exceeded”.

I left the thumbnails alone, every 2-3 months i use the phplite trick to clear the thumbnail entries in the db and just delete all the image files after that. Spending 2 minutes every 3 months is not too much. http://www.htpcbeginner.com/clear-xbmc-thumbnails-cache-and-remove-unused-thumbnails/

Never had that youtube problem, but then again, i am too busy with all the other ‘goody addons’ i have on to spend time on youtube hehe

Thumbnails issue is now resolved!!!
:bow: Sandbird :raised_hands:

I want to keep youtube around and working for occasions when the guys are over and we just feel like watching stuff that has no practical purpose in our lives :stuck_out_tongue_closed_eyes:

I respect your authoritah ahaha.
Vimeo has a plugin for kodi as well. I think its about the same…and no limits there. But yeah, when it comes to youtube…no idea. I’ve seen an addon that ‘fixes’ this limiter, but the author kinda abandoned the project.
But if you search “kodi youtube limit fix” on google i see some January videos there that might help