WebThingsIO / gateway

WebThings Gateway - a self-hosted web application for monitoring and controlling a building over the web
http://webthings.io/gateway
Mozilla Public License 2.0
2.61k stars 339 forks source link

Wifi troubles with single quote, pi image still uses mozilla-iot #2729

Closed stutrek closed 3 years ago

stutrek commented 3 years ago

I tried installing the gateway on a pi today, and had significant trouble.

The pi would boot and start a wifi network. I could connect, select my home network and enter a password, but the pi never successfully joined my network. I connected a monitor and keyboard to debug. My network is called "Stu's Network", in the logs it said 'Stu\\\\\'s Network'. It would try to connect 20 times then fail.

I was trying to configure from Firefox, I didn't think to try Chrome.

Eventually I configured the network through raspi-config and I was able to load gateway.local in a browser. It did ask for my wifi again, even though it was already connected to the router. I entered the data and was able to start the configuration process. This time the logs said 'Stu\'s Network'.

The tunneling step had mozilla-iot.com instead of webthings.io. At this point I stopped because I figured any further setup would have to be repeated.

One thing I noticed throughout the process is that all the directories were called "mozilla-iot" and not "webthings".

Thanks!

EDIT: I tried a Pi Zero W 1.1 and a Pi Zero 1.3

benfrancis commented 3 years ago

@stutrek Where did you install WebThings Gateway from? It sounds like you've installed a pre-1.0 version. 1.0 can be downloaded from https://webthings.io/gateway/

I seem to recall the ' in a Wi-Fi network SSID issue was a known bug, but I can't find an issue for it.

stutrek commented 3 years ago

That's exactly where I went.

https://webthings.io/gateway/

I navigated there a few ways to see if I'd get a different page and zip, but it was always the same.

Mac OS's get info says this:

https://github.com/WebThingsIO/gateway/releases
https://github-production-release-asset-2e65be.s3.amazonaws.com/84347372/931cda80-34ec-11eb-80c5-be9fe829199a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210117%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210117T194019Z&X-Amz-Expires=300&X-Amz-Signature=55aff4a6c56c197646632ac3ccff85c4d0f937933368d3f07afc25bfb1f87461&X-Amz-SignedHeaders=host&actor_id=339327&key_id=0&repo_id=84347372&response-content-disposition=attachment%3B%20filename%3Dgateway-1.0.0.img.zip&response-content-type=application%2Foctet-stream

EDIT: github release page too.

benfrancis commented 3 years ago

The download button for the Raspberry Pi image at https://webthings.io/gateway/ links to https://github.com/WebThingsIO/gateway/releases/download/1.0.0/gateway-1.0.0.img.zip - it shouldn't be hosted on S3.

I just downloaded that file and checked again and it's definitely using the new webthings.io infrastructure.

Would you mind re-testing with this image and seeing whether you can reproduce the Wi-Fi bug?

stutrek commented 3 years ago

Github stores the zip on aws. If I download it from there a third time, I'll get the same thing.

$ curl https://github.com/WebThingsIO/gateway/releases/download/1.0.0/gateway-1.0.0.img.zip -I
HTTP/1.1 302 Found
Server: GitHub.com
Date: Tue, 19 Jan 2021 17:17:09 GMT
Content-Type: text/html; charset=utf-8
Status: 302 Found
Vary: X-PJAX, Accept-Encoding, Accept, X-Requested-With
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/84347372/931cda80-34ec-11eb-80c5-be9fe829199a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210119%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210119T171709Z&X-Amz-Expires=300&X-Amz-Signature=628355f0658b30ac7a8412c31ada09a9542db0450098d1887af79acd150c7c10&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=84347372&response-content-disposition=attachment%3B%20filename%3Dgateway-1.0.0.img.zip&response-content-type=application%2Foctet-stream
Cache-Control: no-cache
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: no-referrer-when-downgrade
Expect-CT: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com www.githubstatus.com collector.githubapp.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events wss://alive.github.com online.visualstudio.com/api/v1/locations; font-src github.githubassets.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; manifest-src 'self'; media-src 'none'; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; worker-src github.com/socket-worker-5029ae85.js gist.github.com/socket-worker-5029ae85.js
Set-Cookie: _gh_sess=mCQkGGd%2F%2FAOVW4HQOoL%2FFuHdJEMgevMpxMKjRH5kXUCDQCwnWz21wNtMl2eHDLfvZfRInBj%2FfpSS6px9RE6WL5QOcwenAxiUgIi6skhoTXTM6Cud%2FCkkV8XYTd8UWk2Nnzsy5QxMFc6D4yvjLA%2B9NM6D5OyB%2BxG0x6335S4yqn3AVJq%2BE1%2FONKpNPX9D0xcR63LoNX1uQa1PjTS%2Bm0yXg5rCHrYS%2B2BVy0gJZDZasS6dV7%2BzhfcOwrDO%2BJqXhPqJCv5S5%2Fyu78jru3AQUcD0VA%3D%3D--VrkcvxVks%2FTCdMFJ--gac0OHfeoqdT02QpG0MF9w%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
Set-Cookie: _octo=GH1.1.1885930488.1611076629; Path=/; Domain=github.com; Expires=Wed, 19 Jan 2022 17:17:09 GMT; Secure; SameSite=Lax
Set-Cookie: logged_in=no; Path=/; Domain=github.com; Expires=Wed, 19 Jan 2022 17:17:09 GMT; HttpOnly; Secure; SameSite=Lax
Content-Length: 645
X-GitHub-Request-Id: F639:4935:AB0B:120DA:60071415
stutrek commented 3 years ago

I'll try it again with some screenshots tonight.

stutrek commented 3 years ago

Here's what I'm seeing, it may be that I'm looking at dot folders I shouldn't, and that the UI displays the wrong domain.

image image

These are from the download link you mention above.

Thanks!

tim-hellhake commented 3 years ago

I just downloaded the image and checked it locally.

> curl https://github.com/WebThingsIO/gateway/releases/download/1.0.0/gateway-1.0.0.img.zip -L -o gateway-1.0.0.img.zip

I can't find any traces of the mozilla-iot domain.

> grep "webthings.io" gateway/home/pi/webthings/gateway/static/index.html
               .webthings.io
            <label for="domain-settings-tunnel-checkbox">Use WebThings Tunneling Service (webthings.io) </label>
            <p><input type="text" id="domain-settings-tunnel-name" name="domain" placeholder="example">.webthings.io</p>
          <a href="https://webthings.io"
          <span id="label-subdomain">.webthings.io</span>
            <a data-l10n-name="transition-dialog-privacy-policy-link" href="https://webthings.io/privacy" target="_blank" rel="noopener"></a>
            <a data-l10n-name="transition-dialog-tos-link" href="https://webthings.io/legal" target="_blank" rel="noopener"></a>
          <a href="https://webthings.io"

> grep "mozilla-iot" gateway/home/pi/webthings/gateway/static/index.html

Can you please calculate the checksum of your downloaded zip file?

> sha256sum gateway-1.0.0.img.zip 
0a85eaffaca251398d7dced48a796231f00224a56d354ab1126d02ee1ff311be  gateway-1.0.0.img.zip
stutrek commented 3 years ago

Ok, I found the problem, and it's as ridiculous as expected.

In my downloads folder I have this:

image

This is the latest .zip, and a .img from a year ago that just happens to have the same digits in different places. When you double click the zip, it unpacks to 2020-12-02-Raspbian.img, which landed far away in my messy downloads folder. I don't remember seeing the Raspbian image in the balenaEtcher file dialog, if I did I assumed it was some other Pi experiment.

Sorry for the false alarm, thanks for the help!