0

I am using an S3 / duplicity back up script, save my files. It has been working just fine, until I added a second gpg key. Then all hell broke loose. I tried to deal with two keys, then I deleted the second key. Then I remove / purged gpg altogether and started with a fresh start.

I created a new key and this is the response I get.

GPGError: GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: no default secret key: secret key not available
gpg: [stdin]: sign+encrypt failed: secret key not available
===== End GnuPG log =====

` Here is my back up script (but I don't think that is the problem)

#!/bin/bash

# Make GPG explicitly aware of our private key,
# since we'll be running this via cron as root


HOME="/" SOURCE="/" TARGET=s3+http://xxxx/xxxxx/
LOGFILE=/home/bege/.duplicity/desktop.log export HOME=$HOME export
SOURCE=$SOURCE export TARGET=$TARGET export LOGFILE=$LOGFILE

# Load our credentials source "/home/bege/Desktop/.credentials.conf"

export PASSPHRASE export AWS_ACCESS_KEY_ID export
AWS_SECRET_ACCESS_KEY

GPG_KEY='7E4B6B9B'

duplicity \
    --verbosity notice \
    --s3-use-new-style \
    --volsize=1000 \
    --encrypt-key="$GPG_KEY" \
    --sign-key="$GPG_KEY" \
    --full-if-older-than 7D \
    --asynchronous-upload \
    --log-file "/home/bege/.duplicity/log.log" \
    --include=/home/bege/Desktop/charts \
    --exclude=/** \
    --progress \
    $SOURCE \
    $TARGET > $LOGFILE

unset PASSPHRASE unset AWS_ACCESS_KEY_ID unset AWS_SECRET_ACCESS_KEY

Here are the details of my keys:

/home/bege/.gnupg/pubring.gpg
-----------------------------
pub   2048R/7E4B6B9B 2015-07-15
uid                  Chad H <me@mail.com>

/home/bege/.gnupg/secring.gpg
-----------------------------
sec   2048R/7E4B6B9B 2015-07-15
uid                  Chad H <me@mail.com>

I have also modified the conf file to make this key the default one. I have spent far too much time on this but I'm obssessed for some lame reason, I'm at my wits end, thanks in advance.

2

Thanks to the help of NIIBE, the problem was:

I re-read your original post again, and found that you redefine the environment variable "HOME" in the script, which is the cause of the trouble.

Please add two lines in your script:

GNUPGHOME=/home/bege/.gnupg
export GNUPGHOME

Then, please try with new script. After you set GNUPGHOME, gpg command will access that directory.

(Please note that secret subkey for encryption is also needed.)

Hopefully this will save somebody some time someday.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.