Results 1 to 9 of 9

Thread: unable to start vnc in kali mobile

  1. #1
    Junior Member
    Join Date
    Mar 2015
    Posts
    1

    unable to start vnc in kali mobile

    hey can anyone help me with this i can start kali in terminel but unable to get GUI since vnc server is not starting.everything goes well but the only thing is vnc.i have attached screenshots.
    i tried netstat -l in which localhost is not listening on port 5900
    also nc -s 127.0.0.1 -p 5900 -l is not working.
    please if anyone can help me it will really be helpful. thanks in advance

  2. #2
    Member
    Join Date
    Nov 2014
    Posts
    39
    Quote Originally Posted by rahulroy View Post
    hey can anyone help me with this i can start kali in terminel but unable to get GUI since vnc server is not starting.everything goes well but the only thing is vnc.i have attached screenshots.
    i tried netstat -l in which localhost is not listening on port 5900
    also nc -s 127.0.0.1 -p 5900 -l is not working.
    please if anyone can help me it will really be helpful. thanks in advance
    Kali linux by default uses
    Code:
    /usr/lib/vino/vino-server --sm-disable
    in startup applications however vino-server isn't the greatest it's very buggy for doing remote access without a screen atached so I recommend tightvncserver instead of fixing the broken vino-server as it's much easier than dropping into source code.

    Follow these instructions:

    Code:
    sudo apt-get install tightvncserver
    --VNC SERVER ON BOOT--
    Create new file called vncboot in init.d directory
    Code:
    nano /etc/init.d/vncboot
    Put in the following
    Code:
    ### BEGIN INIT INFO
    # Provides: vncboot
    # Required-Start: $remote_fs $syslog
    # Required-Stop: $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start VNC Server at boot time
    # Description: Start VNC Server at boot time.
    ### END INIT INFO
    
    #! /bin/sh
    # /etc/init.d/vncboot
    
    USER=root
    HOME=/root
    
    export USER HOME
    
    case "$1" in
     start)
      echo "Starting VNC Server"
      #Insert your favoured settings for a VNC session
      su - root -c "/usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565"
      ;;
    
     stop)
      echo "Stopping VNC Server"
      /usr/bin/vncserver -kill :0
      ;;
    
     *)
      echo "Usage: /etc/init.d/vncboot {start|stop}"
      exit 1
      ;;
    esac
    
    exit 0
    Make it executable with 755 permissions and update to be default service on boot
    Code:
    chmod 755 /etc/init.d/vncboot
    update-rc.d vncboot defaults
    Now start the service
    Code:
    service vncboot start
    It will prompt you the first time to enter a password for your vnc server enter your password once the confirm it and for view only use 'n' and enter
    The vncserver now should be started and will start on boot.

    --AUTO BOOT AND LOGIN STARTX--

    The problem you will have now is that when you boot your Raspberry Pi you will not have access to vnc on boot if it doesn't login automatically for you to do this complete the following:
    Code:
    nano /etc/inittab
    Add # in front of this line
    Code:
    1:2345:respawn:/sbin/getty 115200 tty1
    Add this below the line we commented out:
    Code:
    1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1
    Now we need to edit ~/.profile
    Code:
    nano ~/.profile
    Add the following just before the last line of code
    Code:
    if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
    /usr/bin/startxfce4
    fi
    If not seeing colors in terminal bugs you as much as it does me, uncomment these lines in ~/.bashrc:
    Code:
    export LS_OPTIONS='--color=auto'
    eval "`dircolors`"
    alias ls='ls $LS_OPTIONS'
    alias ll='ls $LS_OPTIONS -l'
    alias l='ls $LS_OPTIONS -lA'
    Hope this helps you, now you should be able to plug this in anywhere and connect to it assuming it's connected through ethernet or wifi
    Last edited by lillypad; 2015-05-11 at 11:36 PM. Reason: Missed something important

  3. #3
    Junior Member
    Join Date
    Feb 2016
    Posts
    2
    Lilypad's solution did not work for me, on a fresh install of Kali 2.1 on a RaspPi 2. I got as far as:

    Code:
    service vncboot start
    and got:

    Code:
    Job for vncboot.service failed because the control process exited with error code. See "systemctl status vncboot.service" and "journalctl -xe" for details.
    Code:
    root@kali:/etc/init.d# systemctl -l status vncboot.service
    �� vncboot.service - LSB: Start VNC Server at boot time
       Loaded: loaded (/etc/init.d/vncboot; bad; vendor preset: enabled)
       Active: failed (Result: exit-code) since Wed 2016-02-03 09:18:51 UTC; 2min 3s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 2161 ExecStart=/etc/init.d/vncboot start (code=exited, status=203/EXEC)
    
    Feb 03 09:18:51 kali systemd[1]: Starting LSB: Start VNC Server at boot time...
    Feb 03 09:18:51 kali systemd[1]: vncboot.service: Control process exited, code=exited status=203
    Feb 03 09:18:51 kali systemd[1]: Failed to start LSB: Start VNC Server at boot time.
    Feb 03 09:18:51 kali systemd[1]: vncboot.service: Unit entered failed state.
    Feb 03 09:18:51 kali systemd[1]: vncboot.service: Failed with result 'exit-code'
    and

    Code:
    ...
    Feb 03 09:26:53 kali dhclient[468]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
    Feb 03 09:27:00 kali dhclient[468]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
    Feb 03 09:27:07 kali dhclient[468]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 15
    Feb 03 09:27:09 kali polkitd(authority=local)[232]: Registered Authentication Agent for unix-process:2175:2225532 (system bus name :1.44 [/usr/bin/pktty
    agent --notify-fd 4 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
    Feb 03 09:27:09 kali systemd[1]: Starting LSB: Start VNC Server at boot time...
    -- Subject: Unit vncboot.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- Unit vncboot.service has begun starting up.
    Feb 03 09:27:09 kali systemd[2201]: vncboot.service: Failed at step EXEC spawning /etc/init.d/vncboot: Exec format error
    -- Subject: Process /etc/init.d/vncboot could not be executed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- The process /etc/init.d/vncboot could not be executed and failed.
    -- 
    -- The error number returned by this process is 8.
    Feb 03 09:27:09 kali systemd[1]: vncboot.service: Control process exited, code=exited status=203
    Feb 03 09:27:09 kali systemd[1]: Failed to start LSB: Start VNC Server at boot time.
    -- Subject: Unit vncboot.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- Unit vncboot.service has failed.
    -- 
    -- The result is failed.
    Feb 03 09:27:09 kali systemd[1]: vncboot.service: Unit entered failed state.
    Feb 03 09:27:09 kali systemd[1]: vncboot.service: Failed with result 'exit-code'.
    Feb 03 09:27:09 kali polkitd(authority=local)[232]: Unregistered Authentication Agent for unix-process:2175:2225532 (system bus name :1.44, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) disconnected from bus)
    --Nathanael

  4. #4
    Junior Member
    Join Date
    Feb 2016
    Posts
    2
    UPDATE: A work-around is to use a different desktop environment. Kali Linux 2.1 for the Raspberry Pi 2 comes with Xfce. I installed LXDE, set it as default, rebooted and logged in. VNC now works.

    1. Install Xfce

    Code:
    apt-get install lxde-core lxde kali-defaults kali-root-login desktop-base
    2. Set LXDE as the default DE

    You will need to run the following either logged in as root or using sudo.

    Code:
    update-alternatives --config x-session-manager
    You will be presented with a list of all currently installed DEs, with an asterisk next to the current default DE. Type the number next to the line with startlxde (3, in my example), and press enter.

    Code:
    root@kali:~# update-alternatives --config x-session-manager
    There are 5 choices for the alternative x-session-manager (providing /usr/bin/x-session-manager).
    
      Selection    Path                      Priority   Status
    ------------------------------------------------------------
      0            /usr/bin/startlxde         50        auto mode
      1            /usr/bin/lxsession         49        manual mode
      2            /usr/bin/openbox-session   40        manual mode
    * 3            /usr/bin/startlxde         50        manual mode
      4            /usr/bin/startxfce4        50        manual mode
      5            /usr/bin/xfce4-session     40        manual mode
    
    Press <enter> to keep the current choice[*], or type selection number:
    3. Reboot

    Restart your system and log in. You should now see the LXDE desktop. Run vncserver then try connecting again.

  5. #5
    Junior Member
    Join Date
    Aug 2016
    Posts
    2
    lillypad, are you able to assist with this? I'm experiencing the same problem Nathanael had when trying to set vncserver to start at boot and getting the same "Job for vncboot.service failed because the control process exited with error code. See "systemctl status vncboot.service" and "journalctl -xe" for details."

    EDIT: Found the fix. The shebang should be the first line.
    Last edited by Akshunhiro; 2016-08-12 at 07:47 PM. Reason: Fix found

  6. #6
    Quote Originally Posted by Akshunhiro View Post
    lillypad, are you able to assist with this? I'm experiencing the same problem Nathanael had when trying to set vncserver to start at boot and getting the same "Job for vncboot.service failed because the control process exited with error code. See "systemctl status vncboot.service" and "journalctl -xe" for details."

    EDIT: Found the fix. The shebang should be the first line.
    What do you mean the first line? I tried setting my manager to selection thinking this was what you were talking about and alas, it still doesnt work. Im almost there but cant seem to get the "service vncboot start" command to work, still getting the same error as above

  7. #7
    Junior Member
    Join Date
    Jan 2014
    Posts
    8
    Quote Originally Posted by sotallytober View Post
    What do you mean the first line? I tried setting my manager to selection thinking this was what you were talking about and alas, it still doesnt work. Im almost there but cant seem to get the "service vncboot start" command to work, still getting the same error as above

    stuck on this myself , what the h3ll do you mean by shebang ? please explain

  8. #8
    Junior Member
    Join Date
    Oct 2017
    Posts
    1
    ----------------------------------------------------------------------------------
    SheBang - https://en.wikipedia.org/wiki/Shebang_(Unix)

    #! /bin/sh
    # /etc/init.d/vncboot

    ----------------------------------------------------------------------------------

    #! /bin/sh
    # /etc/init.d/vncboot

    ### BEGIN INIT INFO
    # Provides: vncboot
    # Required-Start: $remote_fs $syslog
    # Required-Stop: $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start VNC Server at boot time
    # Description: Start VNC Server at boot time.
    ### END INIT INFO

    USER=root
    HOME=/root

    export USER HOME

    case "$1" in
    start)
    echo "Starting VNC Server"
    #Insert your favoured settings for a VNC session
    su - root -c "/usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565"
    ;;

    stop)
    echo "Stopping VNC Server"
    /usr/bin/vncserver -kill :0
    ;;

    *)
    echo "Usage: /etc/init.d/vncboot {start|stop}"
    exit 1
    ;;
    esac

    exit 0

  9. #9
    Junior Member
    Join Date
    Nov 2017
    Posts
    2
    Quote Originally Posted by rahulroy View Post
    hey can anyone help me with this i can start kali in terminel but unable to get GUI since vnc server is not starting.everything goes well but the only thing is vnc.i have attached screenshots.
    i tried netstat -l in which localhost is not listening on port 5900
    also nc -s 127.0.0.1 -p 5900 -l is not working.
    please if anyone can help me it will really be helpful. thanks in advance
    What worked for me is running Kali from chroot container (Linux deploy) where you can configure vnc graphic option.
    After that in vnc you only have to set the correct ip address.
    Start the vnc session and Kali will run.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •