aaronwmorris / indi-allsky

Software to manage a Linux-based All Sky Camera.
GNU General Public License v3.0
227 stars 37 forks source link

Browser Access to USB Drive and Hotspot Setup #92

Closed HxPI closed 2 years ago

HxPI commented 2 years ago

Please provide support to remedy issues with 403 errors related to USB drive access. Thanks.

HxPI commented 2 years ago

Another issue is VNC cannot connect to RPi4 if a display is not connected. Probably a remote frame buffer setup issue. Astroberry WebVNC worked well with no display on RPi. Is there something that can be setup to enable VNC to work without a display connected?

Update: OK that was an easy fix, had to explicitly set display resolution in raspi-config. VNC works as expected now. My guess is Astroberry already had this setup in their disk image.

HxPI commented 2 years ago

Merged #134 to allow saving files in TIFF format.

OK TIFF files are working but as stated they are not displaying in Firefox. I guess this will have to be a compromise as to not create more complexity in making it work with the web browser interface feature. I'll leave it on PNG for now.

HxPI commented 2 years ago

Firefox developer tools shows this when trying to run Reboot Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data error https://raspberrypi.local/indi-allsky/system:465 jQuery 6 button_click https://raspberrypi.local/indi-allsky/system:451 https://raspberrypi.local/indi-allsky/system:513 jQuery 8 https://raspberrypi.local/indi-allsky/system:50

I don’t know but it looks like when the display setting was updated, the Reboot and Shutdown functions work now. Linux is a very strange world!

HxPI commented 2 years ago

Merged #133 which disables wifi powersave in the connection config. It also fixes the "Weak Security" message on iOS by forcing WPA2 and AES.

The hotspot script is causing my RPi4 to crash and reboot. It sucessfully removes Hotspot, but when it adds Hotspot the RPI reboots. The script failed to complete and there is no hotspot!

OK now the hotspot script works too and is up and running no complaints about security! I think there was some hang up with the RPI operating headless and changing the display setting cleared that up. Something to consider.

HxPI commented 2 years ago

Merged #136 with a script to validate and cleanup orphaned DB entries. Script is at misc/validate_db_entries.py

How do I run this?

I think the final stretch is at hand. Everything appears to be working except the broken media links in Timelapses. Need to figure out how to run your db script.

HxPI commented 2 years ago

Merged #136 with a script to validate and cleanup orphaned DB entries. Script is at misc/validate_db_entries.py

How do I run this?

I think the final stretch is at hand. Everything appears to be working except the broken media links in Timelapses. Need to figure out how to run your db script.

OK figured out how to run db validate script, had to use virtualenv. Thank you for all your efforts getting this to work for remote operations. I’ll report if anything else comes up. Looking forward to future developments.

HxPI commented 2 years ago

I don’t know why but the hotspot is flaky. SSID disappears after first attempt to connect. It says authentication error occurred on Android. On IOS it just disappears and rarely shows up in the list again. It’s not the enclosure because Astroberry works just fine. This will need some more work. Is it setup for 2.4Ghz or 5Ghz? 2.4Ghz has interference with USB3 devices, like my ASI290. 5Ghz has less range but would be better for less interference. Probably could start a new issue thread for this. The other issues appear to be resolved, including the original USB drive issue, and this thread could probably be closed. Thanks again.

aaronwmorris commented 2 years ago

You may consider updating your Raspi firmwares. This also upgrades the kernel, which also upgrades the wifi drivers. sudo rpi-update

I am not sure which if it is using 5Ghz or 2.4. I will do some investigation with this.

HxPI commented 2 years ago

Did rpi-update with no change to wifi behavior. SSID shows up when RPi first boots but cannot connect to it and then it disappears and only intermittently reappears. Reading some blogs about RPi hotspots there may be an issue with setting country code with network manager. Seems this must be set correctly for wifi to work properly. I would think the code should be US. Trying to set in Raspberry Pi localization settings but will not save. Same after using raspi-config. Just says “not set”

aaronwmorris commented 2 years ago

According to https://github.com/rkaczorek/astroberry-server-hotspot/blob/master/HotSpot.nmconnection Astroberry forces 2.4Ghz wifi. I can try to set this in my hotspot setup.

