GNOME Software only supports running one application from a snap

Bug #1661590 reported by Simos Xenitellis  on 2017-02-03
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
GNOME Software
Fix Released
Medium
Snappy
Undecided
Unassigned
gnome-software (Ubuntu)
Medium
Robert Ancell
Xenial
Medium
Unassigned
Artful
Medium
Unassigned
Bionic
Medium
Robert Ancell

Bug Description

HOW TO REPRODUCE:

1. Install LibreOffice snap ('nonfree' tag) from Ubuntu Software.
2. Click on the 'Launch' button once you have it installed.

WHAT IS EXPECTED:
It should launch the LibreOffice wizard instead of any of Writer, Calc, etc.

WHAT ACTUALLY HAPPENS:
It launches LibreOffice Database.

WHY THIS HAPPENS?

Ubuntu Software probably picks the first listed command (libreoffice.base), as shown in

$ snap info libreoffice
name: libreoffice
summary: "LibreOffice is a powerful office suite including word processing and creation of spreadsheets, slideshows and databases"
publisher: canonical
description: |
  LibreOffice is a powerful office suite – its clean interface and
  feature-rich tools help you unleash your creativity and enhance your
  productivity. LibreOffice includes several applications that make it the most
  powerful Free and Open Source office suite on the market: Writer (word
  processing), Calc (spreadsheets), Impress (presentations), Draw (vector
  graphics and flowcharts), Base (databases), and Math (formula editing).
commands:
  - libreoffice.base
  - libreoffice.calc
  - libreoffice.draw
  - libreoffice.impress
  - libreoffice
  - libreoffice.math
  - libreoffice.writer
tracking: stable
installed: 5.3.0.3 (17) 374MB -
refreshed: 2017-02-01 20:51:51 +0200 EET
channels:
  stable: 5.3.0.3 (17) 374MB -
  candidate: 5.3.0.3 (17) 374MB -
  beta: 5.3.0.3 (17) 374MB -
  edge: 5.3.0.3 (17) 374MB -

The order in snapcraft.yaml is different, so probably Snapcraft is changing the order (it might assume that 'libreoffice' is 'libreoffice.libreoffice', so it puts it further down.

Here is snapcraft.yaml: https://git.launchpad.net/~bjoern-michaelsen/df-libreoffice/+git/libreoffice-snap-playground/tree/snapcraft.yaml?h=xenial

Michael Vogt (mvo) wrote :

Adding Robert - is there anything you need from snapd to supoprt this? I think provide all the information if there are multiple apps in a single snap now?

Will Cooke (willcooke) on 2017-02-07
Changed in gnome-software (Ubuntu):
assignee: nobody → Robert Ancell (robert-ancell)
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-software (Ubuntu):
status: New → Confirmed
Robert Ancell (robert-ancell) wrote :

We see the multiple commands but there's no way to differentiate between them. At the moment we're just launching the first command in the list.

I think as a first step the order should be as the developer intended, so picking the first one is an appropriate default.

If we want to support launching multiple applications from a snap, then we probably need more metadata. For example we probably need:
- Some sort of description for each app
- We need to know if some apps are graphical and some are not (we're looking at the slots the snap requests to use this).

We also need to work out how to expose this in GNOME Software, either multiple launch buttons per snap or break the snap into multiple entries.

summary: - When launching a snap from Ubuntu Software, it runs the first command
- alphabetically
+ GNOME Software only supports running one application from a snap
Changed in gnome-software (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged

In the same way that we can provide multiple entries to /snap/bin/ it
makes sense to offer multiple .desktop files. Would that get you closer
to a great desktop experience?

Robert Ancell (robert-ancell) wrote :

snapd currently doesn't (directly) expose the .desktop files, but if we had those we could get a better experience.

OK, I'm +1 with that unless you have another suggestion. Could we put
the desktop file as an entry under the app command? I.e.

apps:
  foo:
    desktop: path/to/file.desktop
    command: bin/foo.py

One thing that seems awkward is the duplication of the command in the
desktop file and the apps stanza.

Simos Xenitellis  (simosx) wrote :

A note here that when you run "snap info libreoffice", the order of the commands actually changes every time you run it. I suppose that snapd does not have the order of the commands as given in snapcraft.yaml. That's what I get with snap 2.12

A workaround could be for Ubuntu Software to pick the shorter filename (for LibreOffice, that would be "libreoffice", the wizard, which is what is expected to run).

Robert Ancell (robert-ancell) wrote :

I would hope that snapcraft can be made to automatically populate the apps data by detecting the .desktop files. In this case, the command does seem redundant. If GNOME Software knew the .desktop file it would use that information instead of the command.

Robert Ancell (robert-ancell) wrote :

I opened bug 1663103 about not being able to determine which slots each app uses.

Gustavo Niemeyer (niemeyer) wrote :

Every application may already have an associated desktop file under meta/gui/<app>.desktop today.

Gustavo Niemeyer (niemeyer) wrote :

Another side note: there's no special meaning to the order of commands in snap.yaml. We can reorder it, and snapcraft can reorder it, so please don't take it to mean something specific as that'll easily break.

Gustavo Niemeyer (niemeyer) wrote :

@Mark: The command is not duplicated. The desktop file will call the actual command defined in the snap.yaml. It may provide additional arguments, but those will indeed be _in addition_ to the ones in snap.yaml.

Gustavo Niemeyer (niemeyer) wrote :

More food for thought on the above note: the desktop file cannot call the real underlying command by itself! That would break confinement. It calls the confined binary under /snap/bin instead, which is what the "command:" attribute specifies. So, necessarily respected.

Gustavo Niemeyer (niemeyer) wrote :

Robert: what do you actually need here? We already support multiple desktop files, and they already hold metadata. gnome-software can already inspect to see which of these is available, I believe? What are the missing pieces?

John Lenton (chipaca) wrote :

I should point out that there isn't a clear 1:1 mapping between desktop files and apps, and that some of the things mentioned here would impose this.

FWIW IMHO if gnome software needs to choose one app from a snap to run because of its own limitations it should choose the default app, the one that has the same name as the snap.

Mark Shuttleworth (sabdfl) wrote :

On 10/02/17 16:50, John Lenton wrote:
> I should point out that there isn't a clear 1:1 mapping between desktop
> files and apps, and that some of the things mentioned here would impose
> this.
>
> FWIW IMHO if gnome software needs to choose one app from a snap to run
> because of its own limitations it should choose the default app, the one
> that has the same name as the snap.

I don't think we should assume that GNOME Software should run *anything*
from a snap unless there is a .desktop file for it. Lots of snaps will
not be appropriate to run in a GUI.

Mark

Robert Ancell (robert-ancell) wrote :

The solution we ended up implementing to determine if an app is graphical was in bug 1595023.

It would be much better to get an explicit mapping of apps to .desktop files and use that.

Robert Ancell (robert-ancell) wrote :

GNOME Software currently doesn't actually introspect anything from the .snap directly. It uses snapd which I understand it is the desired design of snapd (I like this).

So what I need is:
- API in snapd to explicitly map which app has which .desktop file and how to get the contents of them.
OR
- Confirmation on the correct method to get a .desktop file given an app name.

I think the API in snapd is the best method as this allows any changes in the snap format to be handled in one place and works for all snap clients.

Gustavo Niemeyer (niemeyer) wrote :

Sounds good. We'll add something along those lines to the API.

Michael Vogt (mvo) wrote :
Changed in snappy:
status: New → In Progress
James Henstridge (jamesh) wrote :

I put together a gnome-software patch to use the extra info from mvo's snapd change:

https://code.launchpad.net/~jamesh/gnome-software/+git/gnome-software/+ref/pick-launch-app

It still only supports running one application, but it now favours apps that provide a desktop file, and the snap's main app as a tie breaker. For Libreoffice, this reliably picks the main "libreoffice" binary.

It also launches the app via the desktop file if available, so we don't have to guess whether it needs a terminal in that case.

Robert Ancell (robert-ancell) wrote :

Can you open bugs against GNOME Software upstream and propose patches there? In this case the patch to master will use snapd-glib and be different (I just pushed support for desktop files to snapd-glib master). You can backport changes either to the GNOME stable branch if OK'd by upstream or to the wip/ubuntu-* branches (the former is preferrable and then we can rebase the Ubuntu branches).

Changed in gnome-software:
importance: Unknown → Medium
status: Unknown → Fix Released
Changed in gnome-software (Ubuntu):
status: Triaged → Fix Released
Changed in gnome-software (Ubuntu Xenial):
status: New → Fix Committed
importance: Undecided → Medium
Changed in gnome-software (Ubuntu Artful):
importance: Undecided → Medium
status: New → Triaged
Changed in gnome-software (Ubuntu Artful):
status: Triaged → Won't Fix

Hello Simos, or anyone else affected,

Accepted gnome-software into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gnome-software/3.20.5-0ubuntu0.16.04.10 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed verification-needed-xenial
Simos Xenitellis  (simosx) wrote :

Hi!

On Ubuntu 16.04 (xenial) I enabled the `xenial-proposed` repository and upgrade `gnome-software`.

$ apt policy gnome-software
gnome-software:
  Installed: 3.20.5-0ubuntu0.16.04.10
  Candidate: 3.20.5-0ubuntu0.16.04.10
  Version table:
 *** 3.20.5-0ubuntu0.16.04.10 400
        400 http://archive.ubuntu.com/ubuntu xenial-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     3.20.5-0ubuntu0.16.04.8 500
        500 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     3.20.1+git20160420.1.ca63436.ubuntu-xenial-0ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages

I launched `gnome-software` and located the `libreoffice` snap package.
I clicked on the Launch button.

WHAT HAPPENED: LibreOffice Base was launched (the wizard for Base to open a database).
When I do 'snap info libreoffice', libreoffice.base is the first in the list.

WHAT SHOULD HAPPEN:
It should launch `libreoffice` instead.

tags: added: verification-failed-xenial
removed: verification-needed-xenial
tags: added: verification-done
removed: verification-needed

Thank you for taking the time to verify this stable release fix. We have noticed that you have used the verification-done tag for marking the bug as verified and would like to point out that due to a recent change in SRU bug verification policy fixes now have to be marked with per-release tags (i.e. verification-done-$RELEASE). Please remove the verification-done tag and add one for the release you have tested the package in. Thank you!

https://wiki.ubuntu.com/StableReleaseUpdates#Verification

tags: added: verification-done-xenial
removed: verification-done
James Henstridge (jamesh) wrote :

@simosx: I gave this another test on a clean xenial VM with the same gnome-software version as you. Each time it launched the main "libreoffice" command (showing a window asking to open recent files or create a new document in one of the libreoffice applications).

gnome-software continues running when you close the window, so is it possible you were still running the old version when you saw the failure?

Robert Ancell (robert-ancell) wrote :

I also tried this in a VM which didn't have libreoffice installed - it launched the welcome window, not libreoffice base. I suspect Simos hadn't restarted GNOME Software (which is confusing, but the way is works). Marking as verified.

tags: removed: verification-failed-xenial

The verification of the Stable Release Update for gnome-software has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-software - 3.20.5-0ubuntu0.16.04.10

---------------
gnome-software (3.20.5-0ubuntu0.16.04.10) xenial; urgency=medium

  * debian/patches/0020-Add-a-Snap-plugin.patch:
  * debian/patches/0015-Don-t-reject-unexpected-state-changes-external-event.patch:
    - Correctly launch snaps with multiple apps (LP: #1661590)
    - Fix snaps not being shown correctly after install from command line
      (LP: #1754655)

gnome-software (3.20.5-0ubuntu0.16.04.9) xenial; urgency=medium

  * debian/patches/0001-Make-app-name-sorting-case-insensitive.patch:
  * debian/patches/0018-Add-a-Snap-plugin.patch:
    - Show snaps in categories (LP: #1665126)
  * debian/patches/0001-trivial-Include-the-fwupd-version-in-the-useragent.patch:
    - Report fwupd version in user agent (LP: #1750030)
  * debian/patches/0050-snap-Support-channels.patch:
    - Support channels (LP: #1750288)
  * debian/README.source:
    - Update git repository to point to gitlab.gnome.org

 -- Robert Ancell <email address hidden> Wed, 28 Mar 2018 17:04:55 +1300

Changed in gnome-software (Ubuntu Xenial):
status: Fix Committed → Fix Released
Simos Xenitellis  (simosx) wrote :

I just tried again and now Software launches the correct command from the snap.
I do not remember for certain whether I closed Software with Ctrl+Q.
Sorry for the inconvenience.

Jeremy Bicha (jbicha) wrote :

Simos, GNOME Software keeps running in the background. After updating GNOME Software on Ubuntu 16.04 LTS, you either need to log out and log back in or run a command like:

pkill gnome-software

On Ubuntu 18.04 LTS, GNOME Software should recognize that it has been updated and it will prompt you to restart the app so the above workaround isn't needed.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.