Snapd, occationally, has high CPU consumption

Greetings

My PC will, on occations (every other day or so), grind to a halt and this time I noticed that snapd consumed more than one CPU core. A reboot will solve the immediate issue, but I’d still like to figure out how to fix it :slight_smile:

Dropping to another tty i was able to capture this from Htop:

I have not had the patience to wait it out yet, but have been able to reboot using the REISUB method.

I’m running Kubuntu and, because of hardware issues (bluetooth), I have installed a newer kernel.

:~$ sudo snap version

snap 2.58 snapd 2.58 series 16 ubuntu 22.10 kernel 6.0.9-060009-generic

:~$ uname -a

Linux my-PC 6.0.9-060009-generic #202211161102 SMP PREEMPT_DYNAMIC Wed Nov 16 12:14:18 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

:~$ snap changes

ID Status Spawn Ready Summary 43 Done today at 06:08 CET today at 06:08 CET Auto-refresh snap “firefox”

:~$ sudo snap debug state /var/lib/snapd/state.json

ID Status Spawn Ready Label Summary 43 Done today at 06:08 CET today at 06:08 CET auto-refresh Auto-refresh snap “firefox”

I recently changed the release channel for the Firefox snap, but the issue preceeds this change - although I don’t have data pointing to snapd before today.

:~$ snap info firefox

name: firefox summary: Mozilla Firefox web browser publisher: Mozilla✓ store-url: Install firefox on Linux | Snap Store contact: https://support.mozilla.org/kb/file-bug-report-or-feature-request-mozilla license: unset description: | Firefox is a powerful, extensible web browser with support for modern web application technologies. commands:

  • firefox
  • firefox.geckodriver snap-id: 3wdHCAVyZEmYsCMFDE9qt92UV8rC8Wdk tracking: latest/beta refresh-date: today at 06:08 CET channels: latest/stable: 109.0.1-1 2023-01-31 (2311) 250MB - latest/candidate: 109.0.1-1 2023-01-28 (2311) 250MB - latest/beta: 110.0b9-1 2023-02-03 (2330) 189MB - latest/edge: 111.0a1 2023-02-03 (2332) 196MB - esr/stable: 102.7.0esr-1 2023-01-17 (2270) 183MB - esr/candidate: 102.7.0esr-1 2023-01-09 (2270) 183MB - esr/beta: ↑
    esr/edge: ↑
    installed: 110.0b9-1 (2330) 189MB -

journalctl --system -u snapd

– Boot 4a5624256a304fc8a26968dbe570eb34 – feb. 03 06:03:20 my-PC systemd[1]: Starting Snap Daemon… feb. 03 06:03:20 my-PC snapd[758]: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network feb. 03 06:03:21 my-PC snapd[758]: overlord.go:268: Acquiring state lock file feb. 03 06:03:21 my-PC snapd[758]: overlord.go:273: Acquired state lock file feb. 03 06:03:21 my-PC snapd[758]: daemon.go:247: started snapd/2.58 (series 16; classic; devmode) ubuntu/22.10 (amd64) linux/6.0.9-060009-generic. feb. 03 06:03:21 my-PC snapd[758]: daemon.go:340: adjusting startup timeout by 1m25s (pessimistic estimate of 30s plus 5s per snap) feb. 03 06:03:21 my-PC snapd[758]: backends.go:58: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network feb. 03 06:03:21 my-PC systemd[1]: Started Snap Daemon. feb. 03 06:08:23 my-PC snapd[758]: storehelpers.go:769: cannot refresh: snap has no updates available: “bare”, “code-insiders”, “core”, “core18”, “core20”, “gnome-3-28-1804”, “gnome-3-38-2004”, “gtk-common-themes”, “hunspell-dictionaries-1-7-2004”, “snapd” feb. 03 06:08:33 my-PC snapd[758]: storehelpers.go:769: cannot refresh snap “firefox”: snap has no updates available – Boot e91aac9f243a4e0f899d4a19bdf6aa14 – feb. 03 06:52:02 my-PC systemd[1]: Starting Snap Daemon… feb. 03 06:52:02 my-PC snapd[769]: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network feb. 03 06:52:03 my-PC snapd[769]: overlord.go:268: Acquiring state lock file feb. 03 06:52:03 my-PC snapd[769]: overlord.go:273: Acquired state lock file feb. 03 06:52:03 my-PC snapd[769]: daemon.go:247: started snapd/2.58 (series 16; classic; devmode) ubuntu/22.10 (amd64) linux/6.0.9-060009-generic. feb. 03 06:52:03 my-PC snapd[769]: daemon.go:340: adjusting startup timeout by 1m25s (pessimistic estimate of 30s plus 5s per snap) feb. 03 06:52:03 my-PC snapd[769]: backends.go:58: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network feb. 03 06:52:03 my-PC systemd[1]: Started Snap Daemon.

:~$ snap list

Name Version Rev Tracking Publisher Notes bare 1.0 5 latest/stable canonical✓ base code-insiders e2816fe7 1209 latest/stable vscode✓ classic core 16-2.58 14447 latest/stable canonical✓ core core18 20230118 2679 latest/stable canonical✓ base core20 20221212 1778 latest/stable canonical✓ base firefox 110.0b9-1 2330 latest/beta mozilla✓ - gnome-3-28-1804 3.28.0-19-g98f9e67.98f9e67 161 latest/stable canonical✓ - gnome-3-38-2004 0+git.6f39565 119 latest/stable/… canonical✓ - gtk-common-themes 0.1-81-g442e511 1535 latest/stable/… canonical✓ - hunspell-dictionaries-1-7-2004 1.7-20.04+pkg-6fd6 2 latest/stable brlin - snapd 2.58 17950 latest/stable canonical✓ snapd

Edit1: formatting

Edit 2: Another freeze:

Waited this one out: Note: The Vivaldi browser froze at the same time and I had to force quit it.

The PC became unresponsive and the fan ramped up. Went away for about 4 minutes and the fan had slowed down.

~$ journalctl --system -f -u snapd

feb. 03 10:59:33 my-PC systemd[1]: Stopped Snap Daemon. feb. 03 10:59:33 my-PC systemd[1]: snapd.service: Consumed 57.858s CPU time. feb. 03 10:59:40 my-PC systemd[1]: Starting Snap Daemon… feb. 03 11:00:36 my-PC snapd[23561]: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network feb. 03 11:00:37 my-PC snapd[23561]: overlord.go:268: Acquiring state lock file feb. 03 11:00:37 my-PC snapd[23561]: overlord.go:273: Acquired state lock file feb. 03 11:00:37 my-PC snapd[23561]: daemon.go:247: started snapd/2.58 (series 16; classic; devmode) ubuntu/22.10 (amd64) linux/6.0.9-060009-generic. feb. 03 11:00:37 my-PC snapd[23561]: daemon.go:340: adjusting startup timeout by 1m25s (pessimistic estimate of 30s plus 5s per snap) feb. 03 11:00:37 my-PC snapd[23561]: backends.go:58: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network feb. 03 11:00:37 my-PC systemd[1]: Started Snap Daemon.

thank you & regards,

Morten

This seems to be a mainline kernel build, these are solely for testing single bug fixes, they miss a lot of security patches (snap related ones among them), do not use the ubuntu config and will not be updated at all (you will forever be stuck with that version) … behavior like the above is actually expected with these kernels, please switch to a supported one (6.x should soon be available as hwe kernel)

See: https://wiki.ubuntu.com/KernelTeam/MainlineBuilds

and: https://wiki.ubuntu.com/Kernel/LTSEnablementStack

Thanks, that makes sens.

I’ll revert to the default kernel.

1 Like