kindle-dash icon indicating copy to clipboard operation
kindle-dash copied to clipboard

Failed to download image

Open iantearle opened this issue 3 years ago • 26 comments

Just tried the latest release, all was fine, but it failed to download the image

This line appears to be incorrect: $(dirname "$0")/../ht"

Logs are as follows:

Partial screen refresh
eips: paint_image> cannot open "./dash.png":can't fopen
Going to suspend, next wakeup in s
Wed May 25 12:06:42 UTC 2022 Battery level: 97%.
./dash.sh: line 111: ./next-wakeup: Permission denied
sh: 3600: unknown operand
Refreshing dashboard
Wi-Fi connected
./local/fetch-dashboard.sh: line 4: ./local/../ht: not found
Partial screen refresh
eips: paint_image> cannot open "./dash.png":can't fopen```

iantearle avatar May 25 '22 12:05 iantearle

Equally, if I move ht folder to some other place in the directory structure I get line 4: local/../ht: Permission denied

iantearle avatar May 25 '22 12:05 iantearle

Hi, I'm having a similar issue - my logs look like this: Wed Jul 20 12:05:11 GMT-03:15 2022 Battery level: 96%. ./dash.sh: line 122: ./next-wakeup: Permission denied Refreshing dashboard Wi-Fi connected ./local/fetch-dashboard.sh: line 4: ./local/../ht: not found Not updating screen, fetch-dashboard returned 127 Going to suspend, next wakeup in s

Did you manage to fix this issue?

floftus-at-csm avatar Jul 20 '22 15:07 floftus-at-csm

Ensure the images is coming from http a non secure location. HTTPS isn't available on the Linux build of kindle 4

iantearle avatar Jul 20 '22 20:07 iantearle

Hi sorry for my late reply. I'll try to look into this later this week. It seems to be a file permissions issue.

Btw HTTPS should work. The HTTP client (ht) uses rusttls with bundled root certificates.

pascalw avatar Jul 21 '22 11:07 pascalw

cool, this is now working perfectly with a github pages HTTPS page - I think my error was because I had failed to make one of my files executable Thanks so much for your code @pascalw !!

floftus-at-csm avatar Jul 25 '22 13:07 floftus-at-csm

@iantearle @floftus-at-csm I've looked into this and indeed it seems this must be related to (some of the files) somehow missing the executable bit in your case. I've checked the last release however and the tarball does have the right permissions set on the files. Do you remember how you've extracted the tarball and copied it to the Kindle?

pascalw avatar Jul 27 '22 18:07 pascalw

Btw HTTPS should work. The HTTP client (ht) uses rusttls with bundled root certificates.

In my case the image download doesn't fail for permission issues, but for xh somehow not being able to parse the system certificates file. I found curl working very well on my Kindle PW Touch for https links, and it should be a pretty standard utility, present almost everywhere, so I filed a pull request with this and another fix to make it work on PW Touch.

Thank you for this great piece of software!

penguin86 avatar Feb 25 '23 10:02 penguin86

Hi there, I've come back to this and am attempting to run kindle-dash via KUAL. I am consistently getting this error in my logs xh: error: builder error: Could not load PEM file "/etc/ssl/certs/ca-certificates.crt" Caused by: Could not load PEM file "/etc/ssl/certs/ca-certificates.crt" Not updating screen, fetch-dashboard returned 1 I am on a Kindle 4 Do you know how to get around this? The url I am attempting to get is an HTTPS url, the same as I was using before

floftus-at-csm avatar Mar 18 '23 09:03 floftus-at-csm

Yes, it's exactly the problem I was talking about. You should try to use curl. You may want to try my fork or wait for it to be merged. https://github.com/penguin86/kindle-dash Sorry for the lack of details, but I'm currently away from my computer.

penguin86 avatar Mar 18 '23 09:03 penguin86

@floftus-at-csm which Kindle model are you using? On my kindle 4 NT I do have a system certificate bundle at /etc/ssl/certs/ca-certificates.crt. I guess that other models might not have this?

The reason that I provide the xh http client is that curl and wget on the kindle 4 NT are too old to communicate with modern HTTPS endpoints. If you have a newer kindle then the built-in curl might work for you. In that case you can just modify fetch-dashboard.sh to use curl instead of xh.

Thinking about this now it might make sense for kindle-dash to include a recent set of root certificates. xh can be compiled with root certificates built into the binary. That's pretty useful given that most kindles that are used for this purpose are old and don't receive updates anymore.

pascalw avatar Mar 18 '23 14:03 pascalw

hey, thanks both for your response - I have tried to use the CURL solution but this gives me the error you predicted @pascalw curl: (35) error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version Not updating screen, fetch-dashboard returned 35 This is on a Kindle 4 (version 4.1.2) If you could compile xh with root certificates at some point that would be amazing :)

floftus-at-csm avatar Mar 18 '23 15:03 floftus-at-csm

I can confirm my kindle is slightly newer, it's a Paperwhite Touch. I've seen it referred also as "Kindle 5" somewhere. On mine, unfortunately xh does fail with error Could not load PEM file "/etc/ssl/certs/ca-certificates.crt". The file exists and, as long as I can see, is readable.

penguin86 avatar Mar 18 '23 15:03 penguin86

@floftus-at-csm or @penguin86 could you try if the attached xh build works for you?

xh.zip

pascalw avatar Mar 19 '23 12:03 pascalw

Unfortunately I still get the same error with this build

