Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple tray icons on Kubuntu 20.04 #1770

Closed
Forinil opened this issue Sep 30, 2020 · 16 comments · Fixed by #1791
Closed

Multiple tray icons on Kubuntu 20.04 #1770

Forinil opened this issue Sep 30, 2020 · 16 comments · Fixed by #1791
Assignees
Labels
Milestone

Comments

@Forinil
Copy link

Forinil commented Sep 30, 2020

Describe the bug

Multipass started showing multiple icons in system tray. Only one of them works correctly, the rest shows Failure retrieving instances

To Reproduce

Unfortunately, I do not know how to reproduce this. I installed Kubuntu 20.04 and mutlipass shortly after the former came out. I did not experience any problems initially. I only noticed the additional icons a couple weeks ago. I update my system regularly using apt.

Expected behavior

A single, working multipass icon in the system tray.

Additional info

  • OS: Kubuntu 20.04
  • multipass version
  • multipass info --all
  • ps -ef | grep multipass (while two tray icons are shown)
$ multipass version
multipass  1.4.0
multipassd 1.4.0
$ multipass info --all
Name:           primary
State:          Stopped
IPv4:           --
Release:        --
Image hash:     2f6bc5e7d9ac (Ubuntu 18.04 LTS)
Load:           --
Disk usage:     --
Memory usage:   --
Mounts:         /home/kbotor => Home
                    UID map: 1000:default
                    GID map: 1000:default
$ ps -ef | grep multipass
root        1142       1  0 12:35 ?        00:00:05 /snap/multipass/2604/bin/multipassd --verbosity debug --logger platform
nobody      1367       1  0 12:35 ?        00:00:00 /snap/multipass/2604/usr/sbin/dnsmasq --strict-order --bind-interfaces --pid-file=/var/snap/multipass/common/data/multipassd/network/dnsmasq.pid --domain=multipass --local=/multipass/ --except-interface=lo --interface=mpqemubr0 --listen-address=10.42.176.1 --dhcp-no-override --dhcp-authoritative --dhcp-leasefile=/var/snap/multipass/common/data/multipassd/network/dnsmasq.leases --dhcp-hostsfile=/var/snap/multipass/common/data/multipassd/network/dnsmasq.hosts --dhcp-range 10.42.176.2,10.42.176.254,infinite --conf-file=/var/snap/multipass/common/data/multipassd/network/dnsmasq-TJ1142.conf
kbotor      2359    2207  0 12:35 ?        00:00:04 /snap/multipass/2604/bin/multipass.gui -session 101a01b610614a000160137479100000022910012_1601386657_909620
kbotor      2413       1  0 12:35 ?        00:00:05 /snap/multipass/2604/bin/multipass.gui --autostarting
kbotor     10897    2693  0 13:36 pts/1    00:00:00 grep --color=auto multipass

Additional info

After I right-clik the tray icon reporting failure retrieving instances and select quit, ps -ef no longer shows line with multipass.gui -session:

$ ps -ef | grep multipass
root        1142       1  0 12:35 ?        00:00:05 /snap/multipass/2604/bin/multipassd --verbosity debug --logger platform
nobody      1367       1  0 12:35 ?        00:00:00 /snap/multipass/2604/usr/sbin/dnsmasq --strict-order --bind-interfaces --pid-file=/var/snap/multipass/common/data/multipassd/network/dnsmasq.pid --domain=multipass --local=/multipass/ --except-interface=lo --interface=mpqemubr0 --listen-address=10.42.176.1 --dhcp-no-override --dhcp-authoritative --dhcp-leasefile=/var/snap/multipass/common/data/multipassd/network/dnsmasq.leases --dhcp-hostsfile=/var/snap/multipass/common/data/multipassd/network/dnsmasq.hosts --dhcp-range 10.42.176.2,10.42.176.254,infinite --conf-file=/var/snap/multipass/common/data/multipassd/network/dnsmasq-TJ1142.conf
kbotor      2413       1  0 12:35 ?        00:00:05 /snap/multipass/2604/bin/multipass.gui --autostarting
kbotor     10944    2693  0 13:37 pts/1    00:00:00 grep --color=auto multipass
@Forinil Forinil added the bug label Sep 30, 2020
@Forinil Forinil changed the title Multipe tray icons on Kubuntu 20.04 Multiple tray icons on Kubuntu 20.04 Sep 30, 2020
@Saviq
Copy link
Collaborator

