Welcome to the Linux Foundation Forum!

Lab 3.2 - step 4 - not getting any output (hash)

adeelmirza
adeelmirza Posts: 2
edited August 2018 in LFS258 Class Forum

ubuntu@ip-172-31-7-165:~$ openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.*//'

ubuntu@ip-172-31-7-165:~$



--

No error just see a blank space where the CA Cert Hash should be.

Any ideas?

Adeel

Comments

  • chrispokorni
    chrispokorni Posts: 2,349

    Hi Adeel, 

    I see 2 possible issues here: 

    1 - In the lab, there is a blank space between * and //


    sed 's/^.* //'

    If it disappeared during copy/paste that could be one of your issues. 

    2 - Curly single quotes around the 


    's/^.* //'

    from the lab PDF. They tend to cause errors or things not to happen as expected. You may encounter them in a few different places throughout the labs. The simple workaround is to copy the command in a simple text editor, delete the curly single quotes and type the apostrophe sign instead. Then copy the command from here and paste into the terminal. It seems that different text formats are treating these characters differently even if they look ok. 

    Or, if pasting directly into the terminal, delete the curly single quote and type apostrophe instead.

    I only encountered this problem with the curly single quotes from the PDF. 

    Good luck!

    -Chris

  • serewicz
    serewicz Posts: 1,000

    Hello Adeel,

    When troubleshooting a command using pipes it can be helpful to run each section at a time to determine which has the issue.  Do you see any output for each section before it gets piped along? You can also replace a pipe with a tee, which allows the output at that point to both be passed along as well as written to a file.

    In this case my guess is that your copy/paste from a PDF or online document did not convert the single quotes properly. Instead one or both become back-quotes, which have different meaning to the shell. If you run the same command, but erase and replace the single quotes does it work?

    Regards,

  • adeelmirza
    adeelmirza Posts: 2
    edited August 2018

    Thanks for the help...yes, it was a spacing issue in the sed command...

     

    ubuntu@ip-172-31-7-165:~$ openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'

    e1224288d0313462c554a8f86d63cbc8797bc87d1e9d6dd6136577178787be46

     

Categories

Upcoming Training