Score:17

Why does "Software Updater" say when performing updates that it is "updating snaps" when in reality it is not?

us flag

I always wonder why the Software Updater tool ("update-manager") does say "Updating snaps" for a few seconds after performing package updates when actually it does not do such things.

Instead, after Software Updater is finished, I often enter "sudo snap refresh" in the terminal to find out that there are snap updates available and have them updated. (If I don't do this, snap updates will be installed automatically some time later, but I prefer to get all recent updates before I start working and not while I am working.)

Using Ubuntu 22.04, but it always was the same with 20.04.

us flag
Are you sure? popeys answer sounds more convincing.
Score:21
pl flag

I think the "Updating snaps" line is misleading. It's not doing what you think - and not what any reasonable person - would expect.

I took a look at the code for update-manager, and while I'm no developer, I think I understand what's going on.

The code looks like it says "Updating snaps" then proceeds to get a list of snaps which are being migrated from deb to snap - such as lxd, firefox and chromium-browser. It then processes them, if there are any, then moves on. It doesn't process any already-installed snaps, as you might expect.

The message "Updating snaps" should probably be something like "Processing deb to snap migrations" or similar.

Here's the code.

    def update_snaps(self):
        # update status and progress bar
        def update_status(status):
            GLib.idle_add(self.label_details.set_label, status)

        def update_progress(progress_bar):
            progress_bar.pulse()
            return True

        update_status(_("Updating snaps"))

        progress_bar = None
        progress_timer = None

        progress_bars = self.progressbar_slot.get_children()
        if progress_bars and isinstance(progress_bars[0], Gtk.ProgressBar):
            progress_bar = progress_bars[0]
            progress_timer = GLib.timeout_add(100, update_progress,
                                              progress_bar)

        # populate snap_list with deb2snap transitions
        snap_list = self.get_snap_transitions()

        if progress_timer:
            GLib.source_remove(progress_timer)
            progress_bar.set_fraction(0)

        # (un)install (un)seeded snap(s)
        try:
            client = Snapd.Client()
            client.connect_sync()
            index = 0
            count = len(snap_list)
            for snap, snap_object in snap_list.items():
                command = snap_object['command']
                if command == 'refresh':
                    update_status(_("Refreshing %s snap" % snap))
                    client.refresh_sync(snap, snap_object['channel'],
                                        self.update_snap_cb,
                                        progress_callback_data=(index, count,
                                                                progress_bar))
                elif command == 'remove':
                    update_status(_("Removing %s snap" % snap))
                    client.remove_sync(snap, self.update_snap_cb,
                                       progress_callback_data=(index, count,
                                                               progress_bar))
                else:
                    update_status(_("Installing %s snap" % snap))
                    client.install_sync(snap, snap_object['channel'],
                                        self.update_snap_cb,
                                        progress_callback_data=(index, count,
                                                                progress_bar))
                index += 1
        except GLib.Error as e:
            logging.debug("error updating snaps (%s)" % e)
            GLib.idle_add(self.window_main.start_error, False,
                          _("Upgrade only partially completed."),
                          _("An error occurred while updating snaps. "
                            "Please check your network connection."))
            return

        # continue with the rest of the updates
        GLib.idle_add(self.window_main.start_available)
AlexP avatar
in flag
Oh, it does not "get a list of snaps which are being migrated from deb to snap". At least in Ubuntu 22.04, it has such a list built in and blindly tries to update them without bothering to find out whether they are actually present on the system or not.
us flag
Well, at least my question is answered: The software updater is not supposed to do what I (we) think it does when it says "Updating spaps". Someone should fix the wording of the message.
user535733 avatar
cn flag
@w-sky we nominate you to be "someone." If you care enough to complain, then you care enough to file the bug report.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.