Saviq commented Sep 30, 2020

Hi @Forinil,

Did you add Multipass to your auto-started apps manually? Snapd handles it through its own userd daemon starting with your session.

@Saviq Saviq added question and removed bug labels Sep 30, 2020
@Forinil
Copy link
Author

Forinil commented Sep 30, 2020

No I did not. I installed it with snap and left all the settings default.

@Saviq
Copy link
Collaborator

Saviq commented Sep 30, 2020

Something KDE is doing must be triggering the one with the -session argument… Is the other instance (--autostarting) working fine?

@Forinil
Copy link
Author

Forinil commented Oct 2, 2020

In general yes, though one time it crashed - there was no text in the menu and no way to get rid of it, other than killing the process. But that time the CLI did not work either and after a restart everything went back to normal - that is I still had two icons, but the --autostarting one worked fine, even after quitting the other one.

@Forinil
Copy link
Author

Forinil commented Oct 6, 2020

So yesterday I had the same issue with no text in the menu and multipass not working at all and today there's only one icon and everything works fine.

There seems to be no rhyme or reason to this.

@MrJamesEllis
Copy link

Hi

My KDE Neon 20.04 has this issue as well.. except it has 3 icons.

Haven't done anything apart from the bog-standard install and there is nothing I can see in KDE's autostart/startup.

2 icons show "Failure retrieving instances" on right click and the other shows the machine name. All 3 do nothing on left click.

$ multipass version
multipass  1.4.0
multipassd 1.4.0

$ multipass info --all
Name:           ubuntu-lts
State:          Stopped
IPv4:           --
Release:        --
Image hash:     473485d9ec93 (Ubuntu 20.04 LTS)
Load:           --
Disk usage:     --
Memory usage:   --


$ ps -eo pid,comm,args | grep multipass
   1136 multipassd      /snap/multipass/2604/bin/multipassd --verbosity debug --logger platform
   1560 dnsmasq         /snap/multipass/2604/usr/sbin/dnsmasq --strict-order --bind-interfaces --pid-file=/var/snap/multipass/common/data/multipassd/network/dnsmasq.pid --domain=multipass --local=/multipass/ --except-interface=lo --interface=mpqemubr0 --listen-address=10.191.121.1 --dhcp-no-override --dhcp-authoritative --dhcp-leasefile=/var/snap/multipass/common/data/multipassd/network/dnsmasq.leases --dhcp-hostsfile=/var/snap/multipass/common/data/multipassd/network/dnsmasq.hosts --dhcp-range 10.191.121.2,10.191.121.254,infinite --conf-file=/var/snap/multipass/common/data/multipassd/network/dnsmasq-TJ1136.conf
   2670 multipass.gui   /snap/multipass/2531/bin/multipass.gui -session 10e4c66b61000160075649100000068730009_1601445866_539697
   2734 multipass.gui   /snap/multipass/2604/bin/multipass.gui -session 10e4c66b61000160090008900000025110009_1601445866_539712
   2773 multipass.gui   /snap/multipass/2604/bin/multipass.gui --autostarting

I can see this line in .xsession-errors:

[2020-10-07T19:46:46.691] [error] [client] Failed to set up autostart prerequisites: could not locate the autostart file 'multipass.gui.autostart.desktop'
[2020-10-07T19:46:48.986] [error] [client] Failed to set up autostart prerequisites: could not locate the autostart file 'multipass.gui.autostart.desktop'

Happy to poke around relevant system locations that could hold clues, if someone could out where they are.

@ricab
Copy link
Contributor

ricab commented Oct 7, 2020

Hi @Forinil, @MrJamesEllis, that -session argument is unfamiliar to us. I suspect KDE could be trying to restore an earlier session and running things on its own. Do you have it configured to restore sessions?

Also, what does the following say?

for pid in `pgrep multipass.gui` ; do echo --- $pid:; pstree -alsp $pid ; done

@Forinil
Copy link
Author

Forinil commented Oct 7, 2020

@ricab

>for pid in `pgrep multipass.gui` ; do echo --- $pid:; pstree -alsp $pid ; done
--- 2432:
systemd,1 splash
  └─kdeinit5,2266                                  
      └─multipass.gui,2432 -session 101a01b610614a000160198426900000022540012_1601994595_462904
          ├─{multipass.gui},2440
          ├─{multipass.gui},2442
          ├─{multipass.gui},2444
          ├─{multipass.gui},2445
          ├─{multipass.gui},2448
          ├─{multipass.gui},2534
          ├─{multipass.gui},2535
          └─{multipass.gui},2556
