1

The command sha256sum correctly calculates checksum indicated in .sha256 file:

user@myHostname:~/Desktop/RT_N16/Merlin_JohnsFork$ sha256sum RT-N16_3.0.0.4_374.43_2-39L3j9527.trx
545927719c46e359a0db6bf9dcb348f99c0f3d8786725780cb182994c61b19be  RT-N16_3.0.0.4_374.43_2-39L3j9527.trx

All files are in the same directory. I did NOT create the Contents of a .sha256 file:

user@myHostname:~/Desktop/RT_N16/Merlin_JohnsFork$ cat sha256sum.sha256 
545927719c46e359a0db6bf9dcb348f99c0f3d8786725780cb182994c61b19be  RT-N16_3.0.0.4_374.43_2-39L3j9527.trx

The sha256sum command reads the .sha256 file and returns an error:

user@myHostname:~/Desktop/RT_N16/Merlin_JohnsFork$ sha256sum -c sha256sum.sha256
sha256sum: 'RT-N16_3.0.0.4_374.43_2-39L3j9527.trx'$'\r': No such file or directory
: FAILED open or read_2-39L3j9527.trx
sha256sum: WARNING: 1 listed file could not be read

QUESTIONS

  • Is the above syntax incorrect or is there a problem with the .sha256 file?

  • Is the command trying to open a filename= _2-39L3j9527.trx?

gatorback
  • 6,523

1 Answers1

1

If you look carefully, you can see that the message is actually

filename$'\r': No such file or directory

The $'\r' is the shell's way of telling you that there is a carriage return (\r) character at the end of the string. This indicates that the sha256sum.sha256 file has DOS- or Windows-style line endings (CRLF) in place of the Unix standard LF endings.

You can fix the file using one of the methods described in How to change Windows line-ending to Unix version

You can use the program dos2unix, which is specifically designed for this:

dos2unix file.txt

will replace all CR from all lines, in place operation.

To save the output in a different file:

dos2unix -n file.txt output.txt

You might need to install it first by:

sudo apt-get install dos2unix
gatorback
  • 6,523
steeldriver
  • 142,475