snapd panic: runtime error: slice bounds out of range [2:1]

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

Bug Description

I installed a local snap (cloud-image-manager from the CPC team) and now it's impossible to start the snapd daemon anymore. "systemctl restart snapd.service" ends up in "Failed to start Snap Daemon.":

$ sudo systemctl restart snapd
Jan 20 13:20:14 ip-172-31-25-80 systemd[1]: Starting Snap Daemon...
Jan 20 13:20:14 ip-172-31-25-80 snapd[9941]: AppArmor status: apparmor is enabled and all features are available
Jan 20 13:20:14 ip-172-31-25-80 snapd[9941]: overlord.go:268: Acquiring state lock file
Jan 20 13:20:14 ip-172-31-25-80 snapd[9941]: overlord.go:273: Acquired state lock file
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: daemon.go:247: started snapd/2.58 (series 16; classic) ubuntu/18.04 (amd64) linux/5.4.0-1093-aws.
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: daemon.go:340: adjusting startup timeout by 1m0s (pessimistic estimate of 30s plus 5s per snap)
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: backends.go:58: AppArmor status: apparmor is enabled and all features are available
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: Started Snap Daemon.
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: panic: runtime error: slice bounds out of range [2:1]
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: goroutine 53 [running]:
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: github.com/snapcore/snapd/overlord/snapstate.(*SnapManager).undoLinkSnap(0xc00031c0c0, 0xc0002d9560, 0xc0000b65f0, 0x0, 0x0)
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: /build/snapd-RQZPrz/snapd-2.58/overlord/snapstate/handlers.go:2186 +0x2167
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: github.com/snapcore/snapd/overlord/state.(*TaskRunner).run.func1(0x0, 0x0)
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: /build/snapd-RQZPrz/snapd-2.58/overlord/state/taskrunner.go:215 +0xca
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: gopkg.in/tomb%2ev2.(*Tomb).run(0xc0000b65f0, 0xc0006abd70)
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x2d
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: created by gopkg.in/tomb%2ev2.(*Tomb).Go
Jan 20 13:20:15 ip-172-31-25-80 snapd[9941]: /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:159 +0xc9
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: snapd.service: Failed with result 'exit-code'.
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: snapd.service: Service hold-off time over, scheduling restart.
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 1.
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: Stopped Snap Daemon.
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: Starting Snap Daemon...
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: AppArmor status: apparmor is enabled and all features are available
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: overlord.go:268: Acquiring state lock file
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: overlord.go:273: Acquired state lock file
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: daemon.go:247: started snapd/2.58 (series 16; classic) ubuntu/18.04 (amd64) linux/5.4.0-1093-aws.
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: daemon.go:340: adjusting startup timeout by 1m0s (pessimistic estimate of 30s plus 5s per snap)
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: backends.go:58: AppArmor status: apparmor is enabled and all features are available
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: Started Snap Daemon.
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: panic: runtime error: slice bounds out of range [2:1]
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: goroutine 48 [running]:
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: github.com/snapcore/snapd/overlord/snapstate.(*SnapManager).undoLinkSnap(0xc0003140c0, 0xc0002e90e0, 0xc0000aed20, 0x0, 0x0)
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: /build/snapd-RQZPrz/snapd-2.58/overlord/snapstate/handlers.go:2186 +0x2167
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: github.com/snapcore/snapd/overlord/state.(*TaskRunner).run.func1(0x0, 0x0)
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: /build/snapd-RQZPrz/snapd-2.58/overlord/state/taskrunner.go:215 +0xca
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: gopkg.in/tomb%2ev2.(*Tomb).run(0xc0000aed20, 0xc000666840)
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x2d
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: created by gopkg.in/tomb%2ev2.(*Tomb).Go
Jan 20 13:20:15 ip-172-31-25-80 snapd[10051]: /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:159 +0xc9
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: snapd.service: Failed with result 'exit-code'.
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: snapd.service: Service hold-off time over, scheduling restart.
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 2.
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: Stopped Snap Daemon.
Jan 20 13:20:15 ip-172-31-25-80 systemd[1]: Starting Snap Daemon...
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: AppArmor status: apparmor is enabled and all features are available
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: overlord.go:268: Acquiring state lock file
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: overlord.go:273: Acquired state lock file
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: daemon.go:247: started snapd/2.58 (series 16; classic) ubuntu/18.04 (amd64) linux/5.4.0-1093-aws.
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: daemon.go:340: adjusting startup timeout by 1m0s (pessimistic estimate of 30s plus 5s per snap)
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: backends.go:58: AppArmor status: apparmor is enabled and all features are available
Jan 20 13:20:16 ip-172-31-25-80 systemd[1]: Started Snap Daemon.
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: panic: runtime error: slice bounds out of range [2:1]
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: goroutine 55 [running]:
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: github.com/snapcore/snapd/overlord/snapstate.(*SnapManager).undoLinkSnap(0xc000450280, 0xc0002286c0, 0xc000445220, 0x0, 0x0)
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: /build/snapd-RQZPrz/snapd-2.58/overlord/snapstate/handlers.go:2186 +0x2167
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: github.com/snapcore/snapd/overlord/state.(*TaskRunner).run.func1(0x0, 0x0)
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: /build/snapd-RQZPrz/snapd-2.58/overlord/state/taskrunner.go:215 +0xca
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: gopkg.in/tomb%2ev2.(*Tomb).run(0xc000445220, 0xc0007b0330)
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x2d
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: created by gopkg.in/tomb%2ev2.(*Tomb).Go
Jan 20 13:20:16 ip-172-31-25-80 snapd[10154]: /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:159 +0xc9
Jan 20 13:20:16 ip-172-31-25-80 systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 20 13:20:16 ip-172-31-25-80 systemd[1]: snapd.service: Failed with result 'exit-code'.
Jan 20 13:20:16 ip-172-31-25-80 systemd[1]: snapd.service: Service hold-off time over, scheduling restart.
Jan 20 13:20:16 ip-172-31-25-80 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 3.
Jan 20 13:20:16 ip-172-31-25-80 systemd[1]: Stopped Snap Daemon.
Jan 20 13:20:16 ip-172-31-25-80 systemd[1]: Starting Snap Daemon...
Jan 20 13:20:16 ip-172-31-25-80 snapd[10253]: AppArmor status: apparmor is enabled and all features are available
Jan 20 13:20:16 ip-172-31-25-80 snapd[10253]: overlord.go:268: Acquiring state lock file
Jan 20 13:20:16 ip-172-31-25-80 snapd[10253]: overlord.go:273: Acquired state lock file
Jan 20 13:20:16 ip-172-31-25-80 snapd[10253]: daemon.go:247: started snapd/2.58 (series 16; classic) ubuntu/18.04 (amd64) linux/5.4.0-1093-aws.
Jan 20 13:20:16 ip-172-31-25-80 snapd[10253]: daemon.go:340: adjusting startup timeout by 1m0s (pessimistic estimate of 30s plus 5s per snap)
Jan 20 13:20:16 ip-172-31-25-80 snapd[10253]: backends.go:58: AppArmor status: apparmor is enabled and all features are available
Jan 20 13:20:16 ip-172-31-25-80 systemd[1]: Started Snap Daemon.
Jan 20 13:20:17 ip-172-31-25-80 snapd[10253]: panic: runtime error: slice bounds out of range [2:1]
Jan 20 13:20:17 ip-172-31-25-80 snapd[10253]: goroutine 31 [running]:
Jan 20 13:20:17 ip-172-31-25-80 snapd[10253]: github.com/snapcore/snapd/overlord/snapstate.(*SnapManager).undoLinkSnap(0xc0003200c0, 0xc0002f3680, 0xc0004f4910, 0x0, 0x0)
Jan 20 13:20:17 ip-172-31-25-80 snapd[10253]: /build/snapd-RQZPrz/snapd-2.58/overlord/snapstate/handlers.go:2186 +0x2167
Jan 20 13:20:17 ip-172-31-25-80 snapd[10253]: github.com/snapcore/snapd/overlord/state.(*TaskRunner).run.func1(0x0, 0x0)
Jan 20 13:20:17 ip-172-31-25-80 snapd[10253]: /build/snapd-RQZPrz/snapd-2.58/overlord/state/taskrunner.go:215 +0xca
Jan 20 13:20:17 ip-172-31-25-80 snapd[10253]: gopkg.in/tomb%2ev2.(*Tomb).run(0xc0004f4910, 0xc0006c40c0)
Jan 20 13:20:17 ip-172-31-25-80 snapd[10253]: /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x2d
Jan 20 13:20:17 ip-172-31-25-80 snapd[10253]: created by gopkg.in/tomb%2ev2.(*Tomb).Go
Jan 20 13:20:17 ip-172-31-25-80 snapd[10253]: /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:159 +0xc9
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Failed with result 'exit-code'.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Service hold-off time over, scheduling restart.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 4.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: Stopped Snap Daemon.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: Starting Snap Daemon...
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: AppArmor status: apparmor is enabled and all features are available
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: overlord.go:268: Acquiring state lock file
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: overlord.go:273: Acquired state lock file
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: daemon.go:247: started snapd/2.58 (series 16; classic) ubuntu/18.04 (amd64) linux/5.4.0-1093-aws.
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: daemon.go:340: adjusting startup timeout by 1m0s (pessimistic estimate of 30s plus 5s per snap)
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: backends.go:58: AppArmor status: apparmor is enabled and all features are available
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: Started Snap Daemon.
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: panic: runtime error: slice bounds out of range [2:1]
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: goroutine 54 [running]:
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: github.com/snapcore/snapd/overlord/snapstate.(*SnapManager).undoLinkSnap(0xc0003180c0, 0xc0002e58c0, 0xc0000b6910, 0x0, 0x0)
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: /build/snapd-RQZPrz/snapd-2.58/overlord/snapstate/handlers.go:2186 +0x2167
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: github.com/snapcore/snapd/overlord/state.(*TaskRunner).run.func1(0x0, 0x0)
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: /build/snapd-RQZPrz/snapd-2.58/overlord/state/taskrunner.go:215 +0xca
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: gopkg.in/tomb%2ev2.(*Tomb).run(0xc0000b6910, 0xc00070aab0)
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x2d
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: created by gopkg.in/tomb%2ev2.(*Tomb).Go
Jan 20 13:20:17 ip-172-31-25-80 snapd[10348]: /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:159 +0xc9
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Failed with result 'exit-code'.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Service hold-off time over, scheduling restart.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 5.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: Stopped Snap Daemon.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Start request repeated too quickly.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Failed with result 'exit-code'.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: Failed to start Snap Daemon.
Jan 20 13:20:17 ip-172-31-25-80 systemd[1]: snapd.service: Triggering OnFailure= dependencies.