--- 2489:
systemd,1 splash
  └─multipass.gui,2489 --autostarting
      ├─{multipass.gui},2526
      ├─{multipass.gui},2537
      ├─{multipass.gui},2538
      ├─{multipass.gui},2539
      ├─{multipass.gui},2540
      ├─{multipass.gui},2544
      ├─{multipass.gui},2545
      └─{multipass.gui},2551

@MrJamesEllis I titled this issue Multiple tray icons... because, while I usually have only two icons, I had three icons show up once or twice as well.

@ricab
Copy link
Contributor

ricab commented Oct 7, 2020

Thank you @Forinil. And another piece of info if you may, to help us figure out how best to approach this: can you confirm that, if you kill the multipass.gui process(es) that have -session in their cmdline, the remaining icon (the one with --autostarting) behaves properly?

@Forinil
Copy link
Author

Forinil commented Oct 7, 2020

@ricab I was already asked this question. My answers were

In general yes, though one time it crashed - there was no text in the menu and no way to get rid of it, other than killing the process. But that time the CLI did not work either and after a restart everything went back to normal - that is I still had two icons, but the --autostarting one worked fine, even after quitting the other one.

So yesterday I had the same issue with no text in the menu and multipass not working at all and today there's only one icon and everything works fine.

There seems to be no rhyme or reason to this.

By the way - today two icons again, one working and one not.

@ricab
Copy link
Contributor

ricab commented Oct 7, 2020

Ah ok, I missed that. It would still be useful to make sure it is always that one that works (and not just the one that starts first, for instance). But it should be, if we got it right.

@ricab ricab self-assigned this Oct 7, 2020
@Saviq
Copy link
Collaborator

Saviq commented Oct 7, 2020

Hi all, @ricab implemented a workaround in #1791, which will prevent the icon from starting if it's invoked with the -session argument.

In a few minutes you should be able to test with Multipass from the edge/pr1791 snap channel.

As far we can tell, it is KDE trying to restore the icon on session startup, which it shouldn't do, and certainly not the way it does it (outside of the snap environment).

@Forinil
Copy link
Author

Forinil commented Oct 8, 2020

I did a test and started manuallu quitting multipass.gui before shutting down the system and the second, non-working icon stopped showing up. I guess this proves @ricab theory about KDE trying to restart the session.

I switched the snap to channel edge/pr1791. So far there seem to be no issues, other than multipass.gui not being restarted automatically by snap refresh multipass --channel=edge/pr1791. I had to restart it manually to get it to work.

@Saviq
Copy link
Collaborator

Saviq commented Oct 9, 2020

I had to restart it manually to get it to work.

Correct, this functionality is in progress in snapd, see:

https://forum.snapcraft.io/t/wip-refresh-app-awareness/10736

bors bot added a commit that referenced this issue Oct 9, 2020
1791: [gui] Refuse session restoring r=Saviq a=ricab

Hopefully fixes #1770.

Qt consumes `-session <id>` from the command line before we have a chance to parse it. When we parse the `QApplication::arguments()`, it's no longer there, so we continued happily. But then we were not running with a proper environment, so no luck reaching the daemon.

Since we don't implement session restoring, we need to explicitly refuse the attempt. 

This is only applicable to `QGuiApplication`s, so it does not affect our other binaries.

References:
  - https://doc.qt.io/qt-5/qguiapplication.html#supported-command-line-options
  - https://code.woboq.org/qt5/qtbase/src/gui/kernel/qguiapplication.cpp.html#1547
  - https://code.woboq.org/qt5/qtbase/src/gui/kernel/qguiapplication.cpp.html#1573
  - https://doc.qt.io/qt-5/session.html



Co-authored-by: Ricardo Abreu <ricab@ricabhome.org>
@bors bors bot closed this as completed in 5653734 Oct 9, 2020
@bors bors bot closed this as completed in #1791 Oct 9, 2020
@MrJamesEllis
Copy link

I know this is closed and all, I've been away and have only just been able to test this. Using the edge/pr1791 refresh, signing out and signing in again there is only one multipass.gui icon and it was able to start the instance.

Interestingly, right clicking on the icon after closing the instance shows a context menu with not text, I don't think it's related to this issue, tho:

image

FTR, here are the results of that command prior to refreshing from edge/pr1791