`xh: error: builder error: Could not load PEM file "/etc/ssl/certs/ca-certificates.crt"

Caused by: Could not load PEM file "/etc/ssl/certs/ca-certificates.crt"`

However! I went back to the ht method from kindle-dash-1.0.0-beta.3 and it worked - images downloaded from an HTTPS url no problem

floftus-at-csm avatar Mar 19 '23 17:03 floftus-at-csm

Humm that's interesting. I guess it might be a bug in xh then. I don't have much time to dive into it now unfortunately, maybe I'll have another look later. It's a bit difficult since I can't reproduce this myself on my kindles.

pascalw avatar Mar 19 '23 20:03 pascalw

Hi @pascalw, thanks a lot for creating this dashboard. Your Kindle firmware might be the reason why you couldn't reproduce this error.

Kindle-dash was working without issues for my K4 on firmware 4.1.4, but since I downgraded to 4.1.1 using the Kubrick tool, I also receive the error Could not load PEM file "/etc/ssl/certs/ca-certificates.crt".

As @floftus-at-csm mentioned, reverting to kindle-dash-1.0.0-beta.3 does indeed seem to solve this problem.

qadzek avatar Jul 18 '23 06:07 qadzek

@infinitewhileloop my devices are on 4.1.3 and 4.1.4, so indeed that might explain why I can't reproduce the issue.

I might downgrade one of my devices later if I have some time, to debug this issue.

Can I ask why you would downgrade to 4.1.1?

pascalw avatar Jul 19 '23 18:07 pascalw

I downgraded the firmware because I was unable to install KUAL, due to the This device is not authorized as a test Kindle by the developer of this item. error. A MobileRead user suggested to downgrade the firmware using Kubrick. Getting Kubrick to work was quite complicated, I needed an ancient laptop to boot from their live USB.

qadzek avatar Jul 20 '23 07:07 qadzek

I found a workaround for the error

xh: error: builder error: Could not load PEM file "/etc/ssl/certs/ca-certificates.crt"

Caused by:
Could not load PEM file "/etc/ssl/certs/ca-certificates.crt"

Upload the file /etc/ssl/certs/ca-certificates.crt from a more up-to-date linux to the kindle and use the --verify option in xh. For example: "$(dirname "$0")/../xh" --verify "$(dirname "$0")/../ca-certificates.crt" -d -q -o "$1" get https://raw.githubusercontent.com/pascalw/kindle-dash/master/example/example.png

tobire avatar Oct 09 '23 19:10 tobire

I found a workaround for the error

xh: error: builder error: Could not load PEM file "/etc/ssl/certs/ca-certificates.crt"

Caused by:
Could not load PEM file "/etc/ssl/certs/ca-certificates.crt"

Upload the file /etc/ssl/certs/ca-certificates.crt from a more up-to-date linux to the kindle and use the --verify option in xh. For example: "$(dirname "$0")/../xh" --verify "$(dirname "$0")/../ca-certificates.crt" -d -q -o "$1" get https://raw.githubusercontent.com/pascalw/kindle-dash/master/example/example.png

Hi - where did you get a working crt file from? Could you paste a link? Thanks!

jonwinstanley avatar Oct 11 '23 11:10 jonwinstanley

I found a newer crt file, but how do you overwrite it?

mv: overwrite './ca-certificates.crt'? y
mv: cannot remove './ca-certificates.crt': Read-only file system

jonwinstanley avatar Oct 11 '23 12:10 jonwinstanley

I found a newer crt file, but how do you overwrite it?

mv: overwrite './ca-certificates.crt'? y
mv: cannot remove './ca-certificates.crt': Read-only file system

Try mntroot rw. To return to read-only mntroot ro.

qadzek avatar Oct 11 '23 12:10 qadzek

Actually, I realised that even when you specify http github is forcing https (maybe a redirect?)

I downloaded your image and hosted it on server where http is permitted and dashboard works fine

jonwinstanley avatar Oct 11 '23 13:10 jonwinstanley

I got the file from another up-to-date Linux system. You don't have to overwrite the file /etc/ssl/certs/ca-certificates.crt. Just save the new certificate file wherever possible and link it in the xh-command as shown in my example.

tobire avatar Oct 14 '23 12:10 tobire

I found a workaround for the error

xh: error: builder error: Could not load PEM file "/etc/ssl/certs/ca-certificates.crt"

Caused by:
Could not load PEM file "/etc/ssl/certs/ca-certificates.crt"

Upload the file /etc/ssl/certs/ca-certificates.crt from a more up-to-date linux to the kindle and use the --verify option in xh. For example: "$(dirname "$0")/../xh" --verify "$(dirname "$0")/../ca-certificates.crt" -d -q -o "$1" get https://raw.githubusercontent.com/pascalw/kindle-dash/master/example/example.png

Thanks for your workaround. At first, it looked like the new certificates weren't picked up, but after a reboot it seems to work fine. Now I am able to use the latest kindle-dash release on my Kindle K4 NT on firmware 4.1.1.

qadzek avatar Oct 27 '23 16:10 qadzek

Hey sorry for my lack of participation in this thread. Good that we have a workaround available for older FW versions.

I think a nice solution could be to include certificates in the xh binary. This seems to be supported by reqwest which is the underlying http client used in xh. It's however not directly supported by xh it seems, but should be quite simple to do. I don't have time currently to look into this, so if anyone else would be willing to look into that, that would be awesome!

pascalw avatar Oct 29 '23 09:10 pascalw