cp: cannot stat `/lib/libnss_*’: No such file or directory

Another Quick note as I keep running into this and every time go hunting for what I did to fix it last time.

When doing update/upgrades I run into the error cp: cannot stat `/lib/libnss_*’: No such file or directory when it’s running update-initramfs

This seems to be because of the dropbear hooks, that I use to decrypt a filesystem remotely.


Has all the info, but the basic steps for me are:-

nano -w /usr/share/initramfs-tools/hooks/dropbear

search for the line

cp /lib/libnss_* "${DESTDIR}/lib/"
Add x86_64-linux-gnu into the path making the line

cp /lib/x86_64-linux-gnu/libnss_* "${DESTDIR}/lib/"

UPDATE: This is valid for a 64bit system. For a 32bit system the path is more likely to be /lib/i386-linux-gnu/
This would make the line

cp /lib/i386-linux-gnu/libnss_* "${DESTDIR}/lib/"

Then run

update-initramfs -u

and no error.

3 thoughts on “cp: cannot stat `/lib/libnss_*’: No such file or directory”

  1. Thanks for the tip!

    BTW, for the 32 bit system, you still have to have the root “/” at the beginning, so it should be:

    cp /lib/i386-linux-gnu/libnss_* “${DESTDIR}/lib/”

    Users can verify if this is the correct path on their system by doing:

    sudo find / | grep ‘libnss_*’

    Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *