Bug 343518 - Plasma doesn't restore everything after a reboot
Summary: Plasma doesn't restore everything after a reboot
Status: RESOLVED DUPLICATE of bug 354724
Alias: None
Product: ksmserver
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: Lubos Lunak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-29 12:44 UTC by Alexander Nestorov
Modified: 2016-07-18 13:12 UTC (History)
35 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
attachment-29857-0.html (3.07 KB, text/html)
2016-05-20 12:18 UTC, Troy Volin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nestorov 2015-01-29 12:44:06 UTC
I have noticed that Plasma won't restore some apps/tabs after a reboot/shutdown. 

In KDE4 I was used to leave a few instances of Dolphin, Kate, Konsole, etc... (with multiple tabs) and KDE4 would just restore everything (even the paths in Konsole!).

This is not the case with Plasma, thus, the entire concept of "Restore my previous session" is pretty much broken.

Reproducible: Always
Comment 1 David Edmundson 2015-01-29 12:45:51 UTC
"Some apps/tabs"
This is way too vague to be useful.

What apps, what tabs?
Comment 2 Alexander Nestorov 2015-01-29 12:59:25 UTC
I wrote it the next line! Konsole, Dolphin, Kate. Probably more, but I'm guessing all those share the same bug.
Comment 3 David Edmundson 2015-01-29 13:21:21 UTC
Let me retry.

Is nothing restoring, or are some things restoring?
Comment 4 Alexander Nestorov 2015-01-29 13:24:26 UTC
It seems pretty random.

Konsole for example is restoring only 1 tab (without restoring the last path in that tab!), even if I had multiple tabs before restarting.

Dolphin isn't restoring all the instances I had before restoring, but the ones that get restored are restored maintaining the last path.

Kate isn't restoring anything at all.
Comment 5 David Edmundson 2015-01-29 13:32:58 UTC
The fact that it's restoring konsole means the plasma parts must be fine.
Comment 6 Alexander Nestorov 2015-01-29 13:36:47 UTC
I don't know where exactly to put this bug because it's kind of random, please retag it to the category you think it best fits.
Comment 7 Erik 2015-01-30 21:39:36 UTC
I can confirm this bug regarding Konsole:

* Konsole does not restore the last pwd.
* Konsole always restores only one tab / window.
* Konsole does not restore the last window position.
* Sometimes Konsole is not restored at all.
Comment 8 Bhushan Shah 2015-01-31 05:27:55 UTC

*** This bug has been marked as a duplicate of bug 340350 ***
Comment 9 Alexander Nestorov 2015-01-31 13:50:01 UTC
I don't think it's exactly the same bug. While the bug you link to is for plasma restoring instances even if they are already open, mine is about plasma not restoring anything or restoring partially the apps I have open.
Comment 10 Bhushan Shah 2015-01-31 14:04:51 UTC
Umm sorry... I overread that.. reopening
Comment 11 Alexander Nestorov 2015-02-02 02:17:44 UTC
Can I get this bug in a "Confirmed" state?
Comment 12 Christoph Feck 2015-02-15 15:09:30 UTC
Alexander, we do not use the CONFIRMED state in this bug tracker consequently. This is because if a developer has actually confirmed where the bug is, a fix is usually made without an intermediate state change.

In other words, stop paying attention to it.
Comment 13 Alexander Nestorov 2015-02-15 15:43:25 UTC
Oh, sorry, I thought it actually meant the bug is confirmed as valid. Won't do it again :)
Comment 14 reescf 2015-02-15 21:53:32 UTC
Konsole does always restore for me in the minimal sense that it always reopens. But it never restores more than one tab and it never restores the working directory. If I've named a tab, it doesn't restore that either.

Okular also restores in a minimal sense. It restores a single window. It does not restore multiple tabs or windows. It may or may not restore the last viewed document - sometimes it just restores a (seemingly random) document which was open on logout.

Tabs in Kile are restored properly (because this is using KDE 4 stuff still?).
Comment 15 Reuben 2015-08-18 12:19:56 UTC
*** This bug has been confirmed by popular vote. ***
Comment 16 Jeremy Whiting 2015-08-28 20:04:04 UTC
I'm experiencing the same thing here. One application I know that never gets restored here is Chromium. I always have a chromium instance running when I reboot, it never comes up after login.
Comment 17 Stephan 2015-09-06 20:18:59 UTC
Also have this problem with Kubuntu 15.04 and Plasma 5.3 from the Kubuntu Backports PPA. Konsole is always open when shutting down, but after a restart, it sometimes starts and sometimes not.
Comment 18 Stephan 2015-09-07 14:37:14 UTC
I just noticed, that when I change the display output from my laptop to an external monitor via a xrandr command, konsole sometimes doesn't survive as well. So, maybe it's just a bug in Konsole that cannot handle a resolution change or change of location on the desktop?
Comment 19 Alex Den 2015-09-07 15:43:47 UTC
In System Parameters -> Autostart I've added lounching of rsibreak, chromium, goldendict because they are not restarted automatically after reboot and session restoration. Chromium & goldendict are lounched, but rsibresk - is not! Konsole, Dolpin are not restarted automatically too, but Gkrellm and Skype - without any problems and always! 
KDE Plasma 5.4, Qt 5.5. Arch linux 4.1.6-1 64 bit
Comment 20 pauloedgarcastro 2015-09-10 11:40:38 UTC
I can also confirm this issue.

Created a clean user, logged in and opened a couple of applications ...

Firefox, Dolphin, Konsole with a couple of tabs...

Logged out and upon next login the Konsole window hadn't been restored but all the others had.

KDE Plasma Version: 5.3.2
QT Version: 5.5
Currently running Fedora 22.
Comment 21 Cruceru Calin-Cristian 2015-09-16 10:05:14 UTC
I confirm this too.  I first noticed this when konsole was being restored but with the wrong tabs/paths.  Then I noticed that dolphin doesn't get restored at all.

