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

Give clearer error message when ISO file is not complete #869

Closed
sshnaidm opened this issue May 30, 2022 · 6 comments
Closed

Give clearer error message when ISO file is not complete #869

sshnaidm opened this issue May 30, 2022 · 6 comments

Comments

@sshnaidm
Copy link

Bug

Misleading error message when using not fully downloaded rhcos ISO image.
I haven't download the image fully, it's only 512M size. When I'm running coreos-installer iso kargs modify -a "ip=dhcp" command on this ISO, I get the message:

Error: reading kargs embed area

Caused by:
    0: reading 1132 bytes at 1082311624
    1: failed to fill whole buffer

Host Operating System Version

RHEL 8.2

Target Operating System Version

coreos-installer Version

0.14, 0.11

Expected Behavior

Message about Error: reading kargs embed area

Actual Behavior

Probably would be better to detect that the image is wrong and can't be modified.

Reproduction Steps

Start download ISO of RHCOS, stop it in the middle and run the command:
$ coreos-installer iso kargs modify -a "ip=dhcp" rhcos-411.85.202205101201-0-live.x86_64.iso

Other Information

@jlebon
Copy link
Member

jlebon commented May 30, 2022

I think one of the base issues is that seek doesn't error out by default if seeking past the end of the file. There's SEEK_DATA which would (and then we could catch ENXIO and give a nicer error), but we'd need to look beyond std::io for it (it also doesn't seem supported on every filesystem, though all the popular ones at least). We could also wrap seeks intended for subsequent reads with a method that also does a follow-up read of one byte.

@jlebon
Copy link
Member

jlebon commented May 30, 2022

Hmm, actually another simpler check we can do upfront is to just get the offset of the last file in the ISO and verify that file offset + file length <= ISO length.

@jlebon jlebon changed the title Misleading error message when using wrong image Give clearer error message when ISO file is not complete May 30, 2022
@travier
Copy link
Member

travier commented May 30, 2022

Yes, I was thinking we could do a basic "is this file large enough?" check to quickly root out such issues.

@jlebon
Copy link
Member

jlebon commented May 30, 2022

Related: #644

If coreos-installer download were supported for OCP, we'd correctly verify checksums.

@travier
Copy link
Member

travier commented Sep 12, 2022

@bgilbert is this fixed by #908?

@bgilbert
Copy link
Contributor

Yes, it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants