Signing package with dpkg-buildpackage fails but succeeds with debsign

I have the following gpg key:

-----------------------------
pub   2048R/F516F2E7 2017-06-19
uid                  Ulad Kasach <[email protected]>
sub   2048R/4057A05F 2017-06-19

When I attempt to create and sign a package with dpkg-buildpackage -kF516F2E7 -S -sa, I get the following error:

gpg: skipped "F516F2E7": No secret key
gpg: dpkg-sign.1F6Q4CLd/<package name>.dsc: clearsign failed: No secret key

dpkg-buildpackage: error: failed to sign .dsc and .changes file

However, if I run debsign -k F516F2E7 <package name>.dsc It succeeds.

Does anyone know why this could be and how dpkg-buildpackage can be made to succeed?


I was having this same issue until now.

dpkg-buildpackage seems to expect you to pass an email address along with the -k flag rather than the key ID.

dpkg-buildpackage [email protected]

After this i had no errors.


Try:

sudo debuild -b -uc -us

That command generates an unsigned deb files for local use.


While this does not answer the question of "why dpkg-buildpackage fails", by replacing dpkg-buildpackage with debuild (debuild accepts dpkg-buildpackage arguments) the intended result can be had.

tl;dr: "str.replace" dpkg-buildpackage with debuild for a quick solution