Bug 441214 - SMTP passwords aren't being saved
Summary: SMTP passwords aren't being saved
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 435643 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-08-20 07:35 UTC by Caleb Cushing
Modified: 2022-11-21 12:55 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.22.0


Attachments
journalctl just for user (350.78 KB, text/x-log)
2021-08-20 22:57 UTC, Caleb Cushing
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Caleb Cushing 2021-08-20 07:35:37 UTC
SUMMARY

I'm getting a log, and my smtp password for google isn't saving, it's super weird.


STEPS TO REPRODUCE

I'm not 100% on this, I feel like there might be another thing I'm missing

1. enable app armor
2. use gmail settings for kmail
3. send email

OBSERVED RESULT

kmail always asks for the smtp password, for some reason this is only happening for smtp, and only gmail, so weird. I'm seeing this log

 AVC apparmor="DENIED" operation="open" profile="/usr/bin/akonadiserver" name="/etc/authselect/nsswitch.conf" pid=31873 comm="0x557056b51380-" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0


EXPECTED RESULT

password should be getting saved, no error

SOFTWARE/OS VERSIONS
apparmor: 3.0.1
Akonadi: 21.0.8
Operating System: Manjaro Linux
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.10.59-1-MANJARO (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-10610U CPU @ 1.80GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics

ADDITIONAL INFORMATION

here's the additional surrounding logs, they might be relevant, not sure

The reason I think it might be a KDE bug, is because it looks like the last "arch" bug like this got resolved in KDE. https://bugs.archlinux.org/task/64890

Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
org.kde.pim.messagecomposer: Impossible to specify TO! It's a bug
snapperd.service: Deactivated successfully.
SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=snapperd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
static bool LibSecretKeyring::findPassword(const QString&, const QString&, QKeychain::JobPrivate*)
static bool LibSecretKeyring::findPassword(const QString&, const QString&, QKeychain::JobPrivate*)
We have an error during reading password "Entry not found"
static bool LibSecretKeyring::findPassword(const QString&, const QString&, QKeychain::JobPrivate*)
We have an error during reading password "Entry not found"
static bool LibSecretKeyring::findPassword(const QString&, const QString&, QKeychain::JobPrivate*)
We have an error during reading password "Entry not found"
We have an error during reading password "Entry not found"
static bool LibSecretKeyring::findPassword(const QString&, const QString&, QKeychain::JobPrivate*)
We have an error during reading password "Entry not found"
static bool LibSecretKeyring::findPassword(const QString&, const QString&, QKeychain::JobPrivate*)
We have an error during reading password "Entry not found"
void SendJob::setFrom(const QString &from) "caleb.cushing@people-meeter.com"
d->m_returnPath "<caleb.cushing@people-meeter.com>"
AVC apparmor="DENIED" operation="open" profile="/usr/bin/akonadiserver" name="/etc/authselect/nsswitch.conf" pid=31873 comm="0x557056b51380-" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
org.kde.pim.akonadiserver.search: Executing search "akonadi_newmailnotifier_agent-SearchSession"
org.kde.pim.akonadiserver.search: Search "akonadi_newmailnotifier_agent-SearchSession" done (without remote search)
app-gnome-org.kde.kwalletmanager5-72003.scope: Consumed 2.949s CPU time.
Comment 1 Caleb Cushing 2021-08-20 21:50:28 UTC
I no longer think this is app armor, at least not the source of my problem. I disabled app armor, rebooted my system and the problem stil exists where it isn't persisting the smtp password. I've tried editing the sending settings, and adding it there with the save box checked. I come back there's no ***, when it asks me on send I make sure the save box is checked. still nothing, still asks me the next time. I could do with a workaround. I'd save the password myself if I knew what it was going to look at. I have looked via kwallet manager and under mailtransports -> passwords it is saved in there, and it's the same password as under imap -> akonadi... and when I paste it into the prompt on send it works.
Comment 2 Caleb Cushing 2021-08-20 22:36:42 UTC
Ok, more weirdness I wiped out the imap and the mailtransports in kwallet manager after closing kontact first. I came back, and imap is still getting fetched without those; and saving the password still doesn't take even though one was added to mailtransports.
Comment 3 Caleb Cushing 2021-08-20 22:57:51 UTC
Created attachment 140886 [details]
journalctl just for user
Comment 4 dev@lalber.org 2022-01-09 19:47:59 UTC
I am facing the same issue. My log shows similarities:

Jan 09 20:38:40 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver.search: Executing search "kmail2-2141933468-SearchSession"
Jan 09 20:38:40 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver.search: Search  "kmail2-2141933468-SearchSession" done (without remote search)
Jan 09 20:38:40 10303B-arch akonadi_maildispatcher_agent[1459]: org.kde.pim.maildispatcher: Item  13665 does not have the required attribute Address.
Jan 09 20:38:40 10303B-arch akonadi_maildispatcher_agent[1459]: org.kde.pim.maildispatcher: Item  13665 does not have the required attribute Address.
Jan 09 20:39:09 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver: QueryBuilder::exec(): database reported transaction deadlock, retrying transaction
Jan 09 20:39:09 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver: "Deadlock found when trying to get lock; try restarting transaction QMYSQL3: Unable to execute statement"
Jan 09 20:39:09 10303B-arch akonadi_maildispatcher_agent[1459]: We have an error during reading password  "Entry not found"
Jan 09 20:39:22 10303B-arch akonadi_sendlater_agent[1504]: We have an error during reading password  "Entry not found"
Jan 09 20:39:22 10303B-arch akonadi_maildispatcher_agent[1459]: We have an error during reading password  "Entry not found"
Jan 09 20:39:22 10303B-arch akonadi_sendlater_agent[1504]: We have an error during reading password  "Entry not found"
Jan 09 20:39:22 10303B-arch akonadi_maildispatcher_agent[1459]: We have an error during reading password  "Entry not found"
Jan 09 20:39:22 10303B-arch akonadi_maildispatcher_agent[1459]: void SendJob::setFrom(const QString &from)  "REMOVED"
Jan 09 20:39:22 10303B-arch akonadi_maildispatcher_agent[1459]: d->m_returnPath   "<REMOVED>"
Jan 09 20:42:10 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver.search: Executing search "akonadi_newmailnotifier_agent-SearchSession"
Jan 09 20:42:10 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver.search: Search  "akonadi_newmailnotifier_agent-SearchSession" done (without remote search)
Jan 09 20:42:17 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver.search: Executing search "kmail2-2141933468-SearchSession"
Jan 09 20:42:17 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver.search: Search  "kmail2-2141933468-SearchSession" done (without remote search)
Jan 09 20:42:17 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver.search: Executing search "kmail2-2141933468-SearchSession"
Jan 09 20:42:17 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver.search: Search  "kmail2-2141933468-SearchSession" done (without remote search)
Jan 09 20:42:18 10303B-arch akonadi_imap_resource[1456]: org.kde.pim.kimap: We asked for UID but the server didn't give it back, resultingFlags not stored.
Jan 09 20:42:19 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver.search: Executing search "kmail2-2141933468-SearchSession"
Jan 09 20:42:19 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver.search: Search  "kmail2-2141933468-SearchSession" done (without remote search)
Jan 09 20:44:29 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver: Subscriber "MessageListTagCacheMonitor - 94084541069568" disconnected
Jan 09 20:44:29 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver: Subscriber "TagActionManagerMonitor - 94084544375872" disconnected
Jan 09 20:44:29 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver: Subscriber "FilterManagerTagMonitor - 94084543736048" disconnected
Jan 09 20:44:29 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver: Subscriber "MessageViewerMonitor - 94084540766272" disconnected
Jan 09 20:44:29 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver: Subscriber "KMail Kernel ETM - 94084539790944" disconnected
Jan 09 20:44:29 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver: Subscriber "MessageListTagMonitor - 94084540990960" disconnected
Jan 09 20:44:29 10303B-arch akonadiserver[996]: org.kde.pim.akonadiserver: Subscriber "SpecialCollectionsMonitor - 94084540318928" disconnected
Comment 5 Metko 2022-01-12 08:42:12 UTC
Confirming this for kmail2 5.19.1 (21.12.1) under openSUSE 15.3. Also tried removing passwords from kwallet and the SMTP configuration, to no avail. Starting kmail in the command line and sending the first email shows two suspicious messages at the end (see below). Unfortunately, they are quite uninformative. Also it's weird that the SMTP password is requested only upon sending the first email after login; all subsequent emails are sent without asking again for the password - until the next login.

[6025:6067:0112/091631.565475:ERROR:file_path_watcher_linux.cc(315)] inotify_init() failed: Zu viele offene Dateien (24)
[6025:6025:0112/091631.568940:ERROR:proxy_config_service_linux.cc(607)] inotify_init failed: Zu viele offene Dateien (24)
Cannot initialize model with data QJsonObject(). missing: QJsonValue(string, "urls")
[6025:6025:0112/091631.940652:ERROR:proxy_config_service_linux.cc(607)] inotify_init failed: Zu viele offene Dateien (24)
[6078:6092:0112/091632.005283:ERROR:file_path_watcher_linux.cc(315)] inotify_init() failed: Zu viele offene Dateien (24)
We have an error during reading password  "Entry not found"
We have an error during reading password  "Entry not found"
 list count   1
[6025:6025:0112/092357.859324:ERROR:proxy_config_service_linux.cc(607)] inotify_init failed: Zu viele offene Dateien (24)
Cannot initialize model with data QJsonObject(). missing: QJsonValue(string, "urls")
org.kde.pim.liblanguagetoolplugin:  Error reply -  "Verbindung verweigert"
org.kde.pim.liblanguagetoolplugin: Error during loading languages from server :  "Verbindung verweigert"
org.kde.pim.akonadicore: Received response with a different tag!
We have an error during reading password  "Entry not found"
We have an error during reading password  "Entry not found"
Comment 6 auxsvr 2022-07-13 05:31:20 UTC
*** This bug has been confirmed by popular vote. ***
Comment 7 Manny 2022-09-21 15:56:29 UTC
(In reply to Metko from comment #5)
> Confirming this for kmail2 5.19.1 (21.12.1) under openSUSE 15.3. Also tried
> removing passwords from kwallet and the SMTP configuration, to no avail.
> Starting kmail in the command line and sending the first email shows two
> suspicious messages at the end (see below). Unfortunately, they are quite
> uninformative. Also it's weird that the SMTP password is requested only upon
> sending the first email after login; all subsequent emails are sent without
> asking again for the password - until the next login.

I have what appears to be the same problem with kmail2 5.19.3 (21.12.3) on xubuntu, latest LTS, just upgraded.
Akonadi stores the password in kwallet (I can see it in the kwallet manager) 
but the akonadi log shows the "entry not found" warning, i.e. it stores, but cannot retrieve. I get asked for
the smtp password every time. There is no problem with receiving, imap passwords are retrieved without a problem. I love kmail despite
its faults, entering smtp passwords every time makes it unusable except for reading mail.
Comment 8 Manny 2022-09-24 17:39:22 UTC
Follow up to comment 7: I tried setting up an account on with a fresh user with kmail started for the first time. The same problem with smtp
passwords exists. Did anyone find a workaround? All my accounts require smtp passwords.
Comment 9 Sandro Knauß 2022-09-26 12:46:17 UTC
KMailTransport (the library that is actually storing the password) is using KWallet directly to store passwords, but using QKeyChain to read the passwords. For a clean KDE environment QKeychain will use KWallet, but for other environments it is using an different backend. That's why only people are affected that are not running a Plasma desktop. You can treat QtKeyChain by environemt variables as workaround:  KDE_SESSION_VERSION=5 and XDG_CURRENT_DESKTOP=kde 
or look at the decision path:  https://github.com/frankosterfeld/qtkeychain/blob/master/keychain_unix.cpp#L100
Comment 10 Sandro Knauß 2022-09-26 12:48:09 UTC
*** Bug 435643 has been marked as a duplicate of this bug. ***
Comment 11 Manny 2022-09-26 16:30:23 UTC
(In reply to Sandro Knauß from comment #9)
> You can treat QtKeyChain
> by environemt variables as workaround:  KDE_SESSION_VERSION=5 and
> XDG_CURRENT_DESKTOP=kde 
> or look at the decision path: 
> https://github.com/frankosterfeld/qtkeychain/blob/master/keychain_unix.
> cpp#L100

I tried setting and exporting the indicated variables in a terminal, then run kmail in the terminal. That didn't seem to solve the problem. Suggestions?
Comment 12 dev@lalber.org 2022-09-26 22:09:47 UTC
(In reply to Manny from comment #11)
> (In reply to Sandro Knauß from comment #9)
> > You can treat QtKeyChain
> > by environemt variables as workaround:  KDE_SESSION_VERSION=5 and
> > XDG_CURRENT_DESKTOP=kde 
> > or look at the decision path: 
> > https://github.com/frankosterfeld/qtkeychain/blob/master/keychain_unix.
> > cpp#L100
> 
> I tried setting and exporting the indicated variables in a terminal, then
> run kmail in the terminal. That didn't seem to solve the problem.
> Suggestions?

You need to run Akonadi with these environment variables set, not kmail.
Comment 13 Manny 2022-10-03 03:08:54 UTC
(In reply to dev@lalber.org from comment #12)
> (In reply to Manny from comment #11)
> > (In reply to Sandro Knauß from comment #9)
> > > You can treat QtKeyChain
> > > by environemt variables as workaround:  KDE_SESSION_VERSION=5 and
> > > XDG_CURRENT_DESKTOP=kde 
> > > or look at the decision path: 
> > > https://github.com/frankosterfeld/qtkeychain/blob/master/keychain_unix.
> > > cpp#L100
> > 
> > I tried setting and exporting the indicated variables in a terminal, then
> > run kmail in the terminal. That didn't seem to solve the problem.
> > Suggestions?
> 
> You need to run Akonadi with these environment variables set, not kmail.

Thanks for the info, I should have realized that. And I tried plasma-desktop, which indeed does not have the problem.
Comment 14 Sandro Knauß 2022-10-12 16:59:07 UTC
Git commit 5f8b5e87ffc1f77f0855f1169d047e98a3e2ea8a by Sandro Knauß.
Committed on 12/10/2022 at 16:36.
Pushed by knauss into branch 'dev/hefee/kwallet_to_qtkeychain'.

Store password wie QKeychain
FIXED-IN: 5.22.0

M  +33   -23   src/kmailtransport/transport.cpp

https://invent.kde.org/pim/kmailtransport/commit/5f8b5e87ffc1f77f0855f1169d047e98a3e2ea8a
Comment 15 Sandro Knauß 2022-10-12 17:08:13 UTC
Git commit cf7fd6cec6e91e222416519aa0fd5162dacbea0d by Sandro Knauß.
Committed on 12/10/2022 at 17:05.
Pushed by knauss into branch 'dev/hefee/kwallet_to_qtkeychain'.

Store password via QtKeychain

The reading of password is alaready done via QtKeychain, that actually
broke the support for passwords for all platforms != Plasma.
At QtKeychain selects other backends for other platforms.
FIXED-IN: 5.22.0

M  +33   -23   src/kmailtransport/transport.cpp

https://invent.kde.org/pim/kmailtransport/commit/cf7fd6cec6e91e222416519aa0fd5162dacbea0d
Comment 16 Sandro Knauß 2022-10-21 16:40:49 UTC
Git commit 1566391b326ceadfa4dfde774d892087d7b65e4b by Sandro Knauß.
Committed on 21/10/2022 at 16:36.
Pushed by knauss into branch 'master'.

Store password via QtKeychain

The reading of password is alaready done via QtKeychain, that actually
broke the support for passwords for all platforms != Plasma.
At QtKeychain selects other backends for other platforms.
FIXED-IN: 5.22.0

M  +23   -13   src/kmailtransport/transport.cpp

https://invent.kde.org/pim/kmailtransport/commit/1566391b326ceadfa4dfde774d892087d7b65e4b
Comment 17 justina 2022-11-21 03:15:08 UTC
The bug is not fixed. Somebody has a kid sister and KMail requires an account password to send each and every email message.


Last metadata expiration check: 2:00:35 ago on Sun 20 Nov 2022 04:11:01 PM AKST.
Installed Packages
Name         : kf5-kmailtransport
Version      : 22.08.1
Release      : 1.fc36
Architecture : x86_64
Size         : 1.0 M
Source       : kf5-kmailtransport-22.08.1-1.fc36.src.rpm
Repository   : @System
From repo    : updates
Summary      : The KMailTransport Library
URL          : https://invent.kde.org/frameworks/kmailtransport
License      : LGPLv2+
Description  : The KMailTransport Library.
Comment 18 Sandro Knauß 2022-11-21 12:55:54 UTC
(In reply to justina from comment #17)
> Name         : kf5-kmailtransport
> Version      : 22.08.1

The fix will be shipped in the next Gear release 22.12.0.