HxPI commented 2 years ago

Must be member of netdev to change Wi-Fi network parameters? Never mind, apparently user pi is already a member of netdev. I’m at a loss why I cannot change Wi-Fi country code.

Update: looking at wpa_supplicant.conf country code is already set to US. Not sure if that matters.

aaronwmorris commented 2 years ago

Merged #137 to force 2.4Ghz wifi. Just re-run the hotspot setup script.

HxPI commented 2 years ago

Ok will try

HxPI commented 2 years ago

Reran hotspot script no change. When it randomly shows up, selecting the SSID just says unable to join network.

aaronwmorris commented 2 years ago

I will load up Astroberry on my Raspi again and inspect the wifi settings in greater detail.

HxPI commented 2 years ago

I will load up Astroberry on my Raspi again and inspect the wifi settings in greater detail.

This might be of interest: https://github.com/rkaczorek/astroberry-server/issues/128

aaronwmorris commented 2 years ago

That was helpful. Merged #138 to select the country for wifi.

You will have to reboot for the change to take effect. After rebooting, you can verify with iw reg get

HxPI commented 2 years ago

Did the update. Is this correct?

global country 00: DFS-UNSET (2402 - 2472 @ 40), (N/A, 20), (N/A) (2457 - 2482 @ 20), (N/A, 20), (N/A), AUTO-BW, PASSIVE-SCAN (2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM, PASSIVE-SCAN (5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW, PASSIVE-SCAN (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW, PASSIVE-SCAN (5490 - 5730 @ 160), (N/A, 20), (0 ms), DFS, PASSIVE-SCAN (5735 - 5835 @ 80), (N/A, 20), (N/A), PASSIVE-SCAN (57240 - 63720 @ 2160), (N/A, 0), (N/A)

phy#0 country 99: DFS-UNSET (2402 - 2482 @ 40), (6, 20), (N/A) (2474 - 2494 @ 20), (6, 20), (N/A) (5140 - 5360 @ 160), (6, 20), (N/A) (5460 - 5860 @ 160), (6, 20), (N/A)

HxPI commented 2 years ago

I see the SSID now but still unable to connect. Then it went away.....

HxPI commented 2 years ago

I reran the script using the number instead of the letter for country code. Now it looks like the settings are correct but still no SSID or connectivity:

global country US: DFS-FCC (2402 - 2472 @ 40), (N/A, 30), (N/A) (5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW (5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW (5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS (5735 - 5835 @ 80), (N/A, 30), (N/A) (57240 - 63720 @ 2160), (N/A, 40), (N/A)

phy#0 country 99: DFS-UNSET (2402 - 2482 @ 40), (6, 20), (N/A) (2474 - 2494 @ 20), (6, 20), (N/A) (5140 - 5360 @ 160), (6, 20), (N/A) (5460 - 5860 @ 160), (6, 20), (N/A)

aaronwmorris commented 2 years ago

No, the country is not selected. What is the contents of /etc/modprobe.d/cfg80211.conf ?

On my side it looks like this:

global
country US: DFS-FCC
    (2402 - 2472 @ 40), (N/A, 30), (N/A)
    (5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
    (5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
    (5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
    (5735 - 5835 @ 80), (N/A, 30), (N/A)
    (57240 - 63720 @ 2160), (N/A, 40), (N/A)

phy#0
country 99: DFS-UNSET
    (2402 - 2482 @ 40), (6, 20), (N/A)
    (2474 - 2494 @ 20), (6, 20), (N/A)
    (5140 - 5360 @ 160), (6, 20), (N/A)
    (5460 - 5860 @ 160), (6, 20), (N/A)
HxPI commented 2 years ago

options cfg80211 ieee80211_regdom=US

I reran the script so it's set correct now. But still no SSID

aaronwmorris commented 2 years ago

I believe by default it settles on wifi channel 1. Might that be conflicting with your local AP?

HxPI commented 2 years ago

Could be. Can it be set to auto?

HxPI commented 2 years ago

I see the SSID its trying but it just wont allow a connection

aaronwmorris commented 2 years ago

If you have the wifi AP saved on your iPad, try forgetting and re-adding. Maybe that will make a difference.

HxPI commented 2 years ago

Checked wifi channels with app and only RPi is using Ch1. Tried forget and reaccessing SSID on IOS and Android and both won't connect, giving authentication errors. Perhaps going back to WPA might help, I think the astroberry link mentioned something about it? Strange because it worked on WPA2 ONE time when first trying this out and then it never worked again!

HxPI commented 2 years ago

For some reason Raspberry PI Configuration: Localisation: Set WiFi Country still shows as not set.

HxPI commented 2 years ago

I guess the question is if it works for you then what is different with my setup causing it not to work?

aaronwmorris commented 2 years ago

I have not been able to get to my office to check the wifi status of my Raspi (I do most of my development remotely). Last I checked, my hotspot was still working with WPA2.

I have submitted several pull requests to enhance the country selection and enable band and channel selection.

Did you install any other Astroberry packages? Maybe one of the Astroberry wifi configs got installed and is interfering.

HxPI commented 2 years ago

I have not been able to get to my office to check the wifi status of my Raspi (I do most of my development remotely). Last I checked, my hotspot was still working with WPA2.

I have submitted several pull requests to enhance the country selection and enable band and channel selection.

Did you install any other Astroberry packages? Maybe one of the Astroberry wifi configs got installed and is interfering.

No other installs, just straight Raspbian 10 32bit to indi-allsky.

HxPI commented 2 years ago

So here is what I found out:

  1. I utilized the hotspot setup script from this site and it worked great: https://www.raspberryconnect.com/projects/65-raspberrypi-hotspot-accesspoints/183-raspberry-pi-automatic-hotspot-and-static-hotspot-installer

  2. USB3 interferes with wifi at 2.4GHz and causes hotspot not to work. Also I’m guessing the cables used are probably not adequately isolated or shielded. I moved my connections to USB2 and the WiFi Hotspot worked. I had the exact same problem when using my Compute Stick, had to use 5GHz wifi. There’s an extensive white paper about it: https://www.usb.org/sites/default/files/327216.pdf

So my setup is a RPi4 4GB/ASI290MC/64GB USB drive/22000mAh USB battery pack running Raspbian 10 32bit w/desktop, ran the hotspot script, then installed indi-allsky, finally set the USB drive permissions. The wifi dropped out during indi-allsky install so I just ran the hotspot script again and all was well. The other gotcha was to use the correct IP address to access the webserver as stated in the previous link for the hotspot. Apparently the name resolution wasn’t setup so raspberrypi.local didn’t work but using the applicable IP addresses for VNC and web status page worked.

If I can get 5GHz working and move back to USB3 I'll be all set. Otherwise, the setup is working as expected and all functions are performing well.

Very interesting and entertaining adventure in Linuxland!

HxPI commented 2 years ago

I left the setup running all night and it is still running. Timelapse video was produced as normal. However, the Swap memory is stuck at 100%. CPU is 5% and System memory is 14%. All other parameters look normal. Is this normal?

HxPI commented 2 years ago

Also was unable to reset or shutdown from web page. Those selections were unresponsive. Could be related to the display settings as before so I’ll investigate further.

aaronwmorris commented 2 years ago

Swap memory is stuck at 100%

This could be somewhat normal. By default, Linux configures swap aggressiveness targeted for desktop workloads. I am not a big fan of this.

You can reduce the swap aggressiveness with the following commands:

echo "vm.swappiness = 1" | sudo tee /etc/sysctl.d/90-swappiness.conf

sudo sysctl --system
aaronwmorris commented 2 years ago

You mentioned you changed the wifi password. Did your new password by chance have any special characters in it?

HxPI commented 2 years ago

You mentioned you changed the wifi password. Did your new password by chance have any special characters in it?

Password was good. The issue was with the 2.4GHz interference.

HxPI commented 2 years ago

Swap memory is stuck at 100%

This could be somewhat normal. By default, Linux configures swap aggressiveness targeted for desktop workloads. I am not a big fan of this.

You can reduce the swap aggressiveness with the following commands:

echo "vm.swappiness = 1" | sudo tee /etc/sysctl.d/90-swappiness.conf

sudo sysctl --system

The swap memory is looking fine now. I’ll keep this in mind for future if change is needed. Thanks.