KDE Plasma 5.4, Qt 5.5, Arch linux 4.1.6-1 64 bit.
Comment 22 Paul 2015-09-16 13:09:46 UTC
I previously thought this was due to crashes during logout that were supposed to be fixed in Plasma 5.4, but no luck here either.  For me it doesn't appear application specific.  okular successfully saves the state of all windows in ~/.config/session/, but only a random subset of them make it into ~/.config/ksmserverrc.  Any theories?

KDE Plasma 5.4, Qt 5.5, Arch linux 4.1.6-1 64 bit.
Comment 23 Jeremy Whiting 2015-09-16 13:30:28 UTC
It seems part of the cause for session management not working in plasma 5 are some Qt bugs. https://codereview.qt-project.org/#/c/113901/ should fix one problem but hasn't been included yet. There may be other causes also. Will see what we can figure out.
Comment 24 Chris 2015-09-25 12:12:19 UTC
I also confirm this issue.
My configuration is Debian testing, upgraded sept 23rd.

With a user I could freely experiment with;
rm ~/.config/session/*;
Opening some applications: konqueror, okular, iceweasel, system-settings, konversation, konsole;
logout;
login;
I can see in ~/.config/session/ that there are different files:
kwinXXX which contains ref. to okular, konqueror and iceweasel (this list might not be so accurate);
konsoleXXX;
konversationXXX;

Windows which are restored, though the positioning might be wrong, are:
iceweasel, konqueror, konversation, system-settings;

Windows which are never restored are:
konsole,
okular.
Comment 25 Chris 2015-09-28 14:53:56 UTC
It seems it's fixed for me now.
Comment 26 Joshua 2015-10-30 14:04:06 UTC
Fedora 23 and this bug is still not fixed. Konsole is not restored after login about 85% of the time. I'm sick of trying to figure out why it does restore 15% of the time.  KDE Plasma 5.4.2
Comment 27 Peter Lemken 2015-11-02 12:08:58 UTC
I can confirm that this is still in unchanged state on Fedora 22 with an up to date system.

Kaonsole is particularl annoying because I usually have 8 tabs open in various directories für various tasks. It completely breaks my workflow to restore Konsole each and every time I start a session.
Comment 28 Peter Lemken 2015-11-10 09:52:47 UTC
After an upgrade to Fedora 23 this problems seems to have been resolved. Konsole restores at the same window position with all tabs in their previous work directory. I am curious about the fix; was it a packaging bug in Fedora?
Comment 29 chenghaomanzhouli 2015-11-10 16:47:15 UTC
That RSIBreak won't start automatically is the worst thing. For many times I would only find RSIBreak is actually not running after my eyes hurt...
Comment 30 pauloedgarcastro 2015-11-27 17:34:09 UTC
Hi seem to have a weird condition. 
Upgraded to F23.
My main user seems to be able to restore some of apps that were running before logoff. Konsole isn't one of them :(

Tried login in with a new user whose $HOME was empty and started a couple of apps, kde settings konsole. Made sure that the "Restore previous session" was enabled.
Logoff and Login again and I got the empty workspace. :(

This is really BAD ... you keep losing the previous state at each session start ...
Comment 31 Paolo Carlini 2015-11-30 17:16:01 UTC
Confirmed on a fully patched openSUSE Leap 42.1
Comment 32 michael 2015-12-05 09:54:58 UTC
Same for me, nothing is restored on openSUSE 42.1
Comment 33 John Stanley 2015-12-07 19:50:32 UTC
I posted a possible fix for this at https://bugs.kde.org/show_bug.cgi?id=346768#c41, but apparently nobody appears to care (or have time to look at). The following three patches fix the issue for me (been using them for about 1.5 months without problems). The patches are:

 (1) https://bugs.kde.org/attachment.cgi?id=95380
 (2) https://bugs.kde.org/attachment.cgi?id=95381
 (3) https://codereview.qt-project.org/#/c/140115/
Comment 34 Paolo Carlini 2015-12-08 08:59:28 UTC
Thanks John. IMHO this is an high priority regression and a working patch should be reviewed as soon as possible.
Comment 35 Paul Eggleton 2015-12-11 04:27:20 UTC
I hate to pile on here, but I've now hit this on the upgrade to Fedora 23 (from 21 where I was using KDE 4). This is pretty important functionality to me, something I have come to rely on always working since KDE 3, hence I tend to have a lot of items open that are preserved over reboots. 

This is frustrating enough that I'd (seriously) be willing to pay money to see this fixed.
Comment 36 Naughty Girl 2015-12-13 04:52:03 UTC
FYI, I also hit this bug on upgrade to Fedora 23 -- and after trying F23 Gnome, Cinnamon, etc, decided to switch to openSUSE (LEAP 4.21 + updates), with KDE, but konsole still fails to restore across sessions. :-(

I tried installing gnome-terminal, but that also fails to save-and-restore. However, I then installed
xfce4-terminal which *does* save-and-restore perfectly well, afaict, -- even though I'm running it on a KDE desktop.
Comment 37 Paolo Carlini 2015-12-13 08:37:30 UTC
Thanks Naughty Girl, that works for me too!

Well, trivial but can explain why this serious bug didn't get much more attention, hybernating instead of rebooting also "works" of course.
Comment 38 kdebugs.anon134 2016-01-01 15:52:24 UTC
I am having also having the problem where if I use "restore last session", then most programs aren't restored at all when logging back in.

I rely HEAVILY on the "restore last session" function, so this is a VERY significant problem for me, so much that it is preventing me from permanently moving to Plasma 5.  This is very disappointing.  :(

My System:
openSUSE Leap 42.1 for x86_64
plasma5-workspace v5.5.2-158.1
KDE Platform Version 4.14.10

Reproducible: Always
Comment 39 Fahad Alduraibi 2016-01-08 15:48:32 UTC
Same problem here, but nothing is restored, KDE always starts up with clean desktop :(
Tested on a new account, switched settings back and forth to no avail.

Same problem on two different machines

Fedora 23, KDE 5.18 (latest everything)
Comment 40 Wolfgang Bauer 2016-02-22 10:44:20 UTC
Should be fixed with Qt 5.6 and Frameworks 5.20.

*** This bug has been marked as a duplicate of bug 354724 ***
Comment 41 Alexander Nestorov 2016-02-22 10:47:04 UTC
I'm not sure why THIS bug got marked as duplicate of #354724. This one is older.
Also, can we wait for Qt 5.6 and FW 5.20 to be released and tested before marking as fixed? I don't even know how many times bugs have been marked as "fixed" and then it turned out they are not quite fixed.
Comment 42 Wolfgang Bauer 2016-02-22 12:23:55 UTC
(In reply to Alexander Nestorov from comment #41)
> I'm not sure why THIS bug got marked as duplicate of #354724. This one is
> older.

So?
The other one has the relevant discussion, and it has a proper fix (that has been submitted already) too.

> Also, can we wait for Qt 5.6 and FW 5.20 to be released and tested before
> marking as fixed? I don't even know how many times bugs have been marked as
> "fixed" and then it turned out they are not quite fixed.

Why?
It is common practice to close a bug report once a fix is submitted, not when it is released.
Also, we can always reopen it if it turns out that the fix doesn't work or is not sufficient.

Personally I did test the commits though, and they work great here.
Comment 43 Storm Engineer 2016-03-28 16:40:19 UTC
Just upgraded to 5.6.0, it is NOT fixed, but quite to the contrary, session restore is now even more broken than before.

Until now Firefox and Cairo-Dock were restored, but not anymore.

Arch Linux 64 bit
qt5 5.6.0
plasma 5.6.0
plasma-framework 5.20.0
Comment 44 Alex Den 2016-03-30 17:06:51 UTC
Confirmed! After upgrade to 5.6.0 dolphin and consoles are restored as well as with tabs but... Firefox stopped to be restored.... Upgrade to 5.6.1 has changed nothing.
Comment 45 Wolfgang Bauer 2016-03-30 19:44:24 UTC
But Firefox and cairo-dock are not KF5 applications, this bug report was originally about KF5 applications not being restored as I understand it.
There was a general problem in Qt5/KF5 (the applications were closed too soon on logout and not seen as running by the session management any more when the session was actually closed), and that is fixed (see bug#354724).
This was no problem with session management in Plasma5 (ksmserver) itself.

Firefox and cairo-dock (not being KF5 applications) are not even affected by the fixes to Qt5/KF5 of course.
I have heard of other users having problems with Firefox in this regard since upgrading Plasma to 5.6 (or the beta).
But Firefox is still being restored fine here on my openSUSE system with Qt 5.6.0, Plasma 5.6.1 and KDE Frameworks 5.20.0. (I don't have cairo-dock installed).

No idea if that problem might be caused by a bug in ksmserver 5.6, or in those applications or in GTK or whatever that just coincides with the Plasma update (the applications might crash on logout or when being restored at login e.g.).
In the case of Firefox it might even be caused by some addon, so maybe try to disable all as a test.

In any case, I'd suggest to better open a new bug report, IMHO this is not related to the problem originally reported here as explained.
Comment 46 Paolo Carlini 2016-03-30 19:56:31 UTC
I can confirm that on the (stock, fully patched) openSUSE Leap machine I'm using right now both Firefox and, eg, Konsole, are correctly restored. In fact, I'm pretty happy with the recent progress in this area: thanks a lot to the people involved!
Comment 47 Piotr Mierzwinski 2016-04-29 23:25:24 UTC
Antergos system with Qt 5.6.0, Plasma 5.6.3 and KDE Frameworks 5.21.0 with the newest updates on today (writing this message).

None of the tested by me applications are not restored after relogin/restart. I tested: Firefox, Thunderbird and new Opera. I think all of them are based on GTK2. All tested by me KF applications (konsole, kwrite, dolphin) are restored correctly (including virtual desktop number).

In Plasma 5.5.4 (ksmserver probably has the same version) Firefox and Thunderbird were restored correctly. The problem only was with new Opera. I tested it on Kubuntu 15.10. In version 5.6, the most likely, it has been broken. So I don't think so that this is GTK problem. I think this is again some regression. Second argument it might be ksmserver but is following. I made some test relying on hardcoding in ksmserver configuration file properly lines that forced running thunderbird. Result. After login thunderbird has been run. Unfortunately after relogin thunderbird not run, because during closing the session my entry has been removed from ksmserver configuration file.
Looking at this situation I wonder are there any regression tests made (by ksmserver developers) for this case :/. Or maybe here are guilty persons preparing Plasma packages in Arch/Antergos (this distribution based on Arch repository). I don't know.

@Wolfgang Bauer
Looking what you are saying: 'I have heard of other users having problems with Firefox in this regard since upgrading Plasma to 5.6 (or the beta).". I also other persons also saying about problems, so maybe this is plasma 5.6.x (ksmserver) bug.
And if for you and for Paolo Carlini it is working then to who should to report the bug?

I can add that the environment itself is pretty stable. I'm using it couple of weeks and I didn't observe any crash.
Comment 48 Wolfgang Bauer 2016-05-17 11:34:24 UTC
(In reply to Piotr Mierzwinski from comment #47)
> None of the tested by me applications are not restored after
> relogin/restart.

Where's the problem then?
I suppose there is a typo in there... ;-)

> I tested: Firefox, Thunderbird and new Opera. I think all
> of them are based on GTK2. 

Actually not.
At least Firefox can be build against GTK3 since a while and I think at least some distributions do that (openSUSE not, yet).
So this might just be your point of regression...

No idea about the others though.

> All tested by me KF applications (konsole,
> kwrite, dolphin) are restored correctly (including virtual desktop number).

This proves IMHO that your problem is unrelated to *this* bug report, or the other one I marked this as duplicate of, which is about a problem in Qt5 as explained.

> In Plasma 5.5.4 (ksmserver probably has the same version) Firefox and
> Thunderbird were restored correctly.

There has been no change to ksmserver (except see above), so another prove that this is not the same bug.

> Looking what you are saying: 'I have heard of other users having problems
> with Firefox in this regard since upgrading Plasma to 5.6 (or the beta).". I
> also other persons also saying about problems, so maybe this is plasma 5.6.x
> (ksmserver) bug.

As mentioned, ksmserver hasn't been changed between 5.5 and 5.6.
Except for this:
https://quickgit.kde.org/?p=plasma-workspace.git&a=commit&h=5f0ca1305db4a925dbdbf927f541497be334feff

According to the commit message it shouldn't be a problem though...

If you are able to build plasma/ksmserver from source, I would recommend to do so with this patch reverted and see if it works then.

> And if for you and for Paolo Carlini it is working then to who should to
> report the bug?

Good question, I don't know really.
Maybe GTK3, or the applications affected.

Or, as it might be a ksmserver bug after all (I never ruled that out), file a *new* bug report here.

> I can add that the environment itself is pretty stable. I'm using it couple
> of weeks and I didn't observe any crash.

I never tried to imply in my previous comment that the environment is unstable.

But your applications (or the toolkit they use) might be.
Though not necessarily unstable per se, only just behaving incorrectly in regards to session management.
Comment 49 Wolfgang Bauer 2016-05-17 11:38:00 UTC
(In reply to Wolfgang Bauer from comment #48)
> > In Plasma 5.5.4 (ksmserver probably has the same version) Firefox and
> > Thunderbird were restored correctly.
> 
> There has been no change to ksmserver (except see above), so another prove
> that this is not the same bug.

Sorry, actually this should read "(except see below)".
I wanted to refer to my statement in the following paragraph about the only change in ksmserver.
Comment 50 Piotr Mierzwinski 2016-05-17 21:47:55 UTC
(In reply to Wolfgang Bauer from comment #48)
> (In reply to Piotr Mierzwinski from comment #47)
> > None of the tested by me applications are not restored after
> > relogin/restart.
> 
> Where's the problem then?
Problem is that applications mentioned in next sentence are not restored after relogin. 

> I suppose there is a typo in there... ;-)
Sorry for typo. English grammar is not my strength, se better would be when "are" has been replaced with "were" or usage: "there are not restored".

> > I tested: Firefox, Thunderbird and new Opera. I think all
> > of them are based on GTK2. 
> 
> Actually not.
> At least Firefox can be build against GTK3 since a while and I think at
> least some distributions do that (openSUSE not, yet).
OK. About Firefox you are right. I retested it again and I can say that in Antergos Firefox is built using GTK3.

> So this might just be your point of regression...
The regression is that none of GTK2 and GTK3 applications there are not restored. This is regression comparing to previous Plasma, because In ver. 5.5.x it was working. I tested  Kubuntu 16.04. BTW in Plasma 5 provided by this distribution applications based on KF are not restored. I'm not going to evolve this topic. Anyway they plan update to Plasma 5.6.x.

> No idea about the others though.
But I'm sure that the last two were built using GTK2. My test was following. I changed "Style of GNOME application" in "System Settings" and just restarted all tested applications.
 
> > All tested by me KF applications (konsole,
> > kwrite, dolphin) are restored correctly (including virtual desktop number).
> 
> This proves IMHO that your problem is unrelated to *this* bug report, or the
> other one I marked this as duplicate of, which is about a problem in Qt5 as
> explained.
Subject is "Plasma doesn't restore everything after a reboot". So maybe is too general. Author reported this bug wrote about problem with Konsole, Dolphin, Kate and restoring them including their opened tabs. After several posts someone started typing about most general problems with restoring other applications. Never mind.
So maybe my problem is only partially related to reported problem.

> > In Plasma 5.5.4 (ksmserver probably has the same version) Firefox and
> > Thunderbird were restored correctly.
> 
> There has been no change to ksmserver (except see above), so another prove
> that this is not the same bug.
So where is placed the bug? In Plasma 5.5.4 GTK applications are restored correctly and in 5.6.4 don't.
From my perspective it looks like some informations necessary to restore GTK based applications are not saved into ksmserverrc. Even after hardcoded them in this file, they exist only till first relogin/restart. After that they disappear. How it might be explained?

> > Looking what you are saying: 'I have heard of other users having problems
> > with Firefox in this regard since upgrading Plasma to 5.6 (or the beta).". I
> > also other persons also saying about problems, so maybe this is plasma 5.6.x
> > (ksmserver) bug.
> 
> As mentioned, ksmserver hasn't been changed between 5.5 and 5.6.
> Except for this:
> https://quickgit.kde.org/?p=plasma-workspace.
> git&a=commit&h=5f0ca1305db4a925dbdbf927f541497be334feff
So I'm asking again. What happened? Developers of couple distributions made some mistake?
In the past I tested also KaOS with Plasma 5.4.x and later after update to Plasma 5.6.x. Testing the newest KaOS I observe the same issue like in Antergos. KaOS doesn't base on Arch packages instead of Antergos.
I wonder what will bring Plasma 5.6.4 (currently tested) in Kubuntu 16.04. I mean of course issue of restoring GTK and KF5 applications.

> According to the commit message it shouldn't be a problem though...
For me it is hard to say if XSM technology could affect on restoring GTK applications. I don't know what testes made author this fix after applying it in code.
I mean simple test: whether GTK and KF applications are restored or not.
I and others can say only that it stopped work.

> If you are able to build plasma/ksmserver from source, I would recommend to
> do so with this patch reverted and see if it works then.
This is the easiest way to prove/not prove that author of this patch didn't retest your fix properly.
Yes. I'm able to build plasma-workspace package, what contains ksmserver. Maybe I will make such test in the future.

> > And if for you and for Paolo Carlini it is working then to who should to
> > report the bug?
> 
> Good question, I don't know really.
> Maybe GTK3, or the applications affected.
As I mentioned issue is related to GTK2 (new Opera, thunderbird) and GTK3 (Firefox).

> Or, as it might be a ksmserver bug after all (I never ruled that out), file
> a *new* bug report here.
Some time ago (May 4th) I just reported it here in bug: 362671 (no answer).
I reported it also in Antergos forum (with no answer). I'm going to report it also in KaOS forum.
Comment 51 Wolfgang Bauer 2016-05-18 11:19:09 UTC
(In reply to Piotr Mierzwinski from comment #50)
> > So this might just be your point of regression...
> The regression is that none of GTK2 and GTK3 applications there are not
> restored. This is regression comparing to previous Plasma, because In ver.
> 5.5.x it was working.

Yes, but this bug report was filed over a year before Plasma 5.6.0 was even released.
So by definition this cannot be the same problem if you say it worked with 5.5.x and earlier.

>> No idea about the others though.
> But I'm sure that the last two were built using GTK2. My test was following. I changed "Style of > GNOME application" in "System Settings" and just restarted all tested applications. 

Ok, as I wrote I have no idea.
It would have been a possible explanation for why Firefox is restored reliably here (where it is using GTK2), but not for you (using GTK3).

> I tested  Kubuntu 16.04. BTW in Plasma 5 provided by
> this distribution applications based on KF are not restored. I'm not going
> to evolve this topic. Anyway they plan update to Plasma 5.6.x.

Yes, that's what this bug report originally was about, and why I marked it as duplicate of bug#354724 (which was about the same issue).
It was a problem in Qt5, and should be fixed in Plasma 5.6 when built against Qt 5.6.

> Subject is "Plasma doesn't restore everything after a reboot". So maybe is
> too general.

Yes, but still it's not a good idea to mix several unrelated problems into one bug report, even if the symptoms are similar, IMHO.

> So where is placed the bug? In Plasma 5.5.4 GTK applications are restored
> correctly and in 5.6.4 don't.

I don't know.
Please note that I am not the maintainer of ksmserver, I just closed this as duplicate of the other bug report which was about the same issue, the problem in Qt5 and KF5 applications (it wasn't even related to ksmserver actually).

But as I already mentioned, there was exactly one change in ksmserver between 5.5.5 and 5.6 (unless I overlooked something).
So if you notice a regression, this is the only possible cause in ksmserver for it, I'd say. If it isn't, the problem must lie somewhere else, and likely not even in KDE as those are GTK applications.

Although XSM is outdated and shouldn't be used any more, at least according to the commit message.

> From my perspective it looks like some informations necessary to restore GTK
> based applications are not saved into ksmserverrc.

ksmserver does not differentiate between KDE and GTK applications, obviously.
It implements a protocol, and the applications (or the toolkit they use) have to implement that protocol correctly as well.

The problem with Qt5 applications was caused by the fact that Qt5 closed the applications too soon on logout (when told to save the state), so they were not running any more when ksmserver actually recorded the running applications into ksmserverrc. Another possible problem in this regard might be that the application is crashing when told to save its state, this again would result in it not running any more when ksmserver records the running applications during logout.

> Even after hardcoded them
> in this file, they exist only till first relogin/restart. After that they
> disappear. How it might be explained?

If an app is restarted, the corresponding entry is removed from ksmserverrc I think.

If the app doesn't start even though it was listed in ksmserverrc, the entry might have been wrong, or the app might crash on start or fail to start because of some other reason.

> So I'm asking again. What happened? Developers of couple distributions made
> some mistake?

How should I know?
It is even working correctly here AFAICT. (I don't have Thunderbird or Opera installed)

It is a fact that this is the only change in ksmserver between 5.5.5 and 5.6 though.

> > Or, as it might be a ksmserver bug after all (I never ruled that out), file
> > a *new* bug report here.
> Some time ago (May 4th) I just reported it here in bug: 362671 (no answer).

Ok.
But then I see even less reason to reopen this bug report, or even having this discussion here...
Comment 52 Wolfgang Bauer 2016-05-18 11:36:00 UTC
PS: there's another thing you could try to possibly narrow down the issue:
Switch to "Start with a previously saved session" in systemsettings5->Startup and Shutdown->Session Management, manually save the session (a corresponding entry should appear in the application menu in the "Leave" tab  or in "Powermanagement/Session" if using Kicker after you logged out and in again), and see whether your applications are saved/restored correctly then.

This worked even with Qt5/KF5 applications before the problem was solved there.
Comment 53 Piotr Mierzwinski 2016-05-18 18:55:58 UTC
(In reply to Wolfgang Bauer from comment #52)
> PS: there's another thing you could try to possibly narrow down the issue:
> Switch to "Start with a previously saved session" in
> systemsettings5->Startup and Shutdown->Session Management, manually save the
> session (a corresponding entry should appear in the application menu in the
> "Leave" tab  or in "Powermanagement/Session" if using Kicker after you
> logged out and in again), and see whether your applications are
> saved/restored correctly then.
>
OK. I switched from "Restore previous session" to "Restore manually saved session" (in Plasma eng. version options might be call a bit different, I translated from polish). And in "Leave" tab I found option "Save session". I clicked it and checked ksmserverrc file - last modification date was changed. Unfortunately turned out that neither Thunderbird nor Opera is not saved. After that I run Firefox and repeated procedure. And again in ksmserverrc file there wasn't nothing about Firefox, Thunderbird and Opera :(. Nothing about any GTK application has been saved.

I don't how it's possible that restoring Firefox is working in openSUSE :/. You or someone else told about it. 
Is it possible that they somehow patched plasma-workspace?

If you are using openSUSE then could you please check at least new Opera, if it will be restore after relogin.

> This worked even with Qt5/KF5 applications before the problem was solved
> there.
Comment 54 Wolfgang Bauer 2016-05-19 18:37:31 UTC
(In reply to Piotr Mierzwinski from comment #53)
> OK. I switched from "Restore previous session" to "Restore manually saved
> session" (in Plasma eng. version options might be call a bit different, I
> translated from polish). And in "Leave" tab I found option "Save session". I
> clicked it and checked ksmserverrc file - last modification date was
> changed. Unfortunately turned out that neither Thunderbird nor Opera is not
> saved. After that I run Firefox and repeated procedure. And again in
> ksmserverrc file there wasn't nothing about Firefox, Thunderbird and Opera
> :(. Nothing about any GTK application has been saved.

Ok, that explains why they are not restored, of course the question still remains why they don't get saved in the first place.

You should probably add this information to your new bug report though.
 
> I don't how it's possible that restoring Firefox is working in openSUSE :/.
> You or someone else told about it. 
> Is it possible that they somehow patched plasma-workspace?

No.

But now that I come to think of it, openSUSE's Firefox (and Thunderbird) packages include some custom KDE(4) integration. This *might* make the difference between it being restored in openSUSE but not in other distributions...
Though I'm not sure if that detail is really relevant here, the integration is more about using the KDE file dialog and certain KDE settings (like preferred applications and proxy settings), things like that.

> If you are using openSUSE then could you please check at least new Opera, if
> it will be restore after relogin.

Well, I did install Opera now (37.0.2178.32), and indeed it is not restored (nor saved to ksmserverrc).

But I tried with KDE4 too, and it isn't restored/saved there as well.

So at least in this particular case it's definitely not a (recent) regression in ksmserver either.
Comment 55 Piotr Mierzwinski 2016-05-19 21:13:36 UTC
(In reply to Wolfgang Bauer from comment #54)

> > I don't how it's possible that restoring Firefox is working in openSUSE :/.
> > You or someone else told about it. 
> > Is it possible that they somehow patched plasma-workspace?
> 
> No.
> 
> But now that I come to think of it, openSUSE's Firefox (and Thunderbird)
> packages include some custom KDE(4) integration. This *might* make the
> difference between it being restored in openSUSE but not in other
> distributions...
> Though I'm not sure if that detail is really relevant here, the integration
> is more about using the KDE file dialog and certain KDE settings (like
> preferred applications and proxy settings), things like that.

Yes. I agree. It seems to be not related.  So my question still remains opened :/..

> > If you are using openSUSE then could you please check at least new Opera, if
> > it will be restore after relogin.
> 
> Well, I did install Opera now (37.0.2178.32), and indeed it is not restored
> (nor saved to ksmserverrc).
> 
> But I tried with KDE4 too, and it isn't restored/saved there as well.

I can confirm. I tested it in Mageia 5 and new Opera is not restored as well.

BTW.
Recently, using Antergos I observed that konsole is restored randomly. Every few running (of Plasma) is not restored. It looks similar to behavior Kubuntu 15.x with Plasma 5.4.x
Comment 56 Troy Volin 2016-05-20 12:17:55 UTC
Created attachment 99093 [details]
attachment-29857-0.html

Everything about restore has been intermittent for me on 5.5.x and 5.6.x.
Konsole restore, Kate and Kwrite restore, ...
The only thing that has actually been consistent, oddly, is virt-manager
(which I think is GTK3).
Fedora doesn't present a "save session" on the Leave menu, but I can do it
through qdbus. I guess I'll give that a try, and use "saved session" from
kdm.
Also, I think this is still the case: libreoffice acts as if it had crashed
if it is running at session end (logout/restart). Maybe it doesn't talk xsm
and ignores the shutdown request, but I doubt it. I think it's more likely
related. It's probably no coincidence that it is omitted from ksmserverrc
and it was never told to quiesce.

On Thu, May 19, 2016, 4:13 PM Piotr Mierzwinski via KDE Bugzilla <
bugzilla_noreply@kde.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=343518
>
> --- Comment #55 from Piotr Mierzwinski <piotr.mierzwinski@gmail.com> ---
> (In reply to Wolfgang Bauer from comment #54)
>
> > > I don't how it's possible that restoring Firefox is working in
> openSUSE :/.
> > > You or someone else told about it.
> > > Is it possible that they somehow patched plasma-workspace?
> >
> > No.
> >
> > But now that I come to think of it, openSUSE's Firefox (and Thunderbird)
> > packages include some custom KDE(4) integration. This *might* make the
> > difference between it being restored in openSUSE but not in other
> > distributions...
> > Though I'm not sure if that detail is really relevant here, the
> integration
> > is more about using the KDE file dialog and certain KDE settings (like
> > preferred applications and proxy settings), things like that.
>
> Yes. I agree. It seems to be not related.  So my question still remains
> opened
> :/..
>
> > > If you are using openSUSE then could you please check at least new
> Opera, if
> > > it will be restore after relogin.
> >
> > Well, I did install Opera now (37.0.2178.32), and indeed it is not
> restored
> > (nor saved to ksmserverrc).
> >
> > But I tried with KDE4 too, and it isn't restored/saved there as well.
>
> I can confirm. I tested it in Mageia 5 and new Opera is not restored as
> well.
>
> BTW.
> Recently, using Antergos I observed that konsole is restored randomly.
> Every
> few running (of Plasma) is not restored. It looks similar to behavior
> Kubuntu
> 15.x with Plasma 5.4.x
>
> --
> You are receiving this mail because:
> You voted for the bug.
>
Comment 57 Fahad Alduraibi 2016-05-20 16:26:12 UTC
(In reply to Troy Volin from comment #56)
> Created attachment 99093 [details]
> attachment-29857-0.html
> 

> Fedora doesn't present a "save session" on the Leave menu, but I can do it
> through qdbus. I guess I'll give that a try, and use "saved session" from
> kdm.

Actually it does, I just tried the manual restore and a new item shows right below logout and called "Save Session" and it doesn't have an icon too.

The manual option restores the kde apps I tested it with (no GTK), while the auto "restore previous ..." doesn't restore any thing at all, and I get a clean desktop even though ksmserverrc has them listed even after I login

restartCommand1=kwin_x11,-session,10b4dad3da000146376046400000111720001_1463760707_7673
restartCommand2=/usr/bin/owncloud,-session,10b4dad3da000146376046400000111720007_1463760706_950741
restartCommand3=/usr/bin/kwalletd5,-session,10b4dad3da000146376046400000111720009_1463760706_952608
restartCommand4=/usr/bin/konsole,-session,10b4dad3da000146376048200000111720012_1463760706_957934
restartCommand5=/usr/bin/dolphin,-session,10b4dad3da000146376049400000111720013_1463760706_952905
restartCommand6=/usr/bin/dolphin,-session,10b4dad3da000146376068900000120380011_1463760706_953994
restartCommand7=/usr/bin/konsole,-session,10b4dad3da000146376069700000120380012_1463760706_956747


that is on my laptop, on the desktop i haven't tested the manual option, but the auto way only restores Konsole windows and their current paths are reset to the default which means it is restarting it fresh.
Comment 58 Wolfgang Bauer 2016-05-26 18:27:27 UTC
(In reply to Troy Volin from comment #56)
> Everything about restore has been intermittent for me on 5.5.x and 5.6.x.
> Konsole restore, Kate and Kwrite restore, ...

I say it again: the problem with KF5 applications (konsole, kwrite, ) has been fixed in KDE Frameworks 5.20, the Plasma or ksmserver version is irrelevant here.

And KDE Frameworks must be built against Qt 5.6.0 or higher, the fix required a change to Qt5 as well.

> The only thing that has actually been consistent, oddly, is virt-manager
> (which I think is GTK3).
> Fedora doesn't present a "save session" on the Leave menu,

It should, if you enable "Restore previously stored session" in systemsettings5 as mentioned.

> I guess I'll give that a try, and use "saved session" from
> kdm.

I don't know what that "saved session" in kdm is, I don't have that here.
And kdm (or any displaymanager) is just a login screen, it is not involved in session management at all.

Running a standard Plasma session should restore the previous session according to Plasma's (ksmserver's) settings.

> Also, I think this is still the case: libreoffice acts as if it had crashed
> if it is running at session end (logout/restart). Maybe it doesn't talk xsm
> and ignores the shutdown request, but I doubt it. I think it's more likely
> related. It's probably no coincidence that it is omitted from ksmserverrc
> and it was never told to quiesce.

Well, LibreOffice 5.0.4.2 isn't restored at all here.
But also in this case, the same application/version is not restored in KDE4 either, so it is no (recent) regression in ksmserver.

And LO is actually being saved in ksmserverrc (unlike Opera), still it is not being restored.

In this case, wrong/invalid command line arguments are being saved to ksmserverrc, if I try to run it like that manually I just get an error message ("Unknown option: --session=xxxxx") and the help text. Removing the --session parameter from the line in ksmserverrc before logging in again makes it being started on login.

AFAIK this RestartCommand is supplied by the application, so this is a bug in LO for me. I'll probably file a bug report against LibreOffice myself.
But in any case, yet another, completely different problem...

I also tried some GTK2/3 applications meanwhile and they are also not restored here (not even in GNOME btw), but see bug#362671 for that.
Comment 59 Wolfgang Bauer 2016-05-26 21:28:01 UTC
PS:
(In reply to Troy Volin from comment #56)
> Also, I think this is still the case: libreoffice acts as if it had crashed
> if it is running at session end (logout/restart).

There is an (quite old) open Libreoffice bug report about that problem here:
https://bugs.documentfoundation.org/show_bug.cgi?id=32884
Comment 60 zieloo 2016-05-28 11:43:53 UTC
A temporary solution to save the window position and geometry in KDE is to:
1. from a window menu choose Advanced
2. select 'additional program settings'
3. check 'position' and 'geometry'
4. from the dropdown lists select 'force'
5. save all and close the program window
6. open it again - position and geometry should be remembered.
Comment 61 Piotr Mierzwinski 2016-06-22 18:03:53 UTC
As I said earlier I'm working on Antergos (on this day) with the newest Plasma (5.6.5), with the newest KF (5.23), the newest Qt 5 (5.6.1) and KDE Applications 16.04.2.

I use konsole very often with running couple of cards (for example: pure terminal, couple mc, and sometime mc run with root privileges - executed like this: "sudo mc %s"). Konsole is opened every time when I work in Plasma desk., so I expect that after rerun of the system it will be restored. Unfortunately doesn't. Recently I observed that sometimes is happened that konsole is not restored when I run systemem next day. I suppose that this is related with running root session ("sudo mc %s" session) in moment of system close or even run and closed root session. As I remember, almost every time when I run such session, konsole will be not restored, at all. This is a bit annoying, because konsole has no option "Load saved/recent session/cards". Issue seems to be happen randomly.
In my every Plasma session I run always one or more KWrite application(s), and they are restored every time.
Comment 62 Wolfgang Bauer 2016-06-22 18:48:55 UTC
(In reply to Piotr Mierzwinski from comment #61)
> As I said earlier I'm working on Antergos (on this day) with the newest
> Plasma (5.6.5), with the newest KF (5.23), the newest Qt 5 (5.6.1) and KDE
> Applications 16.04.2.

Ok, then it should work for KDE applications, and that you mention kwrite later, it apparently does work for you anyway.
 
> I use konsole very often with running couple of cards (for example: pure
> terminal, couple mc, and sometime mc run with root privileges - executed
> like this: "sudo mc %s"). Konsole is opened every time when I work in Plasma
> desk., so I expect that after rerun of the system it will be restored.
> Unfortunately doesn't.

This is probably a bug in konsole then.
So in this case better open a new bug report against konsole.

But just to be clear:
AFAIK Konsole does *not* restore running applications at all (and never did AFAIK), because it cannot know what is exactly running in the shell inside.

It should restore the tabs (and the *profile* in each tab) you had open though.
So if you create a "Root mc" profile and have that open at logout, it should be restored at login.
Comment 63 Piotr Mierzwinski 2016-06-22 19:43:02 UTC
I don't think that good idea is blamed konsole for this. As I said this happens randomly. Today, after your post, I made couple of tests (several relogin and restarts) and every time all tabs were restored. In the same time I'm not sure that when I run computer tomorrow then konsole will be restored. This is happens sometimes. And I observed it couple of times within month. Today was last time when run computer fist time after back from work. Issue is a bit similar to this one placed in Qt 5.5.x. In this moment I'm not able to replicate the issue. I don't know why kwrite is restoring properly every time. I think that both are using the same XSMP protocol, what is probably built in KF libraries.

I know that konsole does not restore running application after its restart. In my opinion it's shame. For me enough would be only run tabs with defined profile, so for example with pure terminal, mc, other defined profiles running in moment of closing. If automatically restoration is not possible then useful would be option what force running of saved tabs. I know, this is wish for konsole. I'm aware that this option option is not really needed if konsole is properly restored after relogin or restart.
Comment 64 Wolfgang Bauer 2016-06-22 20:13:28 UTC
(In reply to Piotr Mierzwinski from comment #63)
> I don't think that good idea is blamed konsole for this.

Well, session management in X11 is a sever/client protocol.
Not every issue can be blamed on the server (i.e. ksmserver) either...

This bug report (and the one this has been marked as duplicate of) was originally about KF5/Qt5 not doing that correctly, and that should be fixed.

As you say, both kwrite and konsole use the same KF5 libraries (which implement the XSMP protocol on the client side), so restoring them should work (or not) the same for both.

But in the end it's the client's (i.e. the application's) job to save its state correctly, after being requested to do so by the server. And that's not something that can be done in general by KDE Frameworks5 either.

That said, I haven't seen a single case here yet in months when konsole was not restored, not even randomly.  (openSUSE backported the fixes to Qt5.5 and earlier Frameworks versions already in Januray/February, so I'm using them since then)
Comment 65 Chris 2016-06-22 22:22:56 UTC
OK, so this bug is solved because it is duplicate of bug 354724, and I looked there it's solved too; glade to ear it.
However, Konsole never ever get restored for me.
My system is debian-stretch, upgrade from today; I've waited till I had qt5.6.1 installed to post this comment since it could have solved things: it hasn't.
It might be distro related though since they insist on 354724 that Konsole is correctly restored: I'll check on that side and keep you informed.
Comment 66 Piotr Mierzwinski 2016-06-23 17:35:54 UTC
@Wolfgang Bauer
Thanks for explanation.
On begin I can say that happened what I supposed. So today after first login to Plasma, konsole has not been restored, at all. Maybe this is some bug in konsole. Yesterday, before shutting down the system I also run okular, and kate. Today all of them have been restored.

> restoring them should work (or not) the same for both
> But in the end it's the client's (i.e. the application's) job to save its state correctly
I know that in the moment of closing application its destructor are calling, actually QApplication/KApplication. So what is the difference in type of shutting (by server). When I log off (calling log off in Plasma) or shut down system (calling "turn of" in Plasma) then shutting should work the same. in This is my suspicion.
The only one job what can do application in shutting down moment is saving it's state into some configuration file. Every other actions are managed by Qt/KF/ksmsever. As I suppose.  And this is doing correct for login off and restart.

For me it should just work for both (konsole and kwrite) the same.
Sorry I repeat my self. Yesterday I reloged couple of times, also I restarted system. And konsole was restored every time. When yesterday  I shut down the system and run it today,  konsole has not been restored. I don't understand this.
I don't know how exactly Plasma closing/shutting down its session, I suppose is using some qdbus command (example of shutting down: "qdbus org.kde.ksmserver /KSMServer logout 0 2 2"). Is this implemented by distribution or in K menu?

And on end. You are comparing two Qt versions. Why openSuse doesn't use the newest Qt version, only its developers backported some fixes? Maybe in last Qt still persists some bug related with closing applications. 

@Chris
I don't know what situation you meant, saying "konsole never ever get restored for me."?
If this is just rerun of konsole thats OK. For me either konsole wasn't restored.
If this is relogin/restart/shut down and run then in my opinion konsole should be restored every times when Plasma session is starting and proper option is turned on in Plasma setting (for example: "Restore previous session" in System settings).

Maybe this is distro related. I don know. :/. I'll try to report it.
Comment 67 Piotr Mierzwinski 2016-06-29 16:46:39 UTC
I think I found reason why konsole is not restored.
Very often in konsole in run pure bash shell and two mc sessions. Sometimes I mount (manually - using tool from taskbar) external hard disk and open in mc some directory from this disk. I shut down system didn't changed directory. Next day I power on computer and login into Plasma. Konsole is not restored. To be sure I did some tests with automatically mounted my external hard disk. In this case konsole was restored.
Comment 68 Wolfgang Bauer 2016-07-18 13:12:09 UTC
(In reply to Piotr Mierzwinski from comment #66)
> I know that in the moment of closing application its destructor are calling,
> actually QApplication/KApplication. So what is the difference in type of
> shutting (by server).

There is no difference.
Except that the display manager (login screen) is told to shutdown/reboot after closing the session, or not.

> I don't know how exactly Plasma closing/shutting down its session, I suppose
> is using some qdbus command (example of shutting down: "qdbus
> org.kde.ksmserver /KSMServer logout 0 2 2"). Is this implemented by
> distribution or in K menu?

Yes, it contacts ksmserver to via DBUS (it doesn't use qdbus for that and communicates directly, but that's just an unimportant detail).
And this is implemented in K-menu (or Plasma itself actually I think).

> And on end. You are comparing two Qt versions. Why openSuse doesn't use the
> newest Qt version, only its developers backported some fixes? Maybe in last
> Qt still persists some bug related with closing applications. 

Well, I am using 5.6.1 here (5.7.0 meanwhile).

And it's not that openSUSE doesn't use newest Qt version.

But openSUSE Leap is a stable release with discrete release dates. Leap 42.1 has been released last November, and Qt 5.5 was the latest at that point.
But as mentioned, we backported the corresponding change from Qt 5.6 to be able to ship the Frameworks fixes and have this working in Leap 42.1 (as our users complained as well).

That's how (many) stable distributions work: the package versions get frozen at release, and afterwards you only get bugfix and security updates backported, no new versions (with exceptions).

We do have a rolling distribution as well, openSUSE Tumbleweed, which of course always gets the latest and greatest.

(In reply to Piotr Mierzwinski from comment #67)
> I think I found reason why konsole is not restored.
> Very often in konsole in run pure bash shell and two mc sessions. Sometimes
> I mount (manually - using tool from taskbar) external hard disk and open in
> mc some directory from this disk. I shut down system didn't changed
> directory. Next day I power on computer and login into Plasma. Konsole is
> not restored. To be sure I did some tests with automatically mounted my
> external hard disk. In this case konsole was restored.

Somebody filed a bug report about this recently, inspired by your comment:
https://bugs.kde.org/show_bug.cgi?id=365413