Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unable to write custom images / format as FAT32 without Internet #714

Closed
maxnet opened this issue Nov 5, 2023 · 7 comments · Fixed by #719
Closed

[BUG] Unable to write custom images / format as FAT32 without Internet #714

maxnet opened this issue Nov 5, 2023 · 7 comments · Fixed by #719
Assignees
Labels
bug Something isn't working

Comments

@maxnet
Copy link
Collaborator

maxnet commented Nov 5, 2023

Describe the bug

It is no longer possible to write custom images or format as FAT32 without Internet.
As also noticed by end-users: https://forums.raspberrypi.com/viewtopic.php?t=359002

To Reproduce

  • Disconnect cable or tear down network interface.
  • Start Imager
  • Press "choose OS"
  • Empty screen there

Additional context

Imager was originally designed to still offer the option to write a custom .img file, and format as FAT32, even if the user doesn't have Internet and downloading the os_list therefore fails.
This was done by hard coding those options in the osmodel ListModel in main.qml and pre-pending additional items to it on download.

Commit 3f665e0#diff-6b6066b8c2cfa063e0014db476a9967f054fc913bb71de97644e91e91e3660d3R1400 changes this to only append the custom image options after the OS list is downloaded.
This renders Imager unusable to users that cannot directly use the RPI server for any reason. (Could be no Internet, but also that they are running an old operating system that does not have the right SSL certificates, or that they cannot reach the server directly due to firewall problems, which they may have no control over.)

If this change in behavior was intended then at least the commit log should mention that.
Failing that, I consider this a bug.

@maxnet maxnet added the bug Something isn't working label Nov 5, 2023
@tdewey-rpi
Copy link
Collaborator

Definitely a defect. I'll take a look at this today.

Workaround for now is to use the CLI:

rpi-imager --cli $CUSTOM_IMAGE_FILE_PATH $DESTINATION_MEDIA_PATH

tdewey-rpi added a commit to tdewey-rpi/rpi-imager that referenced this issue Nov 6, 2023
When we changed the mechanism for appending the special flash options
to the OS list, this made those items dependent on a JSON parsing
success.

Unfortunately, there's a number of ways that JSON parsing can fail. And
when it did, it took out the special items with it.

So, let's make failure return an empty object - which is safe with all
current callers - and let the subsequent iterators catch the empty case.

Tested on WSL, in a no-internet scenario.

Resolves raspberrypi#714
@maxnet
Copy link
Collaborator Author

maxnet commented Nov 6, 2023

Workaround for now is to use the CLI:

Or drag & drop file from a file manager to Imager GUI window.

@maxnet
Copy link
Collaborator Author

maxnet commented Nov 6, 2023

"qml: Return empty object on JSON failures"

It really should have the "use custom" item by default, and user should not have to wait till failure.
It can take a long time to fail in certain situations.

E.g. on embedded it will not start downloading the list until it has received an IP through DHCP. Which may take 30 seconds if STP is active in network.
And it may even never get an IP-address, in some corner cases.
(Embedded edition also allow people to bring their image on USB stick, so user does not always need Internet).

@tdewey-rpi
Copy link
Collaborator

That sounds like an orthogonal bug, where the embedded imager should present an OS list immediately and back-fill as it gains more knowledge?

@maxnet
Copy link
Collaborator Author

maxnet commented Nov 6, 2023

That sounds like an orthogonal bug, where the embedded imager should present an OS list immediately and back-fill as it gains more knowledge?

Perhaps at least display a big fat warning if STP is in-use and it is going to take a long time for Imager to be functional.

(Can be detected. Like we do with Piserver https://github.com/raspberrypi/piserver/blob/67a1513d8e6b6ec60458a6cfa81e97d046934bca/src/stpanalyzer.cpp )

But regardless of that. I do believe "use custom" should be available in all situations. And not only after a failure.

@tdewey-rpi
Copy link
Collaborator

@maxnet Completely agreed. Unfortunately this dovetails with another incoming feature, where we are going to move the OS list fetching and filtering into the C++ layer as part of a refactor to grant more powers to the CLI mode.

@tdewey-rpi
Copy link
Collaborator

I now believe the latest PR (#719) should safely resolve this problem - albiet producing slightly different internal JSON representations. Additionally, it sets the ground work for moving more business logic into the C++ layer, where we can verify it ahead of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants