Snap inoperable on upgrade: Failed to lock state file/restart snapd.mounts-pre.target

Bug #2065576 reported by Cedders
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
New
Undecided
Unassigned

Bug Description

The first symptom of this that I noticed yesterday was when installing and upgrading packages with synaptic. The system seemed to hang for some minutes on a hook related to snapd, with a message like:

> Failed to restart snapd.mounts-pre.target: Operation refused, unit snapd.mounts-pre.target may be requested by dependency only (it is configured to refuse manual start/stop).

Extracts of journal around that time:
May 12 20:40:54 cedric-x553sa snapd[1024]: main.go:151: Exiting on terminated signal.
May 12 20:40:57 cedric-x553sa snapd[1024]: overlord.go:515: Released state lock file
May 12 20:40:57 cedric-x553sa snapd[12216]: overlord.go:271: Acquiring state lock file
May 12 20:40:57 cedric-x553sa snapd[12216]: overlord.go:276: Acquired state lock file
May 12 20:40:57 cedric-x553sa snapd[12216]: patch.go:64: Patching system state level 6 to sublevel 1...
May 12 20:40:57 cedric-x553sa snapd[12216]: patch.go:64: Patching system state level 6 to sublevel 2...
May 12 20:40:57 cedric-x553sa snapd[12216]: patch.go:64: Patching system state level 6 to sublevel 3...
May 12 20:40:57 cedric-x553sa snapd[12216]: daemon.go:247: started snapd/2.62+22.04 (series 16; classic)>
May 12 20:40:57 cedric-x553sa snapd[12216]: daemon.go:340: adjusting startup timeout by 1m25s (pessimist>
May 12 20:40:58 cedric-x553sa snapd[12216]: backends.go:58: AppArmor status: apparmor is enabled and all>
May 12 20:42:35 cedric-x553sa snapd[12777]: overlord.go:271: Acquiring state lock file
May 12 20:42:35 cedric-x553sa snapd[12777]: overlord.go:252: Adjusting startup timeout by 1m0s
May 12 20:43:35 cedric-x553sa snapd[12777]: overlord.go:273: Failed to lock state file

From dpkg.log:
2024-05-12 20:40:38 startup packages configure
2024-05-12 20:40:38 configure snapd:amd64 2.62+22.04 <none>
2024-05-12 20:40:38 status unpacked snapd:amd64 2.62+22.04
2024-05-12 20:40:39 status half-configured snapd:amd64 2.62+22.04
2024-05-12 20:48:34 status installed snapd:amd64 2.62+22.04
2024-05-12 20:48:34 configure libglib2.0-0:amd64 2.72.4-0ubuntu2.3 <none>

This is the version I was upgrading from:
2024-05-04 08:10:20 status installed snapd:amd64 2.61.3+22.04
2024-05-12 20:40:23 upgrade snapd:amd64 2.61.3+22.04 2.62+22.04

With the same message logged every minute the system is awake:
May 12 20:40:57 cedric-x553sa snapd[12216]: daemon.go:340: adjusting startup timeout by 1m25s (pessimisti
c estimate of 30s plus 5s per snap)
May 12 20:40:58 cedric-x553sa snapd[12216]: backends.go:58: AppArmor status: apparmor is enabled and all features are available
May 12 20:42:35 cedric-x553sa snapd[12777]: overlord.go:271: Acquiring state lock file
May 12 20:42:35 cedric-x553sa snapd[12777]: overlord.go:252: Adjusting startup timeout by 1m0s
May 12 20:43:35 cedric-x553sa snapd[12777]: overlord.go:273: Failed to lock state file
May 12 20:43:35 cedric-x553sa snapd[12777]: cannot run daemon: fatal: could not lock state file: timeout for state lock file expired
May 12 20:43:36 cedric-x553sa snapd[13637]: overlord.go:271: Acquiring state lock file
May 12 20:43:36 cedric-x553sa snapd[13637]: overlord.go:252: Adjusting startup timeout by 1m0s
May 12 20:44:36 cedric-x553sa snapd[13637]: overlord.go:273: Failed to lock state file
May 12 20:44:36 cedric-x553sa snapd[13637]: cannot run daemon: fatal: could not lock state file: timeout for state lock file expired

Then the following morning I come to restart Firefox from the GUI and nothing happens. Message in the log is:
May 13 08:48:00 cedric-x553sa snapd[30528]: cannot run daemon: fatal: could not lock state file: timeout for state lock file expired

`journalctl -xeu` gives little extra info on the restarts:
May 13 08:50:02 cedric-x553sa systemd[1]: Starting Snap Daemon...
░░ Subject: A start job for unit snapd.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit snapd.service has begun execution.
░░
░░ The job identifier is 40288.
May 13 08:50:02 cedric-x553sa snapd[30651]: overlord.go:271: Acquiring state lock file
May 13 08:50:02 cedric-x553sa snapd[30651]: overlord.go:252: Adjusting startup timeout by 1m0s
May 13 08:51:02 cedric-x553sa snapd[30651]: overlord.go:273: Failed to lock state file
May 13 08:51:02 cedric-x553sa snapd[30651]: cannot run daemon: fatal: could not lock state file: timeout
for state lock file expired
May 13 08:51:02 cedric-x553sa systemd[1]: snapd.service: Main process exited, code=exited, status=1/FAILU
RE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit snapd.service has exited.

A process 'snap-failure' was present. I tried `systemctl restart snapd` and `systemctl restart snapd.apparmor`. Nothing looks abnormal in logs:
May 13 08:55:55 cedric-x553sa systemd[1]: tmp-syscheck\x2dmountpoint\x2d3295765805.mount: Deactivated successfully.
May 13 08:55:55 cedric-x553sa snapd[31733]: backends.go:58: AppArmor status: apparmor is enabled and all features are available

But I then get further (secondary?) problems:

$ snap refresh firefox
error: cannot communicate with server: Post "http://localhost/v2/snaps/firefox": dial unix /run/snapd.socket: connect: no such file or directory

$ firefox
error: cannot communicate with server: Post "http://localhost/v2/snapctl": dial unix /run/snapd-snap.socket: connect: no such file or directory
ERROR: not connected to the gnome-42-2204 content interface.

Also tried `systemctl start snapd.socket` and in desperation removing and unmounting contents of /run/snapd. There wasn't enough detail in the journal to suggest what else could be done, so I rebooted the system and now this browser launches OK.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: snapd 2.62+22.04
ProcVersionSignature: Ubuntu 5.19.0-35.36-generic 5.19.17
Uname: Linux 5.19.0-35-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: LXQt
Date: Mon May 13 10:18:20 2024
InstallationDate: Installed on 2022-03-11 (793 days ago)
InstallationMedia: Lubuntu 21.10 "Impish Indri" - Release amd64 (20211012)
Snap.Changes: no changes found
SourcePackage: snapd
UpgradeStatus: Upgraded to jammy on 2022-09-02 (618 days ago)

Revision history for this message
Cedders (cedric-gn) wrote :
description: updated
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.