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

Replaced the old MD5 method with checkmd5. #61

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

chkboom
Copy link

@chkboom chkboom commented May 31, 2023

This replaces the old method of checking MD5 sums with a new utility, checkmd5. This offers a number of advantages compared to the previous md5sum method.

First, it provides progress indication (percentage) and allows the user to cancel the check, whereas the previous method had no way of cancelling a check or knowing its progress.

Also, the checkmd5 utility now stores the log in /var/log/live/checkmd5.log which is machine-readable, non-translated and contains the following:

  • The date/time the check was started.
  • Which checksum list files (*.md5) were used.
  • The target files and their expected MD5 sums.
  • Whether each target file passes or fails, and what their actual MD5 sum is.
  • Whether the user aborted it and how (escape key or some signal).
  • Any errors occurred during the checks or parsing of MD5 list files.

Any other applications (eg. the installer, or perhaps even QSI) can use this log, and even tack its contents to its own logs so that those who provide support can tell if the checks passed or failed.
Previously with the md5sum method, there was no logging or any means of checking whether the integrity check passed, failed, or if the user chose to skip the check.

@dolphinoracle
Copy link
Collaborator

I'm not going to do the commit right now as we have three people building isos at the moment. but I posted a link to the commit in teh forum. https://forum.mxlinux.org/viewtopic.php?p=727033#p727033

@AdrianTM
Copy link
Contributor

The log and progress indication are nice, however the performance is about half of md5sum on my system, I get about 25 sec. for md5sum -c and about 50 sec. for checkmd5 for the full MX ISO.

@chkboom
Copy link
Author

chkboom commented Aug 16, 2024

If there is sufficient interest, I am willing to continue working on the tool. I'll have to do some profiling to see where the performance is being hit.

@AdrianTM
Copy link
Contributor

Not sure you can get close to md5sum GNU tool... I thought it might be something simple like over logging stuff to the terminal but even with the option to update the terminal once per each percentage point (forgot what's the switch for that) it doesn't make much of difference.

@chkboom
Copy link
Author

chkboom commented Aug 17, 2024

I discovered that to be an I/O related issue. After calling posix_fadvise() to prepare for sequential I/O, the performance has improved and is now close to md5sum:

$ time ./checkmd5 test.md5
Press [Esc] to abort the integrity check.
Checking: 100.0%
The integrity check has passed.

real    0m6.176s
user    0m5.519s
sys     0m0.585s

$ time md5sum -c test.md5
MX-23_KDE_x64.iso: OK

real    0m4.656s
user    0m4.305s
sys     0m0.313s

For a ~10GB file full of random numbers:

$ time ./checkmd5 test.md5 
Press [Esc] to abort the integrity check.
Checking: 100.0%
The integrity check has passed.

real    0m40.530s
user    0m21.676s
sys     0m6.377s

$ time md5sum -c test.md5 
test.big: OK

real    0m39.492s
user    0m19.130s
sys     0m6.264s

There may be more room for improvement, but for now this seems acceptable.

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

Successfully merging this pull request may close these issues.

3 participants