So you’d think that since I got VNC Viewer working smoothly on my Raspberry Pi (Raspbian OS) that it’d be just as simple to add my desktop PC (Ubuntu 18.04), but then you’d be just as wrong as I was.
Apparently, Raspberry Pi’s ship with a VNC server already configured, which is why it was as simple as just enabling the VNC option itself. Instead, I will need to go through a lengthy guide to install and configure a VNC server so I can then connect to it via my RealVNC Viewer app. Good times!
So why am I going through all this trouble, you ask? Well, my desktop PC has the neural network installed on it, and that is what I’d like to utilize to create captions for memes and IG posts. The raspberry pi is a great energy efficient unit that can easily run scripts all day, but it definitely doesn’t have the hardware necessary to run a neural network.
Instead, my goal is that a raspberry pi script would wake up my sleeping desktop, generate neural network outputs, and have them saved to the shared external drive for the Instagram accounts to use for making memes and writing captions daily during the week. Sounds simple, amirite?
sudo apt update sudo apt upgrade sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils sudo apt install tigervnc-standalone-server tigervnc-common vncserver
Unfortunately it seems something went wrong, so I’m going to just skip over to a new guide and see if I have better luck. On to How to Install and Configure VNC Server on Ubuntu 18.04 LTS!
sudo apt update sudo apt -y install vnc4server sudo apt install xfce4 xfce4-goodies vncpasswd vncserver :1
Aaaaaaaaaaaand same error. ARGH. Looks like this issue is not isolated to me, but right now I’ll have to do more Googling to figure out the best way forward. I thought it might be this issue where the password file wasn’t properly created, so I tried to look into my files (nautilis) but it wouldn’t open. FML
ps awx | grep nautilus #determines the nautilus process ID sudo kill -TERM <id> #enter the ID from the previous command sudo apt-get install --reinstall nautilus-data #reinstalls nautilus files
And I decided to restart, it took a LONG time for my system to shut down, but it seems to have fixed my files software. My victory was short lived though, since I tried running the “vncserver :1” command and received the error AND broke my files software again. So time for another reboot (and I don’t mean the sweet 90s show).
Before I continue, I’m going to take a moment to create a new backup since I’m starting to worry I might really destroy my PC in this process. As my dad always said, better safe than sorry.
After backing up, I checked and did not see a “xstartup” file that was supposed to be created when making my password. So I opened my text editor, copy and pasted the code provided by nlee2 and saved it in my /home/catjitsu/.vnc folder. Honestly this is a complete shot in the dark and I am guessing not going to work.
OMFG IT WORKED!!!
WTF THIS NEVER HAPPENS TO ME EVER I COULD GD CRY!!! THAT’S IT I’M TOTALLY DRINKING A GLASS OF WINE TONIGHT!
……sorry, ok, calming down, let’s get back to these instructions.
Now that I read through, the very first guide I was following actually states that a xstartup file needs to be made, BUT it still has you try and start the server even though you can’t since the startup file isn’t made yet. So I’m going to go back to following that one and ditch this other guide.
vncserver -kill :1 chmod u+x ~/.vnc/xstartup sudo nano /etc/systemd/system/vncserver@.service
In “vncserver@.service” file I copy and pasted:
[Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=simple User=catjitsu PAMName=login PIDFile=/home/%u/.vnc/%H%i.pid ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :%i > /dev/null 2>&1 || :' ExecStart=/usr/bin/vncserver :%i -geometry 1440x900 -alwaysshared -fg ExecStop=/usr/bin/vncserver -kill :%i [Install] WantedBy=multi-user.target
I used “Ctrl+X” and confirmed “Y” to save and close the file. Then in my terminal I continued plugging away with commands.
sudo systemctl daemon-reload sudo systemctl enable firstname.lastname@example.org sudo systemctl start email@example.com
And it seems to be working! REJOICE!
…but my victory seemed to be short lived. After it worked fine, I went to do the next step and SSH in but it didn’t work. I tried to restart the server and now I’m getting an error “vncserver@1: Failed with result”. If this all gets to be a dead end, then I can try this suggestionto use something other than VNC to remote into my desktop.
But for now I’ll return back to guide #2 I was using earlier to see if that’ll help me finish this nightmare up.
sudo nano ~/.vnc/xstartup #opened xstartup file to edit exec /usr/bin/startxfce4 & #added this to the end of the file vncserver :1 -geometry 800x600 -depth 24 ssh <username>@<vnsserverip> -C -L 5901:127.0.0.1:5901\
Still didn’t work–but then I discovered that apparently Ubuntu does not come pre-configured with SSH… And once I ran the following it all seemed to work!
sudo apt-get install openssh-server openssh-client ssh <username>@<vnsserverip> -C -L 5901:127.0.0.1:5901\
And now I’m able to log in to VNC Viewer by connecting to “VNC Servier: localhost:5901” as long as I start a vnc session each time my PC is turned on by running the command: vncserver. To log on with my laptop (also running Ubuntu 18.04) I ran the above commands and then was able to use VNC Viewer to access my desktop.
And with that, I’m done for today! Hopefully when this PC sleeps I’m still able to remote into it. But who knows!