PDA

View Full Version : unable to start vnc in kali mobile



rahulroy
2015-03-30, 14:31
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

lillypad
2015-05-11, 23:12
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
/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:


sudo apt-get install tightvncserver

--VNC SERVER ON BOOT--
Create new file called vncboot in init.d directory

nano /etc/init.d/vncboot

Put in the following

### 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

chmod 755 /etc/init.d/vncboot
update-rc.d vncboot defaults

Now start the service

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:

nano /etc/inittab
Add # in front of this line

1:2345:respawn:/sbin/getty 115200 tty1
Add this below the line we commented out:

1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1

Now we need to edit ~/.profile

nano ~/.profile
Add the following just before the last line of 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:

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

Nathanael
2016-02-03, 09:33
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:


service vncboot start

and got:



Job for vncboot.service failed because the control process exited with error code. See "systemctl status vncboot.service" and "journalctl -xe" for details.




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



...
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

Nathanael
2016-02-03, 14:32
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


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.


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.


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.

Akshunhiro
2016-08-12, 18:20
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.

sotallytober
2016-09-10, 04:06
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

spydergto
2017-06-04, 08:59
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

Ammonh
2017-10-06, 17:07
----------------------------------------------------------------------------------
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

BQAndroid
2017-11-20, 12:53
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.