Coder Social home page Coder Social logo

Comments (7)

mtlynch avatar mtlynch commented on August 25, 2024

I figured out that this only happens over WiFi. There's an issue on my network where the Pi fails to complete TLS handshakes over WiFi, but it works over wired. If I run the same steps over wired LAN, PPT works as expected.

So, this isn't PPT's fault, but it could be handy if it reports the connection error to the user to hint at the problem. Curently, PPT's behavior looks mostly indistinguishable from an app crash.

from pi-power-tools.

Botspot avatar Botspot commented on August 25, 2024

Interesting. I'd like more info from you about that, since PPT is supposed to tell you if the network is unreachable.
See the below error dialog:
no internet
I'd like an exact terminal output to try to figure out why that dialog does not show up in your use-case.

from pi-power-tools.

mtlynch avatar mtlynch commented on August 25, 2024

I tried the command-line version, but it got to this line and hung for about 5 mins:

$ /home/pi/Pi-Power-Tools/img-mode
Output: 
Raspberry Pi OS
3829399552
https://downloads.raspberrypi.org/raspios_armhf_latestEOO

from pi-power-tools.

Botspot avatar Botspot commented on August 25, 2024

OK, it appears the problem originates from line 70 of img-mode. And with your (weird) network, wget doesn't give up right away, but instead retries for 900 seconds - the default timeout value.
I'd like you to run this command in the terminal: (while connected to your problematic WiFi)

wget -qO- https://downloads.raspberrypi.org/raspios_armhf_latest | dd bs=1M count=1 2>/dev/null | busybox unzip -lq - 2>/dev/null | sed -n 3p | awk '{print $4}'

If I have isolated the right line, that above command should continue running for 900 seconds. (and not exit right away like it should)
If it does indeed continue running, and running, and running, then I'd like you to kill the process and now run this one:

wget --timeout=10 -qO- https://downloads.raspberrypi.org/raspios_armhf_latest | dd bs=1M count=1 2>/dev/null | busybox unzip -lq - 2>/dev/null | sed -n 3p | awk '{print $4}'

That has a timeout of 10 seconds, and it should exit by then. If it does, then I'll update line 70 to fix the problem.

from pi-power-tools.

mtlynch avatar mtlynch commented on August 25, 2024

I get kind of strange behavior out of wget. It properly times out according to the --timeout flag, but it doesn't respect the --tries flag for some reason. It keeps trying different IPv6 addresses, which all fail. It switches over to an IPv4 address, and the download starts:

$ wget --tries=1 --timeout=1 https://downloads.raspberrypi.org/raspios_armhf_latest
--2020-08-18 00:57:40--  https://downloads.raspberrypi.org/raspios_armhf_latest
Resolving downloads.raspberrypi.org (downloads.raspberrypi.org)... 2a00:1098:82:47::1:1, 2a00:1098:84:1e0::3, 2a00:1098:80:56::2:1, ...
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:82:47::1:1|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:84:1e0::3|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:80:56::2:1|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:88:26::1:1|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:80:56::1:1|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:82:47::1|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:88:26::2:1|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:84:1e0::2|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:80:56::3:1|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:84:1e0::1|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:88:26::1|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|2a00:1098:82:47::2:1|:443... failed: Connection timed out.
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|176.126.240.86|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2020-05-28/2020-05-27-raspios-buster-armhf.zip [following]
--2020-08-18 00:57:53--  http://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2020-05-28/2020-05-27-raspios-buster-armhf.zip
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|176.126.240.86|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1181855929 (1.1G) [application/zip]
Saving to: ‘raspios_armhf_latest.2’

raspios_armhf_lates   3%[                    ]  41.80M  7.41MB/s    eta 2m 43s

An alternative might be to use curl. On my system, it connects immediately, despite my wonky network:

curl --retry-max-time 10 --connect-timeout 10 --silent --show-error --location https://downloads.raspberrypi.org/raspios_armhf_latest

And if I put in a dummy IP to force a connection error, it seems to time out in the proper amount of time:

$ curl --retry-max-time 10 --connect-timeout 10 --show-error --silent --location https://123.3.4.5 > /dev/null
curl: (28) Connection timed out after 10001 milliseconds

from pi-power-tools.

Botspot avatar Botspot commented on August 25, 2024

I'm not familiar enough with wget or curl to make comments or to come up with a solution.
What I do know: it took hundreds of tests to maximize the download speed, and if I switched to curl I'd have to redo a bunch of testing. And doing all that to solve a niche problem isn't worth it.

Two things to try, inspired from here:

  • Try changing --timeout= to --read-timeout=. See if wget fails sooner like it should.

  • If that doesn't work, there's always brute-force methods like:

    wget http://www.somesite.com/file.zip &
    PID=$!
    sleep 10
    if [ ps ax | grep $PID -ne '' ]
    then
    kill $PID
    fi

from pi-power-tools.

mtlynch avatar mtlynch commented on August 25, 2024

Neither worked for me, unfortunately:

$ wget --tries=1 --read-timeout=1 https://downloads.raspberrypi.org/raspios_armhf_latest

Still hung for ~10 seconds per IP.

pi@pibuilder:~ $ wget --tries=1 --timeout=1 https://downloads.raspberrypi.org/raspios_armhf_latest &
[1] 1200
pi@pibuilder:~ $ PID=$!
pi@pibuilder:~ $ sleep 10

Redirecting output to ‘wget-log.3’.
pi@pibuilder:~ $ if [ ps ax | grep $PID -ne '' ]
> then
>   kill $PID
> fi
bash: [: missing `]'
grep: 1200: No such file or directory
grep: ]: No such file or directory

But this is probably too niche a bug to spend so much time on, so I'll close it out.

from pi-power-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.