This is with:

$ apt-cache policy snapd
snapd:
  Installed: 2.57.5+18.04ubuntu0.1
  Candidate: 2.57.5+18.04ubuntu0.1
  Version table:
 *** 2.57.5+18.04ubuntu0.1 500
        500 http://cn-north-1b.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2.32.5+18.04 500
        500 http://cn-north-1b.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: snapd 2.57.5+18.04ubuntu0.1
ProcVersionSignature: Ubuntu 5.4.0-1093.102~18.04.2-aws 5.4.218
Uname: Linux 5.4.0-1093-aws x86_64
ApportVersion: 2.20.9-0ubuntu7.28
Architecture: amd64
Date: Fri Jan 20 13:14:34 2023
Ec2AMI: ami-05596fb52c3802012
Ec2AMIManifest: (unknown)
Ec2AvailabilityZone: cn-north-1b
Ec2InstanceType: m5a.large
Ec2Kernel: unavailable
Ec2Ramdisk: unavailable
SourcePackage: snapd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Thomas Bechtold (toabctl) wrote :
Revision history for this message
Thomas Bechtold (toabctl) wrote :

A simple reproducer on that machine is:

root@ip-172-31-25-80:~# /usr/lib/snapd/snapd -h
AppArmor status: apparmor is enabled and all features are available
2023/01/20 13:23:22.763615 overlord.go:268: Acquiring state lock file
2023/01/20 13:23:22.763675 overlord.go:273: Acquired state lock file
2023/01/20 13:23:22.820441 daemon.go:247: started snapd/2.58 (series 16; classic) ubuntu/18.04 (amd64) linux/5.4.0-1093-aws.
2023/01/20 13:23:22.880812 daemon.go:340: adjusting startup timeout by 1m0s (pessimistic estimate of 30s plus 5s per snap)
2023/01/20 13:23:22.907182 backends.go:58: AppArmor status: apparmor is enabled and all features are available
panic: runtime error: slice bounds out of range [2:1]

goroutine 51 [running]:
github.com/snapcore/snapd/overlord/snapstate.(*SnapManager).undoLinkSnap(0xc000086100, 0xc000335440, 0xc0000bda90, 0x0, 0x0)
 /build/snapd-RQZPrz/snapd-2.58/overlord/snapstate/handlers.go:2186 +0x2167
github.com/snapcore/snapd/overlord/state.(*TaskRunner).run.func1(0x0, 0x0)
 /build/snapd-RQZPrz/snapd-2.58/overlord/state/taskrunner.go:215 +0xca
gopkg.in/tomb%2ev2.(*Tomb).run(0xc0000bda90, 0xc00072ffb0)
 /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x2d
created by gopkg.in/tomb%2ev2.(*Tomb).Go
 /build/snapd-RQZPrz/snapd-2.58/vendor/gopkg.in/tomb.v2/tomb.go:159 +0xc9

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.