noVNC failed to connect to server

r4r

#1

Hello when I click on the VNC option I just get “Failed to connect to server”.
I have a GoPiGo3
I am using stretch from the image: “2018.05.18_Raspbian_For_Robots_by_Dexter_Industries-stretch.0.0.2.zip”
I have a static IP working. When I visit the IP (in Chrome, Firefox or IE) the terminal shell in a box works, but the noVNC does not connect.

The VNC was working for me with an earlier Jesse image.

Thinking this may be related to my Camera video stream issues:


#2

Hi @jhutton,

We’ve released the official version just a couple of hours ago. You might want to give that a try.

Thank you!


#3

Just downloaded the new image from here:
https://sourceforge.net/projects/dexterindustriesraspbianflavor/files/2018.06.01_Raspbian_For_Robots_by_Dexter_Industries-stretch.zip/download

Connecting with ssh works fine (via the web interface, or via terminal from another computer on my network). Trying to connect with noVNC via the web interface gives this screen:

Connection with RealVNC client works (dex.local:1)


#4

Note: http://IP:8001/vnc_lite.html works, but not the vnc.html


#5

Hi @jhutton,

Are you somehow using Cinch on it, because I’m seeing a 10.10.10.x IP address in the address bar. If so, can you try testing it without having Cinch enabled?

@cleoqc please take a look at this one - what do you know about this thing?

Thank you!


#6

@RobertLucian
The screen grab you see above is from me. IP address is 10.0.0.18

This is the screen I get when I go to 10.0.0.18:

When I click the “Launch VNC” link, I get the screen from my previous post with “Failed to connect to server” message.

As @jhutton pointed out, if I go to 10.0.0.18:8001/vnc_lite.html it works (screen below):

typing robots1234 in the password box on this screen gets me to the desktop:

This is from the image here:

https://sourceforge.net/projects/dexterindustriesraspbianflavor/files/2018.06.01_Raspbian_For_Robots_by_Dexter_Industries-stretch.zip/download

I haven’t installed anything additional after loading this image.


#7

No, I don’t think I’m using Cinch.


#8

We’ll try doing a more rigorous test and then we’ll be back with an answer for you.

Thank you!


#9

Hi @jhutton @kev.r,

We flashed the 2018.06.01 image of Raspbian For Robots a couple of times and noVNC still seems to work even on the first shot.

Here’s a screenshot of ours:

What’s interesting is that you need to access the Pi at address 10.10.10.10 which is a bit unusual. Can you both tell us again how does your network configuration look like and how you have set it up in more details? Like which cable goes to where? What did you use: internet sharing or Bonjour? How’s the router set up? Stuff like that.

Thank you!


#10

@RobertLucian
Downloaded the 2018.06.01 image again, erased and re-flashed my SD card. This is the first boot of the card, have not updated or installed anything.

Here’s the screen I get when I type dex.local in the address bar of chrome:

When I click the “Launch VNC” icon, I get this:

These screen grabs are from Chrome running on my iMac, but I get the same results from Safari and Firefox on the iMac.

Also the same results from Chrome on my PC (Windows 10) and Chromium on another Raspberry-Pi (plain Raspbian desktop) on my local network.

The address you saw from my previous screen grabs was not 10.10.10.10, it was 10.0.0.18 (this is the address my GoPiGo gets from DHCP on my local network).

Nothing special about my local network setup. Computers and my router (cable modem) are all connected to a simple network switch.

If I just type dex.local:8001 in the address bar of Chrome, I get this:

If I then click the link to vnc_lite.html, I get this:

Typing robots1234 in the password field and pressing enter gives me this:


#11

@RobertLucian
Looking into this issue further today and I’ve identified the problem.

When I type dex.local into the address bar of Chrome, I get this page:


When I click on the Launch VNC icon, I get this page (I have opened the Developer Tools in Chrome so you can see the error console):

It’s a bit difficult to read the error console, here’s an expanded view:

As you can see, it’s trying to connect to //dex:8001 and it can’t resolve that host name.

If I change the URL in the address bar from:

http://dex.local:8001/vnc.html?host=dex&port=8001&autoconnect=true&password=robots1234

to:

http://dex.local:8001/vnc.html?host=dex.local&port=8001&autoconnect=true&password=robots1234

It connects immediately and I get this screen:

The file that loads when you go to dex.local is /var/www/novnc/index.php

If you change line 54 of this file from:

  <a href=" http://<?php echo $dexhost; ?>:8001/vnc.html?host=dex&port=8001&autoconnect=true&password=robots1234">

to:

  <a href=" http://<?php echo $dexhost; ?>:8001/vnc.html?host=<?php echo $dexhost; ?>&port=8001&autoconnect=true&password=robots1234">

It will correct this problem.

Here is my edited version of /var/www/novnc/index.php:

<?php
  // Get host name and IP address
  $ethernetIP = $_SERVER['SERVER_ADDR'];
  $dexhost = $_SERVER['HTTP_HOST'];
