VNC remote desktop - screen is black

5,504

It turns out that the solution is to remove the Anaconda framework from the $PATH environment variable. So in my case the users /home/<username>/.bashrc file needs the following field commented out to look something like:

#__conda_setup="$('/home/<username>/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
#if [ $? -eq 0 ]; then
#    eval "$__conda_setup"
#else
#    if [ -f "/home/<username>/anaconda3/etc/profile.d/conda.sh" ]; then
#        . "/home/<username>/anaconda3/etc/profile.d/conda.sh"
#    else
#        export PATH="/home/<username>/anaconda3/bin:$PATH"
#    fi
#fi
#unset __conda_setup

Run source .bashrc. Remote desktop is then possible. Once the connection is established and you are on the remote desktop, uncomment the above lines and run source .bashrc to be able to use Anaconda within the remote desktop session.

Share:
5,504

Related videos on Youtube

Jacques MALAPRADE
Author by

Jacques MALAPRADE

Updated on September 18, 2022

Comments

  • Jacques MALAPRADE
    Jacques MALAPRADE over 1 year

    My system consists of a laptop running Ubuntu 18.04 LTS and a server running Centos 7. I installed tigervnc on the Centos machine, and set it all up for one user to access the machine using Remmina remote desktop. I used the following guide. It works fine for the 1st user I set this up for, but for the second user I set this up for the desktop appears black. Both users have the same configuration with the only changes being the numbering and user credentials in the configuration. I am at a loss why it doesn't work for the second user.

    I created the vnc files by login in as the user and running the command:

    vncserver
    

    completed the fields required, after which the required files are created in the user home folder structure. I did this for the 1st and then the second user.

    I then copied the file:

    sudo cp /lib/systemd/system/[email protected]  /etc/systemd/system/vncserver@:2.service
    

    Below is the content of the /home/<username>/.vnc/xstartup for the second user, note that is exactly the same as the first except for the user credentials:

    #!/bin/sh
    
    unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    gnome-session –session=gnome-classic &
    gnome-panel&
    

    The content of the /etc/systemd/system/vncserver@\:2.service file:

    [Unit]
    Description=Remote desktop service (VNC)
    After=syslog.target network.target
    
    [Service]
    Type=forking
    
    # Clean any existing files in /tmp/.X11-unix environment
    ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
    ExecStart=/usr/sbin/runuser -l <username> -c "/usr/bin/vncserver %i -geometry 1280x1024"
    PIDFile=/home/<username>/.vnc/%H%i.pid
    ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
    
    [Install]
    WantedBy=multi-user.target
    

    with <username> being replaced with the user login.

    I start the vnc process using the following, making sure that I have stopped and disabled the 1st users vnc session:

    sudo systemctl daemon-reload
    sudo systemctl enable vncserver@:2.service
    sudo systemctl start vncserver@:2.service
    sudo systemctl status vncserver@:2.service
    

    with output:

    ● vncserver@:2.service - Remote desktop service (VNC)
       Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; vendor preset: disabled)
       Active: active (running) since Thu 2020-02-06 09:44:37 GMT; 6s ago
      Process: 952 ExecStart=/usr/sbin/runuser -l <username> -c /usr/bin/vncserver %i -geometry 1280x1024 (code=exited, status=0/SUCCESS)
      Process: 947 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
     Main PID: 1011 (Xvnc)
       CGroup: /system.slice/system-vncserver.slice/vncserver@:2.service
           ‣ 1011 /usr/bin/Xvnc :2 -auth /home/<username>/.Xauthority -desktop venus:2 (<username>) -fp catalogue:/etc/...
    
    Feb 06 09:44:33 venus systemd[1]: Starting Remote desktop service (VNC)...
    Feb 06 09:44:37 venus systemd[1]: Started Remote desktop serv
    

    the output of the log file /home/<username>/.vnc/venus\:2.log:

    Xvnc TigerVNC 1.8.0 - built Aug  9 2019 03:04:19
    Copyright (C) 1999-2017 TigerVNC Team and many others (see README.txt)
    See http://www.tigervnc.org for information on TigerVNC.
    Underlying X server release 12001000, The X.Org Foundation
    
    
    Thu Feb  6 09:44:34 2020
     vncext:      VNC extension running!
     vncext:      Listening for VNC connections on all interface(s), port 5902
     vncext:      created VNC server for screen 0
    /home/<username>/.vnc/xstartup: line 15: gnome-panel: command not found
    GLib-GIO-Message: 09:44:37.641: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
    
    ** (process:1046): WARNING **: 09:44:37.688: Could not make bus activated clients aware of XDG_CURRENT_DESKTOP=GNOME environment variable: Could not connect: Connection refused
    
    Thu Feb  6 09:44:50 2020
     Connections: accepted: 10.0.12.148::59266
     SConnection: Client needs protocol version 3.8
     SConnection: Client requests security type VeNCrypt(19)
     SVeNCrypt:   Client requests security type TLSVnc (258)
    
    Thu Feb  6 09:44:53 2020
     VNCSConnST:  Server default pixel format depth 24 (32bpp) little-endian rgb888
     VNCSConnST:  Client pixel format depth 15 (16bpp) little-endian rgb555
    
    Thu Feb  6 09:45:19 2020
     Connections: closed: 10.0.12.148::59266 (Clean disconnection)
     EncodeManager: Framebuffer updates: 1
     EncodeManager:   Tight:
     EncodeManager:     Solid: 1 rects, 1.31072 Mpixels
     EncodeManager:            15 B (1:174763 ratio)
     EncodeManager:   Total: 1 rects, 1.31072 Mpixels
     EncodeManager:          15 B (1:174763 ratio)
     TLS:         TLS session wasn't terminated gracefully
     ComparingUpdateTracker: 0 pixels in / 0 pixels out
     ComparingUpdateTracker: (1:-nan ratio)
    

    This bit of the log file seems to be different from the log file created for the 1st user: ** (process:1046): WARNING **: 09:44:37.688: Could not make bus activated clients aware of XDG_CURRENT_DESKTOP=GNOME environment variable: Could not connect: Connection refused

    Any help will be appreciated.