Since at least 2013 (the initial nwipe commit),
isaac has never functioned. When the issac prng
was selected in the GUI, nwipe used the mersenne
twister prng instead. Not that you would ever
have known, as there were no log entries saying which
prng was being actively used.
However, I don't believe this was just an nwipe
issue, looking at the code for DBAN's dwipe the
same function nwipe_isaac_read( NWIPE_PRNG_READ_SIGNATURE )
exists as it does in nwipe. In both cases the function
has no code that actually does anything.
This patch populates this function and brings isaac
back to life !
This bug was also responsible for verification errors
when the option prng=isaac was used on the command
line. Worse still, if you used prng=isaac on the
command line then wiped using method=prng, no verification
and no blanking you would expect to see random data. You
don't, instead you would see either all zeros or mainly
zeros because the uninitialised buffer that should have
contained random data instead contained initialised text
data such as partial log entries. This patch and previously
submitted patches fix all these problems related to the
isaac implementation.
A separate commit will fix the GUI prng selection which
was leading everybody to believe isaac was being used
when in fact it was mersenne all along.
Additional log messages are produced and a failed prng
causes a wipe failure. The buffer that outputs prng data
to the disk is now initialised with zeros (calloc rather than malloc)
to avoid uninitialised memory leakage to the disk in the event of some
unforeseen bug. This initialised buffer is also required for the check
process.
Why do this check? At a future date more prng methods may be added. This
is a very basic check that they produce some output although the output
is not verified in terms of it's randomness. This check was also
implemented to show an existing bug in the Isaac implementation in nwipe.
See the example log below that shows a failed prng. This would be caused
by a bug in the prng implementation. See the last few messages after
pass 3/3 starts. 3/3 in DoD short is the prng pass.
[2021/05/29 20:30:27] notice: Invoking method 'DoD Short' on /dev/loop29
[2021/05/29 20:30:27] notice: Starting round 1 of 1 on /dev/loop29
[2021/05/29 20:30:27] notice: Starting pass 1/3, round 1/1, on /dev/loop29
[2021/05/29 20:30:39] notice: 1073741824 bytes written to /dev/loop29
[2021/05/29 20:30:39] notice: Finished pass 1/3, round 1/1, on /dev/loop29
[2021/05/29 20:30:39] notice: Starting pass 2/3, round 1/1, on /dev/loop29
[2021/05/29 20:30:58] notice: 1073741824 bytes written to /dev/loop29
[2021/05/29 20:30:58] notice: Finished pass 2/3, round 1/1, on /dev/loop29
[2021/05/29 20:30:58] notice: Starting pass 3/3, round 1/1, on /dev/loop29
[2021/05/29 20:30:58] notice: Initialising Isaac prng
[2021/05/29 20:30:58] fatal: ERROR, prng wrote nothing to the buffer
[2021/05/29 20:30:58] notice: 0 bytes written to /dev/loop29
[2021/05/29 20:31:03] error: Nwipe exited with fatal errors on device = /dev/loop29
********************************************************************************
! Device | Status | Thru-put | HH:MM:SS | Model/Serial Number
--------------------------------------------------------------------------------
! loop29 |-FAILED-| 69 MB/s | 00:00:31 | Loopback device/
--------------------------------------------------------------------------------
[2021/05/29 20:31:03] Total Throughput 69 MB/s, DoD Short, 1R+NB+NV
********************************************************************************
A message is also shown for a successful prng output. i.e "prng is active"
See example below.
[2021/05/29 20:04:30] notice: Invoking method 'DoD Short' on /dev/loop29
[2021/05/29 20:04:30] notice: Starting round 1 of 1 on /dev/loop29
[2021/05/29 20:04:30] notice: Starting pass 1/3, round 1/1, on /dev/loop29
[2021/05/29 20:04:44] notice: 1073741824 bytes written to /dev/loop29
[2021/05/29 20:04:44] notice: Finished pass 1/3, round 1/1, on /dev/loop29
[2021/05/29 20:04:44] notice: Starting pass 2/3, round 1/1, on /dev/loop29
[2021/05/29 20:04:59] notice: 1073741824 bytes written to /dev/loop29
[2021/05/29 20:04:59] notice: Finished pass 2/3, round 1/1, on /dev/loop29
[2021/05/29 20:04:59] notice: Starting pass 3/3, round 1/1, on /dev/loop29
[2021/05/29 20:04:59] notice: Initialising Mersenne Twister prng
[2021/05/29 20:04:59] notice: prng stream is active
[2021/05/29 20:05:25] notice: 1073741824 bytes written to /dev/loop29
1. The log reported verification errors while also
showing an entry in the log that said "[SUCCESS] Blanked /dev/...".
The blanked device message now shows [FAILURE] /dev/... may not be blanked"
if any verification errors are detected for a specific drive.
2. If a verification error occurred, the error would be correctly
shown in the GUI and in the logs but the summary table drive status
would show 'ERASED' not 'FAILED'. Now corrected so that the tables
drive status field shows 'FAILED' if any verification error is detected.
Prior to this it was marking the status as 'FAILED' only if the O.S
detected write errors. In practise most drive errors are detected
by the write I/O process on syncing but this will now detect errors not
recognised by the O.S. and found by the verification process. Despite
this the textual log and GUI correcty reported verification errors.
3. The final log message "Nwipe exited successfully" was checking for
fatal errors but ignoring non fatal errors despite being reported in
the log.
The final message now reads
either "Nwipe Exited Succesfully" if no fatal and non fatal errors were
detected. Alternatively it displays ...
"Nwipe exited with errors, check the log & summary table for individual drive status."
if any fatal OR non fatal errors are detected.
The shutdown command that nwipe currently uses is
"shutdown -P +1 "Broadcast shutdown message".
While the above command works works fine on Ubuntu 18.04 LTS it
does not work on the version of shutdown used in buildroot, failing
with the error:
"shutdown -H and -P flags can only be used along with -h flag"
Luckily there is a shutdown command with options that work correctly
on both buildroot (ShredOS) and Ubuntu 18.04 LTS, this is
shutdown -Ph +1 "Broadcast shutdown message". i.e. the option -h has been added.
This bug only occurs when you resize the terminal while
on the drive selection screen, then switch to method, rounds
or blanking. To the right of the message the text background
is now blue and not white and random box characters appear.
To me it seems to be a bug not in nwipe but in curses, however
placing double quotes around the message fixes the problem. I
also found that the contents of the message appeared to trigger
the problem, possibly the '=' symbol, however the fact that
the main selection text does not require the quotes is most odd.
Still, this simple fix seems to get rid of the problem.
If submitting pull requests, you must `make format` prior to commiting code and submitting a pull request otherwise you pull request will fail the CI that checks formatting.
If submitting pull requests, you must `make format` prior to commiting code and submitting a pull request otherwise you pull request will fail the CI that checks formatting.
1. Prior to this fix, if a user aborted a multi drive using control-C,
and if some of the drives had completed their wipe either
successfully or with a I/O failures, the summary log would say
UABORTED for all drives. UABORTED is acceptable status for drives that
hadn't completed their wipe but for drives that had completed the wipe,
the summary table should have gave either a ERASED or FAILED status
message. This fix corrects the summary status when using control-c to
abort a multi drive wipe where some drives have completed and some have
not.
2. If I wipe was selected but not started and then the user used
control-C to abort nwipe, the summary table would possibly
intermittently be displayed showing the last drive wiped. The correct
behaviour is that no summary table is displayed if the wipe hasn't been
started yet. This fix corrects the behaviour of the summary table when
control-c is used and a drive has been selected for wiping but not
started, in this scenario the summary table is NOT displayed.
3. When nwipe exits it always prints the message "nwipe successfully
exited". To make this single line message more informative it now
reports a different message depending upon the wipe status.
These four messages are:
"Nwipe was aborted by the user. Check the summary table for the drive
status" - When the user aborts during a wipe.
"Nwipe was aborted by the user prior to the wipe starting."
"Nwipe exited with fatal errors, check the summary table for individual
drive status." - When one or more drives failed.
"Nwipe successfully completed. See summary table for details." - When
selected drives were all erased without error.
... and reduce confusion about lowercase and uppercase option. All options are now defaulting to show as lowercase in the GUI except Start which can only be invoked with SHIFT S to prevent accidental start of wipe. Unless someone enjoys pressing additionally SHIFT for B and R and V and all the other options I'd propose it might be time to remove unneeded code for this :)
This commit adds nwipes banner version number and OS info derived from /proc/version to the nwipe log. This information may be useful when a user has an issue and submits a log file.