?>

<html>
<head>
    <title>Dexter Industries Raspbian for Robots</title>
    <link rel="stylesheet" href="css/main.css">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
    <meta http-equiv="pragma" content="no-cache" />
</head>

<body>
  <div class="main-container">
            <div class="main wrapper clearfix">
  <header>
	<a href="http://www.dexterindustries.com/" target="_blank">
     <img src="img/dexter-logo-sm.png" class="standard logo" alt="Dexter Industries!" >
     <img src="img/dexter-logo-retina.png" class="retina logo" alt="Dexter Industries!" >
	</a>
  <h1>Raspbian for Robots.</h1>

</header>

<article>
<section>
  <p>
    Welcome to Raspbian for Robots, our custom software for your Dexter Industries robots! There are two ways to view and program your robot.
  </p>
  <p>
    The easiest and most user friendly way for beginners is to go in through VNC (virtual network connections), which will show you a little desktop in your browser with icons and folders.
  </p>
  <p>
    If you are more advanced and want to work in the command line, choose Terminal and have fun!
  </p>
</section>
<section class="vnc">
  <a href=" http://<?php echo $dexhost; ?>:8001/vnc.html?host=<?php echo $dexhost; ?>&port=8001&autoconnect=true&password=robots1234">
    <img src="img/vnc.svg" onerror="this.src='img/vnc.png'; this.onerror=null;"style="height:128px;">
    <span class="button">Launch VNC</span>
  </a>
    <em>Password: <strong>robots1234</strong></em>
</section>
<section class="bash">
  <a href="http://<?php echo $dexhost; ?>:4200">
    <img src="img/bash.svg" onerror="this.src='img/bash.png'; this.onerror=null;"style="height:128px;">
    <span class="button">Launch Terminal</span>
  </a>
    <em>
      Username: <strong>pi</strong>
      <br/>
      Password: <strong>robots1234</strong>
  </em>
</section>
<section class="IP">
  <ul>
    <li>Your Host is: <?php echo $dexhost; ?> </li>
    <li>Your IP is: <?php echo $ethernetIP; ?> </li>
  </ul>
</section>

<footer>
<h3>Need more help?</h3>

	<ul>
    <li>See more about the <a href="http://www.dexterindustries.com/brickpi-tutorials-documentation/?raspbian_for_robots" target="_blank" class="product brickpi">BrickPi.</a></li>
		<li>See more about the <a href="http://www.dexterindustries.com/gopigo-tutorials-documentation/?raspbian_for_robots" target="_blank" class="product gopigo">GoPiGo.</a></li>
		<li>See more about the <a href="http://www.dexterindustries.com/grovepi-tutorials-documentation/?raspbian_for_robots" target="_blank" class="product grovepi">GrovePi.</a></li>
		<li>See more about the <a href="http://www.dexterindustries.com/pivotpi-tutorials-documentation/" target="_blank" class="product pivotpi">PivotPi</a></li>

    <li>Ask a question on our <a href="http://www.dexterindustries.com/forum?raspbian_for_robots" target="_blank" class="product">forums.</a></li>
	</ul>
</footer>
</article>
</div> <!-- #main -->
   </div> <!-- #main-container -->

</body>
</html>
  • This corrects the problem as explained above.
    • Connects to dex.local instead of trying to connect to dex (this also works if you connect to a machine that does not have bonjour installed by using the IP address instead of the host name)
  • I made the changes to the php code in the first 5 lines to correctly retreive the host IP address.
  • I modified the <section class="IP"> to display the name and IP address of the host connected to.

Here’s what I get when I go to http://dex.local with the changes above:

Clicking the Launch VNC icon now connects immediately as expected.

@RobertLucian I don’t see how you are able to connect as shown in your screen capture above with the parameter host=dex in the URL.

Sorry for the long post, but I’m trying to explain fully.

-Kevin


#12

Thanks @kev.r . That edit fixes it for me as well. Thanks.


#13

Hi @kev.r,

That’s a really great solution! Great work Kev (Kevin I suppose) ! And thank you a lot!

We’ll have it fixed and then release another version of Raspbian For Robots that will have the fixed version of noVNC.

Kudos to you!


#14

thank you @kev.r !
The code is now in: https://github.com/DexterInd/Raspbian_For_Robots/pull/190
and a new image will be released shortly.

Perfect contribution! :heart_eyes:


#15

@cleoqc, @RobertLucian

Looking for solutions to the problems posted in this forum helps me increase my knowledge and understanding.

I’m glad to be able to contribute something.

-Kevin


#16

Just downloaded and flashed the new image from here:

https://sourceforge.net/projects/dexterindustriesraspbianflavor/files/2018.06.27_Raspbian_For_Robots_by_Dexter_Industries-stretch.zip/download

All now works as expected.

-Kevin


#17

That’s really great to hear that.

Please let us know if anything goes bad.

Thank you!