$ for pid in `pgrep multipass.gui` ; do echo --- $pid:; pstree -alsp $pid ; done
--- 70779:
systemd,1 splash
  └─ksmserver,70672
      └─multipass.gui,70779 -session 10e4c66b61000160075649100000068730009_1602751923_312964
          ├─{multipass.gui},70784
          ├─{multipass.gui},70787
          ├─{multipass.gui},70788
          ├─{multipass.gui},70789
          ├─{multipass.gui},70790
          ├─{multipass.gui},70852
          ├─{multipass.gui},70853
          ├─{multipass.gui},70854
          ├─{multipass.gui},70855
          ├─{multipass.gui},70856
          ├─{multipass.gui},70864
          └─{multipass.gui},70883
--- 70786:
systemd,1 splash
  └─ksmserver,70672
      └─multipass.gui,70786 -session 10e4c66b61000160090008900000025110009_1602751923_312967
          ├─{multipass.gui},70791
          ├─{multipass.gui},70797
          ├─{multipass.gui},70798
          ├─{multipass.gui},70799
          ├─{multipass.gui},70800
          ├─{multipass.gui},70847
          ├─{multipass.gui},70848
          ├─{multipass.gui},70849
          ├─{multipass.gui},70850
          ├─{multipass.gui},70851
          ├─{multipass.gui},70862
          ├─{multipass.gui},70863
          └─{multipass.gui},70882
--- 70796:
systemd,1 splash
  └─ksmserver,70672
      └─multipass.gui,70796 -session 10e4c66b61000160264215800000021290008_1602751923_313036
          ├─{multipass.gui},70802
          ├─{multipass.gui},70811
          ├─{multipass.gui},70812
          ├─{multipass.gui},70813
          ├─{multipass.gui},70814
          ├─{multipass.gui},70857
          ├─{multipass.gui},70858
          ├─{multipass.gui},70859
          ├─{multipass.gui},70860
          ├─{multipass.gui},70861
          └─{multipass.gui},70884
--- 70885:
systemd,1 splash
  └─ksmserver,70672
      └─multipass.gui,70885 -session 10e4c66b61000160264302600000665630010_1602751923_313184
          ├─{multipass.gui},70886
          ├─{multipass.gui},70887
          ├─{multipass.gui},70888
          ├─{multipass.gui},70889
          ├─{multipass.gui},70890
          ├─{multipass.gui},70914
          ├─{multipass.gui},70915
          ├─{multipass.gui},70916
          ├─{multipass.gui},70917
          ├─{multipass.gui},70918
          └─{multipass.gui},71006
--- 70919:
systemd,1 splash
  └─multipass.gui,70919 --autostarting
      ├─{multipass.gui},70975
      ├─{multipass.gui},70976
      ├─{multipass.gui},70977
      ├─{multipass.gui},70978
      ├─{multipass.gui},70979
      ├─{multipass.gui},71002
      ├─{multipass.gui},71003
      └─{multipass.gui},71005

@ricab
Copy link
Contributor

ricab commented Oct 15, 2020

Hi @MrJamesEllis, thanks getting back to us. So everything is as anticipated regarding this issue and I am glad it's working for you now.

On the menu with no text, yeah that would be a separate problem. Do you observe that consistently, or was it a one-off thing? Did you perhaps get that after the snap refresh, for a previously running GUI? Feel free to open a new bug report.

Saviq pushed a commit that referenced this issue Oct 27, 2020
1791: [gui] Refuse session restoring r=Saviq a=ricab

Hopefully fixes #1770.

Qt consumes `-session <id>` from the command line before we have a chance to parse it. When we parse the `QApplication::arguments()`, it's no longer there, so we continued happily. But then we were not running with a proper environment, so no luck reaching the daemon.

Since we don't implement session restoring, we need to explicitly refuse the attempt. 

This is only applicable to `QGuiApplication`s, so it does not affect our other binaries.

References:
  - https://doc.qt.io/qt-5/qguiapplication.html#supported-command-line-options
  - https://code.woboq.org/qt5/qtbase/src/gui/kernel/qguiapplication.cpp.html#1547
  - https://code.woboq.org/qt5/qtbase/src/gui/kernel/qguiapplication.cpp.html#1573
  - https://doc.qt.io/qt-5/session.html



Co-authored-by: Ricardo Abreu <ricab@ricabhome.org>
@Saviq Saviq added this to the v1.5.0 milestone Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants