Crashes if broken snaps installed

Bug #1720442 reported by Dan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnome-software (Ubuntu)
Fix Released
High
Unassigned
Artful
Fix Released
High
Unassigned
Bionic
Fix Released
High
Unassigned

Bug Description

[Impact]
GNOME Software crashes if a broken snap is installed.

[Test Case]

1. Create and install a local snap:
$ mkdir -p /tmp/broken-snap/meta
$ printf "name: broken-snap\nversion: 1\n" > /tmp/broken-snap/meta/snap.yaml
$ sudo snap try /tmp/broken-snap

2. Break the snap
$ rm /tmp/broken-snap/meta/snap.yaml

3. Confirm the snap is broken:
$ snap list
Name Version Rev Developer Notes
broken-snap x1 try,broken

4. Restart gnome-software
$ killall gnome-software

5. Open GNOME Software and go to installed tab. Wait for items to load.

Expected result:
Installed snaps are shown

Observed result:
GNOME Software crashes.

[Regression Potential]
Fix is to handle fields missing in broken snaps. Some risk of breaking related code.

Revision history for this message
Dan (aninstanceofi) wrote :
Revision history for this message
Dan (aninstanceofi) wrote :

Relevant snippet of journald log attached.

tags: added: gnome-software
description: updated
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Please try to obtain a backtrace following the instructions at http://wiki.ubuntu.com/DebuggingProgramCrash and upload the backtrace (as an attachment) to the bug report. This will greatly help us in tracking down your problem.

Changed in gnome-software (Ubuntu):
importance: Undecided → High
status: New → Incomplete
Revision history for this message
Dan (aninstanceofi) wrote :
Revision history for this message
Dan (aninstanceofi) wrote :

My pleasure Sebastien, very happy to help.
Please don't hesitate to get back to me if you require any further details or testing.

Revision history for this message
Dan (aninstanceofi) wrote :

While looking through the backtrace, I noticed the references to libgs_plugin_snap.so. That reminded me, I was messing around with snapcraft a couple of weeks ago, trying to snap an app of mine (it didn't end well).

I'm wondering if I inadvertently broke something, possibly removing a critical snap related file in error (I didn't intentionally remove or change anything outwith my own created snap files, but wouldn't rule out having done so erroneously as a possibility).

Either way, in that scenario a resultant gnome-software crash probably wouldn't be a desired/expected outcome, so I'd imagine the bug would nevertheless stand, but this is some additional context in case it's useful.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the details and sorry for taking time getting back to you. Do you still get the issue? Could you maybe install the libglib2.0-0-dbgsym as well?

Is the snap service working correctly for you? Can you snap install some snap from a command line?

Changed in gnome-software (Ubuntu):
status: Incomplete → New
Revision history for this message
Dan (aninstanceofi) wrote :

Hi,

Yes, the issue is still occurring, with every attempt to run gnome-software resulting in the same outcome (a crash).

I'm bang up-to-date with all system and software updates.

Yes, snap is working fine from CLI. I just installed/removed a snap to test, with no issue whatsoever.

Please find a further backtrace attached.

Thanks!

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, the backtrace is missing the debug symbols for gnome-software and the snap plugin though, could you install those debs

https://launchpad.net/ubuntu/+source/gnome-software/3.26.1-0ubuntu2/+build/13584302/+files/gnome-software-dbgsym_3.26.1-0ubuntu2_amd64.ddeb
https://launchpad.net/ubuntu/+source/gnome-software/3.26.1-0ubuntu2/+build/13584302/+files/gnome-software-plugin-snap-dbgsym_3.26.1-0ubuntu2_amd64.ddeb

and get a new one?

(oh and you wrote that you had issues making a snap for your application, you might be able to find help for that on https://forum.snapcraft.io/ if you are interested)

Revision history for this message
Dan (aninstanceofi) wrote :

Oops sorry about that - thought I'd reinstalled the debug symbols before the last backtrace, but clearly not. Please find new backtrace, attached.

I'm keeping this current installation with a view to helping with diagnosis of this issue. As far as I'm concerned, that's fine for the moment (I very rarely use the GUI to manage software packages). But, being that it's quite possible that a fresh install would solve the issue (reinstalling and missing/corrupt packages, for example), then let me know and I'll just wipe and reload at some point.

Essentially, I'm not bothered about this issue being investigated/solved for my own purposes, but if you feel it may be useful to pursue this possible bug in terms of the wider community, then I'm more than happy to keep the current install as-is for the moment, with a view to assisting with that process.

As regards the snapping of my own application, thanks for the heads-up about the forum. I did raise a question there several weeks ago, but in the end it just wasn't worth the time/hassle to sort it out. I'm sure the issues I were having were just the result of me somehow messing it up, and the app in question was just a demo thing that I doubt anyone would really be interested in. It was just a preliminary experimentation using snap really (a very exciting distribution method, that I look forward to playing with again soon!).

Revision history for this message
Sebastien Bacher (seb128) wrote :

If you could keep the system in that state to help debugging the issue that would be great. The backtrace has the debug info now and we are looking at the problem but might need more details later or somebody to test a potential fix one we have one, you should have updates on that bug in the next days in any case.

Revision history for this message
Dan (aninstanceofi) wrote :

That's great, no problem at all, I'll keep the system as-is.

Just give me a shout if and when you need more details or testing; delighted to help out.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Hi Dan,

Could you attach the raw output after running this command? It will access snapd and get the list of snaps you have installed. The stacktrace is suggesting you have a snap without a name. I've seen similar issues show up in automatic crash reports but never been able to work out why this might occur.

$ nc -C -U /run/snapd.socket
GET /v2/snaps HTTP/1.1
Host:

Revision history for this message
Dan (aninstanceofi) wrote :

Think you're nailing it. The output references the snap I was attempting to create one evening, before I abandoned the experiment and deleted it (as referenced above). It was called "nominal-roll-generator".

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Thanks Dan! Looks like snapd can return broken snaps we're not handling. The JSON for the broken snap is:
{
 "apps":[{"snap":"nominal-roll-generator","name":"node-service"}],
 "broken":"cannot read snap \"nominal-roll-generator\": cannot find installed snap \"nominal-roll-generator\" at revision x20",
 "channel":"",
 "confinement":"",
 "contact":"",
 "description":"",
 "developer":"",
 "devmode":true,
 "icon":"",
 "id":"",
 "install-date":"0001-01-01T00:00:00Z",
 "installed-size":0,
 "jailmode":false,
 "name":"nominal-roll-generator",
 "private":false,
 "resource":"/v2/snaps/nominal-roll-generator",
 "revision":"x20",
 "status":"active",
 "summary":"",
 "tracking-channel":"",
 "trymode":true,
 "type":"",
 "version":""
}

It's the blank type and id fields that is causing GNOME Software to crash. The "broken" field is a new one I haven't seen.

Revision history for this message
Dan (aninstanceofi) wrote :

Certainly looks like you've identified the issue, great!

Hopefully as far as Gnome Software is concerned, the fix would be relatively trivial then - i.e. handling the case where the "type" and "id" fields are empty ...

summary: - Software (gnome-software) crashes after several seconds. Entirely
- unusable.
+ Crashes if broken snaps installed
Changed in gnome-software (Ubuntu Artful):
importance: Undecided → High
Changed in gnome-software (Ubuntu Artful):
status: New → Fix Committed
Changed in gnome-software (Ubuntu Bionic):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-software - 3.26.1-0ubuntu3

---------------
gnome-software (3.26.1-0ubuntu3) bionic; urgency=medium

  * debian/patches/0001-snap-Don-t-crash-on-unknown-snap-types.patch:
    - Fix crash when broken snaps installed (LP: #1720442)

 -- Robert Ancell <email address hidden> Thu, 26 Oct 2017 14:04:03 +1300

Changed in gnome-software (Ubuntu Bionic):
status: Fix Committed → Fix Released
description: updated
Revision history for this message
Sebastien Bacher (seb128) wrote :

Robert, when do you plan to SRU to 17.10?

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Dan, or anyone else affected,

Accepted gnome-software into artful-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gnome-software/3.26.1-0ubuntu2.17.10.1 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-artful to verification-done-artful. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-artful. In either case, details of your testing will help us make a better decision.

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-artful
Revision history for this message
Dan (aninstanceofi) wrote :

Hello,

The fix works perfectly on my system, using:

gnome-software 3.26.1-0ubuntu2.17.10.1

Great stuff, thanks to everyone who worked to fix this bug (and the many thousands of others!).

tags: added: verification-done-artful
removed: verification-needed-artful
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-software - 3.26.1-0ubuntu2.17.10.1

---------------
gnome-software (3.26.1-0ubuntu2.17.10.1) artful; urgency=medium

  [ Robert Ancell ]
  * debian/patches/0001-snap-Don-t-crash-on-unknown-snap-types.patch:
    - Fix crash when broken snaps installed (LP: #1720442)
  * debian/patches/0001-snap-Protect-store-cache-with-a-lock.patch:
    - Fix crash due to multiple threads accessing a cache (LP: #1716633)
  * debian/patches/0001-snap-Don-t-attempt-to-refine-snaps-without-a-valid-n.patch:
    - Fix potential crash from invalid snaps
  * debian/patches/0001-snap-Remove-unused-variables.patch:
    - Trivial patch added to make above patches apply cleanly
  * debian/patches/0001-Add-a-cancellable-to-GsApp-objects.patch:
  * debian/patches/0001-Allow-to-cancel-app-ops-in-the-details-view-that-wer.patch:
    - Fix cancelling with multiple installs (LP: #1722183)
  * debian/control:
    - Add Vcs-Bzr link

  [ Jeremy Bicha ]
  * Cherry-pick 0001-Don-t-error-out-for-over-500-results.patch:
    - Fix empty Addons > Shell Extensions category (LP: #1722809)

 -- Robert Ancell <email address hidden> Wed, 15 Nov 2017 11:58:57 +1300

Changed in gnome-software (Ubuntu Artful):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

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.

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

Other bug subscribers

Remote bug watches

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