Move the method description to the right hand side
of the list of methods. This allows us to extend the
list of methods so that the info doesn't fall of the
terminal on a 80x24 system that is using the frame
buffer such as shredos.
Also updated the information, making it more
description in terms of describing the passes used
for each method.
Using the 'b' key you can now toggle between
dark/blank/default screens during a wipe.
Added the dark option to prevent TFT/LCD image
persistence.
See:
https://en.wikipedia.org/wiki/Image_persistence
1. Allows zero fill to be verified when blanking off.
Prior to this if you wanted to verify a zero pass,
blanking had to be on. This meant a zero pass, then a
blanking pass then a verify, effectively two zero passes
and a verify. This is now fixed so you can now do a zero
pass with verification without a blanking pass. This knocks
a third off the wipe time of a zero fill with verification.
This also means all other methods can have either all their
passes or just the last pass verified without blanking being
enabled.
2. OPS2 method requires the last pass to be random, the GUI
now disables the use of the blanking option for this message
and displays a warning message that a final blanking pass is
not allowed for OPS2. It never did a final blanking pass
anyway, even if it was selected, but this makes it clearer in
the GUI.
3. The caculate_round_size() function was improved by reducing
some duplicated code and bring the full calculation into this function.
4. On completion of each pass or verification the total number of
bytes written or read for each pass or verification is logged.
Although the blanking pass verification is
completed correctly the GUI status message
did not show the status as 'Verifying', the
status message continued to say blanking.
This patch fixes the GUI message so if
verification and blanking pass are enabled,
then when blanking is complete and verification
starts the drive status message changes from
'blanking' to 'Verifying'.
This patch fixes the issue where irrespective
of whether the user selects mersenne or isaac
in the GUI, mersenne is always used without the
user being aware mersenne was being used instead
of isaac.
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.