如何在刷新 Ubuntu Snap 包时详细说明?

如何在刷新 Ubuntu Snap 包时详细说明?

我想在更新 snap 包时查看所有日志和更改,就像 一样sudo apt update && sudo apt upgrade。我习惯sudo snap refresh手动升级它们,但没有开关可以查看更多日志和应用更改。

Download snap "snapd" (19993) from channel "latest/stable" 17% 1.74MB/s 17.0s
Download snap "snapd" (19993) from channel "latest/stable" 22% 1.48MB/s 18.7s
Download snap "snapd" (19993) from channel "latest/stable" 22% 1.33MB/s 20.8s
Download snap "snapd" (19993) from channel "latest/stable" 22% 1.03MB/s 26.8s
Download snap "snapd" (19993) from channel "latest/stable" 48%  656kB/s 28.2s
Download snap "snapd" (19993) from channel "latest/stable" 53%  689kB/s 24.6s
Download snap "snapd" (19993) from channel "latest/stable" 59%  748kB/s 19.5s
Download snap "snapd" (19993) from channel "latest/stable" 84%  948kB/s 5.90s
Download snap "snapd" (19993) from channel "latest/stable" 92%  984kB/s 3.03s
2023-08-22T22:09:50+03:30 INFO Waiting for automatic snapd restart...
snapd 2.60.2 from Canonical✓ refreshed

命令的输出sudo snap refresh --help

[refresh command options]
      --color=[auto|never|always]          Use a little bit of color to highlight some things. (default: auto)
      --unicode=[auto|never|always]        Use a little bit of Unicode to improve legibility. (default: auto)
      --abs-time                           Display absolute times (in RFC 3339 format). Otherwise, display relative
                                           times up to 60 days, then YYYY-MM-DD.
      --no-wait                            Do not wait for the operation to finish but just print the change id.
      --channel=                           Use this channel instead of stable
      --edge                               Install from the edge channel
      --beta                               Install from the beta channel
      --candidate                          Install from the candidate channel
      --stable                             Install from the stable channel
      --devmode                            Put snap in development mode and disable security confinement
      --jailmode                           Put snap in enforced confinement mode
      --classic                            Put snap in classic mode and disable security confinement
      --amend                              Allow refresh attempt on snap unknown to the store
      --revision=                          Refresh to the given revision
      --cohort=                            Refresh the snap into the given cohort
      --leave-cohort                       Refresh the snap out of its cohort
      --list                               Show the new versions of snaps that would be updated with the next refresh
      --time                               Show auto refresh information but do not perform a refresh
      --ignore-validation                  Ignore validation by other snaps blocking the refresh
      --transaction=[all-snaps|per-snap]   Have one transaction per-snap or one for all the specified snaps (default:
                                           per-snap)
      --hold=                              Hold refreshes for a specified duration (or forever, if no value is
                                           specified)
      --unhold                             Remove refresh hold

我应该怎么办?

答案1

snap changes(不是“snap refresh changes”)将列出最近的安装、刷新和删除。“最近”表示 snapd 的同一会话。

下面是展示今天的删除、刷新和安装操作的示例:

                                 # snapd refreshed and restarted earlier
$ snap changes                   # today so older data is lost
ID   Status  Spawn               Ready               Summary
272  Done    today at 10:05 CDT  today at 10:05 CDT  Auto-refresh snap "rpi-imager"
273  Done    today at 14:13 CDT  today at 14:13 CDT  Remove "rpi-imager" snap
274  Done    today at 14:16 CDT  today at 14:17 CDT  Refresh snap "snapd"
275  Done    today at 14:23 CDT  today at 14:23 CDT  Install "rpi-imager" snap

记下 ID 号。如果我们想要更详细的信息,我们可以使用该号码:

$ sudo snap change 271             # You cannot use the ID Number to see older changes
error: cannot find change with id "271"


$ sudo snap change 275
Status  Spawn               Ready               Summary
Done    today at 14:23 CDT  today at 14:23 CDT  Ensure prerequisites for "rpi-imager" are available
Done    today at 14:23 CDT  today at 14:23 CDT  Download snap "rpi-imager" (465) from channel "stable"
Done    today at 14:23 CDT  today at 14:23 CDT  Fetch and check assertions for snap "rpi-imager" (465)
Done    today at 14:23 CDT  today at 14:23 CDT  Mount snap "rpi-imager" (465)
Done    today at 14:23 CDT  today at 14:23 CDT  Copy snap "rpi-imager" data
Done    today at 14:23 CDT  today at 14:23 CDT  Setup snap "rpi-imager" (465) security profiles
Done    today at 14:23 CDT  today at 14:23 CDT  Make snap "rpi-imager" (465) available to the system
Done    today at 14:23 CDT  today at 14:23 CDT  Automatically connect eligible plugs and slots of snap "rpi-imager"
Done    today at 14:23 CDT  today at 14:23 CDT  Set automatic aliases for snap "rpi-imager"
Done    today at 14:23 CDT  today at 14:23 CDT  Setup snap "rpi-imager" aliases
Done    today at 14:23 CDT  today at 14:23 CDT  Run install hook of "rpi-imager" snap if present
Done    today at 14:23 CDT  today at 14:23 CDT  Run default-configure hook of "rpi-imager" snap if present
Done    today at 14:23 CDT  today at 14:23 CDT  Start snap "rpi-imager" (465) services
Done    today at 14:23 CDT  today at 14:23 CDT  Run configure hook of "rpi-imager" snap if present
Done    today at 14:23 CDT  today at 14:23 CDT  Run health check of "rpi-imager" snap
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:udisks2 to snapd:udisks2
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:gsettings to snapd:gsettings
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:gtk-3-themes to gtk-common-themes:gtk-3-themes
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:hardware-observe to snapd:hardware-observe
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:home to snapd:home
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:icon-themes to gtk-common-themes:icon-themes
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:sound-themes to gtk-common-themes:sound-themes
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:wayland to snapd:wayland
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:x11 to snapd:x11
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:desktop to snapd:desktop
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:desktop-legacy to snapd:desktop-legacy
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:opengl to snapd:opengl
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:mount-observe to snapd:mount-observe
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:network to snapd:network
Done    today at 14:23 CDT  today at 14:23 CDT  Connect rpi-imager:removable-media to snapd:removable-media
Done    today at 14:23 CDT  today at 14:23 CDT  Setup snap "rpi-imager" (465) security profiles for auto-connections

目前,安装、刷新和删除信息仅可从 snapd 获取。这些信息未记录在日志或系统日志中。但是,当刷新不可用时,情况正好相反:snap changes没有任何提示,但会记录检查。

$ journalctl --unit=snapd --lines=1
Aug 22 14:24:25 my-system snapd[338944]: storehelpers.go:773: cannot refresh: snap has no updates available: "bare", "core", "core20", "core22", "cups", "discord", "firefox", "gnome-3-38-2004", "gnome-42-2204", "gtk-common-themes", "gtk2-common-themes", "hunspell-dictionaries-1-7-2004", "inkscape", "lxd", "rpi-imager", "snapd", "snapd-desktop-integration", "thunderbird"

$ grep snapd /var/log/syslog | tail -n1
2023-08-22T14:24:25.365238-05:00 my-system snapd[338944]: storehelpers.go:773: cannot refresh: snap has no updates available: "bare", "core", "core20", "core22", "cups", "discord", "firefox", "gnome-3-38-2004", "gnome-42-2204", "gtk-common-themes", "gtk2-common-themes", "hunspell-dictionaries-1-7-2004", "inkscape", "lxd", "rpi-imager", "snapd", "snapd-desktop-integration", "thunderbird"

相关内容