9

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?

4 Answers 4

16

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.

2
  • 1
    Passing the email to -k is something I didn't think of doing, thanks!
    – goetz
    Sep 30, 2018 at 0:16
  • This worked for me, I tried signing it separately to no avail. An strace revealed that it was looking for the buildinfo in a temp directory.
    – Adam D.
    Nov 25, 2019 at 11:47
13

Try:

sudo debuild -b -uc -us

That command generates an unsigned deb files for local use.

3
  • 1
    I used the -uc -us flags from this post and did: sudo dpkg-buildpackage -rfakeroot -b -uc -us Does this do the same as debuild?
    – qwerty9967
    Jun 18, 2019 at 12:51
  • 2
    @qwerty9967 is the same, based in this man site: man7.org/linux/man-pages/man1/dpkg-buildpackage.1.html - "-us, --unsigned-source" and "-uc, --unsigned-changes" Jun 18, 2019 at 17:40
  • 1
    use sudo dpkg-buildpackage -b -uc -us was the solution for me
    – poka
    Aug 28, 2023 at 18:14
5

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

1
0

It looks like you didn't import your private key. Try to import it:

gpg --import private-key-file.gpg

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .