Bug 335754

Summary: Passwords for Wlan are not saved
Product: [Plasma] plasma-nm Reporter: kono93 <kochnorman>
Component: appletAssignee: Jan Grulich <jgrulich>
Status: RESOLVED FIXED    
Severity: major CC: cybermonktitan, jgrulich, jke, lukas
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Extract of NetworkManager entries from syslog for tests in comment #4
daemon.log

Description kono93 2014-06-03 15:47:59 UTC
In the latest debian-jessie-build (I cannot see any place to look for a version number of this panel, sadly) for me it seems that passwords are not saved. Whenever I reboot, my password is missing and I need to re-enter it before I can connect

Reproducible: Always

Steps to Reproduce:
1. Enter password and connect 
2. Reboot
3. Does not connect automatically until I re-enter the password in the connection-edit-dialog


Expected Results:  
It should save passwords.

I am using this on a Lenovo ThinkPad T410s.
Comment 1 Johannes Kehrer 2014-06-07 13:22:30 UTC
Hello,
same hier with Kubuntu 14.04.
It seem that in KWallet the password is present. At least I can see the correct password under Networkmanagement->Pair->{xxxxxxx}802.11
Comment 2 Thomas Schaap 2014-07-02 13:32:59 UTC
I can confirm this bug and add a twist to it.

Whether stored or not under Kubuntu 14.04 the wireless refuses to connect. After reboot I'd expect a prompt for opening my wallet (stored password) or to give the password myself (no stored password). Neither appear. The log messages in /var/log/syslog state that nm prepares the device, then starts connecting, detects security for which secrets are required, and then fails since no agents are available to provide secrets.

Taking a hint from http://forums.debian.net/viewtopic.php?f=5&t=114807 I switched the netbook workspace UI (which I used) to desktop mode, rebooted, and this was fixed. A popup for my wallet came up and the wifi connected immediately.
Comment 3 Jan Grulich 2014-07-09 19:17:10 UTC
1) Is the password stored in KWallet? Open KWalletManager → Network Management → Maps and check whether is there your password stored under some UUID.
2) Can you please attach NetworkManager logs?
3) Is the issue reproducible with a new user?
Comment 4 Thomas Schaap 2014-07-12 17:23:07 UTC
I've done some testing lead by Jan's questions. Here follows the account. I've tried to separate it into logical parts for readability. It confirms me quite thoroughly in the suspicion that something is wrong with nm in netbook mode.


I switched KDE workspace back to netbook UI and checked my own wallet. The password is there. I rebooted and logged in again. The plasma NM widget shows the usual network signal in range bars with a yellow question mark. There is no connection, no dialogs, no popups. Verified that the password is still in the wallet.

Created a new user testnm. There is still no network, so no poisoning of the test from that. Logged out and then logged in as testnm. NM widget shows the question mark. Clicking it and then connect next to the right network surprises me with an inline password box. Pressing enter after the password (should have an OK button there) connects the network.

Rebooted and logged in as testnm. NM widget shows question mark again and clicking connect next to the network in it gives no result. syslog confirms the same problem occurred again. Opening kwalletmanager draws a full blank window and opening kwallet configuration confirms that no wallet is configured. Configured a new and default wallet, clicked the edit connection button next to the network, filled in the password, clicked OK. Network connects. KWalletManager shows a still opened wallet with no data in it. Edit connection dialog shows an empty password. Disconnect network and connect again, failed.

Switched UI to desktop mode. Instantly, as in before the whole switch is loaded and without any input, I get a dialog saying "For accessing the wireless network 'X' you need to provide a password below". Gave the password, connection active. Disconnect and connect again via NM widget: connection active. Both KWalletManager and the connection edit dialog now show the password.

Disconnect network. Switched UI to netbook mode. Connect network via NM widget works. Connection edit dialog has password filled in.

Rebooted and logged in as testnm. NM widget shows question mark again. syslog shows same problem again. Connecting network via NM widget fails silently again. Forcibly opened kwalletmanager and opened the wallet. Connecting network via NM widget fails silently. KWalletManager opened again, shows wallet is still open and contains the password.


I've attached the output of   cat syslog|grep NetworkManager  filtering for the time I was testing. In the log the network I've used is redacted to X and all other known networks to Y.
Comment 5 Thomas Schaap 2014-07-12 17:24:12 UTC
Created attachment 87713 [details]
Extract of NetworkManager entries from syslog for tests in comment #4
Comment 6 kono93 2014-07-12 17:39:12 UTC
For some reason that I do not fully understand right now, it doesn't act like that for me as it did in the beginning. Whenever I need to establish a new connection (e.g. after a reboot or after hibernating and so on) the icon in the main-panel shows a question mark and if I wait about 3-5min, it shows me a message like "<network-name> disconnected" three times as a popup-message. After that, a wheel starts turning on that icon and 20 seconds later I am connected to the network. 
This, for my taste, takes too much time and therefore I found a "workaround". 

Running 
sudo /etc/init.d/network-manager restart && sudo /etc/init.d/networking restart
restarts all my network-connections and the network-manager and this saves me the 3-5min of waiting for the network-manager to recognize that it is not connected to my network.

I, as far as I can see, have not changed anything in the configuration, but I did the updates Debian offered me since I started this thread. So probably there was a fix, but I haven't seen it.
Comment 7 Thomas Schaap 2014-07-12 19:32:58 UTC
Hmmm, updates. Intelligent idea.

I ran them and rebooted, but my testnm user has the exact same problems as before. plasma-nm package version is now 0.9.3.3-0ubuntu1. No fix seems to be there.
Comment 8 Jan Grulich 2014-07-14 07:19:32 UTC
@Thomas Schapp: really thanks for the testing. According to your description it looks that the problem is either in KWallet or in our kded module which seems to be not loaded when you log in into netbook UI. Can you please check that? Just go to System settings → Startup and shutdown →  Service Manager and check whether is there "Plasma Networkmanagement module running among Startup Services.

@kono93: Can you please provide NetworkManager's log so I can see what's going on there?
Comment 9 kono93 2014-07-14 19:51:18 UTC
Created attachment 87731 [details]
daemon.log

I could not find a specific network-manager log file on my system, so I searched for anything resembling my network name ("Schopenhauer") and I found this in the /var/log/daemon.log. 

I'm not sure if this is helpful or not. (My ISP, IP and so on are changed to my_<whatever>), but they are correct.
Comment 10 Thomas Schaap 2014-07-15 20:39:58 UTC
Just checked. Logged out gf from desktop environment and logged in my test user into netbook environment. nm hangs on the question mark again, so problem was reproduced. Checked the service you named: current status is running.

Curious as to whether it would be kwallet itself I created a mock webpage on my local server (just asks a username and a password). In desktop mode I opened my wallet, opened the page in rekonq, gave some credentials, submitted and saved them in the wallet. As a verification I closed both rekonq and the wallet, and restarted rekonq and requested the page. kwallet pops up with a password dialog as expected. Closed wallet and rekonq again, switched to netbook mode and repeated the test. kwallet pops up with a fullscreen password dialog and opens correctly.

I don't know whether rekonq and nm use the same API of kwallet, but kwallet /seems/ to be functional under the netbook UI. Especially given how the NM widget behaved before a wallet was even configured (see the first reboot after the test user was created in my previous big test) my hunch is that it's the coupling between the NM widge and kwallet - quite possibly the module you mentioned.
Comment 11 Jan Grulich 2014-07-18 06:26:57 UTC
Git commit 5294e9f0087735abb801b24c8d7bc69a952a5848 by Jan Grulich.
Committed on 18/07/2014 at 06:26.
Pushed by grulich into branch '0.9.3'.

Comment out code delaying initialization of our secret agent until we found a better solution
Related: bug 337554, bug 333905

M  +8    -8    kded/service.cpp

http://commits.kde.org/plasma-nm/5294e9f0087735abb801b24c8d7bc69a952a5848
Comment 12 Thomas Schaap 2014-07-18 16:26:56 UTC
I was curious to see if that patch would solve the problem. I got me the source from ubuntu with apt-get source, which looks like it's the vanilla 0.9.3.3 without patches (they're delivered separately). Building, installing (fixing install path and reinstalling) and rebooting reconfirmed the bug - this time using vanilla 0.9.3.3.

Manually applying the patch from commit 5294e9f0087735abb801b24c8d7bc69a952a5848, rebuilding, reinstalling and rebooting, indeed delivered the desired result: the moment I log in with my test user I am now greeted with a nice full-screen KWallet password dialog.

Not sure just how crude the fix is - I assume the delayed init was there with a reason - but it works, at least.

If you have patches vs 0.9.3.3 you'd like tested this way: let me know.
Comment 13 Jan Grulich 2014-07-21 11:28:44 UTC
Git commit 9edd166c9abfbc7c834fba4fed1c730289580261 by Jan Grulich.
Committed on 21/07/2014 at 11:22.
Pushed by grulich into branch '0.9.3'.

Properly delay initialization of our kded module and drop support for plaintext files

REVIEW:119353
Related: bug 337554, bug 333905

M  +0    -11   editor/connectioneditor.cpp
M  +11   -39   kded/secretagent.cpp
M  +4    -4    kded/secretagent.h
M  +25   -20   kded/service.cpp
M  +5    -3    kded/service.h
M  +3    -1    libs/editor/connectiondetaileditor.cpp
M  +2    -0    libs/handler.h

http://commits.kde.org/plasma-nm/9edd166c9abfbc7c834fba4fed1c730289580261