Bug 290221 - KGpg 2.6.80 fails to start with nonexistant .gnupg directory
Summary: KGpg 2.6.80 fails to start with nonexistant .gnupg directory
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kgpg
Classification: Applications
Component: general (show other bugs)
Version: 2.6.x
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Rolf Eike Beer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-30 23:41 UTC by Alex Lowe
Modified: 2018-05-07 20:20 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
KGpg logfile after running strace (55.50 KB, text/x-log)
2016-01-06 09:48 UTC, LinuxRev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Lowe 2011-12-30 23:41:40 UTC
Version:           unspecified (using Devel) 
OS:                Linux

In a new install (with an upgrade to KDE 4.7.95 through the Kubuntu PPAs), KGpg fails to start (and thus I cannot import my keys).

The error given is:
GnuPG failed to start.
You must fix the GnuPG error first before running KGpg.

The dialogue gives the following details:
gpg: option file `/home/lengau/.gnupg/options': No such file or directory

gpg (version 1.4.11) works correctly from the shell, as does gpg2 (version 2.0.17 with libgcrypt 1.5.0).

KGpg 2.6.2 on KDE 4.7.3 (using Kubuntu packages as well) works correctly (it offers a startup wizard).

KGpg 2.6.2 (using Kubuntu packages) on KDE 4.7.95 works properly, though without the startup wizard (perhaps I don't have something installed? It doesn't offer a startup wizard even if I remove ~/.gnupg and ~/.kde/share/config/kgpgrc).

I have marked the bug as a crash even though it exits normally because the program is unusable in this state (and the program does exit).

Reproducible: Always

Steps to Reproduce:
1. Remove ~/.gnupg and ~/.kde/share/config/kgpgrc
2. Start kgpg

Actual Results:  
The error message listed in the bug details, followed by kgpg closing

Expected Results:  
KGpg should run normally

OS: Linux (x86_64) release 3.0.0-14-generic
Compiler: gcc
Comment 1 Alex Lowe 2011-12-30 23:43:12 UTC
Simply touching ~/.gnupg/options does not work with either kgpg 2.6.2 or 2.6.80, as it results in the following message:

gpg: NOTE: old default options file `/home/lengau/.gnupg/options' ignored
Comment 2 Rolf Eike Beer 2011-12-31 10:35:51 UTC
You have the "options" file set as configuration file in your KGpg config. The new KGpg version is the first one to actually force GnuPG to use that config file, while older versions only passed the directory to GnuPG, so silently ignoring the wrong configuration.

Open your ~/.kde4/share/config/kgpgrc and fix the gpg_config_path line to end in gpg.conf.

Meanwhile I'll think about a good dialog to tell the user what's wrong.
Comment 3 Alex Lowe 2012-01-01 00:42:56 UTC
This is the default state, with no ~/.kde/share/config/kgpgrc existing, nor any GPG settings.

New versions of GPG don't seem to like using ~/.gnupg/options anymore.
Comment 4 Rolf Eike Beer 2012-01-02 16:22:16 UTC
If I start KGpg from a user account that does neither have ~/.gnupg nor kgpgrc GnuPG will create a ~/.gnupg and ~/.gnupg/gpg.conf, which the first run assistant will then pick up. So your kgpgrc with the wrong entry has existed before running KGpg for the first time after the upgrade.
Comment 5 Kenneth Perry 2012-01-03 00:18:04 UTC
Looks like the default options in /usr/share/kubuntu-default-settings/kde4-profile/default/share/config/kgpgrc sets gpg_config_path, which is where its getting the value from.

Adding to ~/.kde/share/config/kgpgrc

[GPG Settings]
gpg_config_path=$HOME/.gnupg/gpg.conf

fixed it for me (overriding the global default).
Comment 6 Rolf Eike Beer 2012-01-03 09:18:12 UTC
> Looks like the default options in
> /usr/share/kubuntu-default-settings/kde4-profile/default/share/config/kgpgrc
> sets gpg_config_path, which is where its getting the value from.

Doh! Please file a bug for Kubuntu so they fix their stuff.
Comment 7 Unknown 2012-01-19 04:14:57 UTC
Hello...I discovered this bug report after adding my comments to bug 290113. I am also missing the kgpgrc file. I'm not running Kubuntu -- instead, I've simply installed KDE from the Ubuntu repositories. So I don't understand why a missing kgpgrc file would be considered a Kubuntu bug?
Comment 8 Unknown 2012-01-19 08:21:34 UTC
Got some help from bcooksley on the KDE forum: http://forum.kde.org/viewtopic.php?f=212&t=98666

He discovered a workaround, which is now reported in bug 291923: https://bugs.kde.org/show_bug.cgi?id=291923
Comment 9 Rolf Eike Beer 2012-01-19 09:15:48 UTC
Please run:

find /usr/share -name kgpgrc

If you find such a file, please check if there is a gpg_config_path entry
in there. I bet it is, having the "options" file in it. If this is the
case please report a bug to your distro to not ship a broken defaults
file.

Please also report back if there is no such file.
Comment 10 Unknown 2012-01-21 00:02:22 UTC
Kubuntu 11.10, KDE 4.7.4: yes, the file exists. It is in /usr/share/kubuntu-default-settings/kde4-profile/default/share/config/. And it contains the incorrect setting you've described. Curiously 

Ubuntu 12.04, KDE 4.7.97 installed from repos (not Kubuntu): the file does not exist. I manually downloaded kubuntu-default-settings for 12.04 and checked the default kgpgrc; it's still configured with the old $HOME/.gnupg/options value. I'll file a bug against Kubuntu.

After going through the exercise described in bug 291923, I know understand why _this_ bug (290221) is for Kubuntu.
Comment 11 Unknown 2012-01-21 00:19:39 UTC
(In reply to comment #10)
> Kubuntu 11.10, KDE 4.7.4: yes, the file exists. It is in
> /usr/share/kubuntu-default-settings/kde4-profile/default/share/config/. And it
> contains the incorrect setting you've described.
> 
> Ubuntu 12.04, KDE 4.7.97 installed from repos (not Kubuntu): the file does not
> exist. I manually downloaded kubuntu-default-settings for 12.04 and checked the
> default kgpgrc; it's still configured with the old $HOME/.gnupg/options value.
> I'll file a bug against Kubuntu.
> 
> After going through the exercise described in bug 291923, I know understand why
> _this_ bug (290221) is for Kubuntu.
Comment 12 Unknown 2012-01-21 00:20:21 UTC
Grr. Sorry for the double post. Trying to remove the word "Curiously" in the first paragraph!
Comment 13 Rolf Eike Beer 2012-01-21 09:50:52 UTC
A Kubuntu developer (Riddel) is already aware of this and promised to fix it when packaging SC4.8.
Comment 14 Jonathan Riddell 2012-01-27 13:58:44 UTC
Bug https://bugs.launchpad.net/ubuntu/+source/kubuntu-default-settings/+bug/919460 covers this in Ubuntu

I've uploaded new kubuntu-default-settings to stop trying to do clever things and just use the manual first run wizard

Look out for kubuntu-default-settings version 11.10ubuntu4.1~oneiric1~ppa1 if you are wanting to get the fix
Comment 15 Raúl 2012-10-21 20:58:22 UTC
Hello:
I've run into this problem with KGpg 2.7.3 on KDE 4.8.4, but I run Debian. "find /usr/share -name kgpgrc" returns nothing, so I guess this is an old default. I think kgpg should deal with this problem on config file update procedure. Would this be feasible?
Regards,
Comment 16 Martín Cigorraga 2013-10-21 04:16:52 UTC
Hello everyone,
the only way to make KGpg launch again - w/o previously creating the $HOME/.gnupg/gpg.conf file - is by first renaming/removing ~/.kde4/share/config/kgpgrc.

HTH

Running KGpg on Chakra OS:
Qt: 4.8.5
KDE Development Platform: 4.11.2
KGpg: 2.10.0
Comment 17 LinuxRev 2016-01-05 11:58:13 UTC
Dear all,

It's 2016 and I still get the same error message on KGpg's first run. Which consequently doesn't run, but just holds.
Editing /usr/share/mintkde-default-settings/kde4-profile/default/share/config/kgpgrc doesn't help and ~/.kde/share/config/kgpgrc is not even getting created.
Fiddling around manually in ~/.gnupg doesn't return any wished or hoped for results either.
So, I'm stuck with getting PGP running the graphical way under KDE, since Kleopatra also seems to be out of active maintenance too?

BTW, happy newyear!

-- 
Martin Grashoff

Intending to run KGpg on LinuxMint 13
Qt: 4.8.1
KDE Development Platform: 4.8.5 (4.8.5)
KGpg: 2.7.4
Comment 18 Rolf Eike Beer 2016-01-05 14:58:15 UTC
Distros sometimes put their configuration files at different places, so I fear you need do "find /usr /home -name kgpgrc" to find the wrong file. Seems like noone noticed LinuxMint to fix their 3 year old stuff in the last 3 years, so you still get the same bug.
Comment 19 LinuxRev 2016-01-05 20:04:03 UTC
Thanks for your quick response Rolf. Unfortunately I had already located and edited the kgpgrc default file, but that didn't solve the problem. So I just did it the old fashioned way with gpg from the command-line... BTW, Kleopatra still seems to be active. It even works.
Comment 20 Rolf Eike Beer 2016-01-05 20:24:57 UTC
KGpg will not use the "options" file when not explicitely told to. So this is either still hiding somewhere (try kreadconfig --file kgpgrc --group "GPG Settings" --key "gpg_config_path"), or there is something else going on. Try running kgpg from the command line and see if that prints anything helpful. If not, try running:
strace -f -eopen kgpg --nofork > kgpg.log 2>&1

and then attach the logfile.
Comment 21 LinuxRev 2016-01-06 09:48:13 UTC
Created attachment 96484 [details]
KGpg logfile after running strace
Comment 22 LinuxRev 2016-01-06 09:53:19 UTC
I just sent the logfile. This is what I did.

I ran kreadconfig - which correctly told me what I already knew:
@HOME/.gnupg

I started kgpg from the command-line - which returned this message (twice):
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.

Finally, I ran strace - of which I just sent the logfile.

I hope this is useful information for you guys who understand the intricacies of KDE.
Comment 23 Rolf Eike Beer 2016-01-06 10:16:53 UTC
> I ran kreadconfig - which correctly told me what I already knew:
> @HOME/.gnupg

That looks fishy, it should return the name of the configuration _file_, 
not _directory_. Otherwise it can't work. I get this:

$ kreadconfig --file kgpgrc --group "GPG Settings" --key 
"gpg_config_path"
/home/eike/.gnupg/gpg.conf
Comment 24 LinuxRev 2016-01-06 10:28:54 UTC
Aha. Where should I look to fish for a solution?
Comment 25 LinuxRev 2016-01-06 10:32:31 UTC
I mean, the _file_ ~/.gnupg/gpg.conf _is_ there.
Comment 26 Rolf Eike Beer 2016-01-06 11:02:58 UTC
> Aha. Where should I look to fish for a solution?

You need to find the kgpgrc that sets the wrong gpg_config_path. Either 
fix it there or just remove it.
Comment 27 LinuxRev 2016-01-06 13:31:55 UTC
A full search revealed only one file:
/usr/share/mintkde-default-settings/kde4-profile/default/share/config/kgpgrc
- which is the default as installed by LinuxMint.
The appropriate section there read:
    [GPG Settings]
    Groups=
    gpg_config_path=$HOME/.gnupg

Obviously KGpg looks for a file and not just a path. Editing the last line into:
    gpg_config_path=$HOME/.gnupg/gpg.conf
solved the problem. KGpg now starts & works fine. Thanks for help (for which I should not ask here...).

So, if there is a 'bug' it seems to be this faulty default file installed by LinuxMint. I'll see if I can get that message through to them.