Internal error, please report: running "code" failed: timeout waiting for snap system profiles to get updated

Whenever I trued to open code. I encounter with below :point_down: error.

internal error, please report: running “code” failed: timeout waiting for snap system profiles to get updated

I think, I have an issue with snapd.

systemctl status snapd.service

× snapd.service - Snap Daemon Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset:> Active: failed (Result: exit-code) since Sun 2023-12-17 22:25:02 IST; 2h 4> TriggeredBy: × snapd.socket Process: 1162 ExecStart=/usr/lib/snapd/snapd (code=exited, status=1/FAILURE) Main PID: 1162 (code=exited, status=1/FAILURE) CPU: 88ms

Dec 17 22:25:02 thedev systemd[1]: snapd.service: Scheduled restart job, restar> Dec 17 22:25:02 thedev systemd[1]: Stopped Snap Daemon. Dec 17 22:25:02 thedev systemd[1]: snapd.service: Start request repeated too qu> Dec 17 22:25:02 thedev systemd[1]: snapd.service: Failed with result 'exit-code> Dec 17 22:25:02 thedev systemd[1]: Failed to start Snap Daemon. Dec 17 22:25:02 thedev systemd[1]: snapd.service: Triggering OnFailure= depende>ESCOC

snap version :point_down: snap 2.59.5 snapd unavailable series -

Looks like the snapd daemon has exited with an error. Unfortunately the snippet you pasted does not contain any hint as to why this happened. Please attach the output of journalctl -u snapd.service --no-pager -n 100.

journalctl -u snapd.service --no-pager -n 100
Dec 17 22:24:59 thedev systemd[1]: Starting Snap Daemon...
Dec 17 22:25:00 thedev snapd[1055]: overlord.go:272: Acquiring state lock file
Dec 17 22:25:00 thedev snapd[1055]: overlord.go:277: Acquired state lock file
Dec 17 22:25:00 thedev snapd[1055]: cannot run daemon: cannot read state: unexpected EOF
Dec 17 22:25:00 thedev systemd[1]: snapd.service: Main process exited, code=exited, 
status=1/FAILURE
Dec 17 22:25:00 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 17 22:25:00 thedev systemd[1]: Failed to start Snap Daemon.
Dec 17 22:25:00 thedev systemd[1]: snapd.service: Scheduled restart job, restart counter is at 3.
Dec 17 22:25:00 thedev systemd[1]: Stopped Snap Daemon.
Dec 17 22:25:00 thedev systemd[1]: Starting Snap Daemon...
Dec 17 22:25:00 thedev snapd[1088]: overlord.go:272: Acquiring state lock file
Dec 17 22:25:00 thedev snapd[1088]: overlord.go:277: Acquired state lock file
Dec 17 22:25:00 thedev snapd[1088]: cannot run daemon: cannot read state: unexpected EOF
Dec 17 22:25:00 thedev systemd[1]: snapd.service: Main process exited, code=exited, 
status=1/FAILURE
Dec 17 22:25:00 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 17 22:25:00 thedev systemd[1]: Failed to start Snap Daemon.
Dec 17 22:25:00 thedev systemd[1]: snapd.service: Scheduled restart job, restart counter is at 4.
Dec 17 22:25:00 thedev systemd[1]: Stopped Snap Daemon.
Dec 17 22:25:00 thedev systemd[1]: Starting Snap Daemon...
Dec 17 22:25:00 thedev snapd[1121]: overlord.go:272: Acquiring state lock file
Dec 17 22:25:00 thedev snapd[1121]: overlord.go:277: Acquired state lock file
Dec 17 22:25:00 thedev snapd[1121]: cannot run daemon: cannot read state: unexpected EOF
Dec 17 22:25:01 thedev systemd[1]: snapd.service: Main process exited, code=exited, 
status=1/FAILURE
Dec 17 22:25:01 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 17 22:25:01 thedev systemd[1]: Failed to start Snap Daemon.
Dec 17 22:25:01 thedev systemd[1]: snapd.service: Scheduled restart job, restart counter is at 5.
Dec 17 22:25:01 thedev systemd[1]: Stopped Snap Daemon.
Dec 17 22:25:01 thedev systemd[1]: Starting Snap Daemon...
Dec 17 22:25:02 thedev snapd[1162]: overlord.go:272: Acquiring state lock file
Dec 17 22:25:02 thedev snapd[1162]: overlord.go:277: Acquired state lock file
Dec 17 22:25:02 thedev snapd[1162]: cannot run daemon: cannot read state: unexpected EOF
Dec 17 22:25:02 thedev systemd[1]: snapd.service: Main process exited, code=exited, 
status=1/FAILURE
Dec 17 22:25:02 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 17 22:25:02 thedev systemd[1]: Failed to start Snap Daemon.
Dec 17 22:25:02 thedev systemd[1]: snapd.service: Scheduled restart job, restart counter is at 6.
Dec 17 22:25:02 thedev systemd[1]: Stopped Snap Daemon.
Dec 17 22:25:02 thedev systemd[1]: snapd.service: Start request repeated too quickly.
Dec 17 22:25:02 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 17 22:25:02 thedev systemd[1]: Failed to start Snap Daemon.
Dec 17 22:25:02 thedev systemd[1]: snapd.service: Triggering OnFailure= dependencies.
-- Boot fd0b15abc726460489b7631337558efd --
Dec 18 11:07:37 thedev systemd[1]: Starting Snap Daemon...
Dec 18 11:07:52 thedev snapd[819]: overlord.go:272: Acquiring state lock file
Dec 18 11:07:52 thedev snapd[819]: overlord.go:277: Acquired state lock file
Dec 18 11:07:52 thedev snapd[819]: cannot run daemon: cannot read state: unexpected EOF
Dec 18 11:07:53 thedev systemd[1]: snapd.service: Main process exited, code=exited, status=1/FAILURE
Dec 18 11:07:53 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 18 11:07:53 thedev systemd[1]: Failed to start Snap Daemon.
Dec 18 11:07:53 thedev systemd[1]: snapd.service: Consumed 1.825s CPU time.
Dec 18 11:07:53 thedev systemd[1]: snapd.service: Scheduled restart job, restart counter is at 1.
Dec 18 11:07:53 thedev systemd[1]: Stopped Snap Daemon.
Dec 18 11:07:53 thedev systemd[1]: snapd.service: Consumed 1.825s CPU time.
Dec 18 11:07:53 thedev systemd[1]: Starting Snap Daemon...
Dec 18 11:07:53 thedev snapd[998]: overlord.go:272: Acquiring state lock file
Dec 18 11:07:53 thedev snapd[998]: overlord.go:277: Acquired state lock file
Dec 18 11:07:53 thedev snapd[998]: cannot run daemon: cannot read state: unexpected EOF
Dec 18 11:07:53 thedev systemd[1]: snapd.service: Main process exited, code=exited, status=1/FAILURE
Dec 18 11:07:53 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 18 11:07:53 thedev systemd[1]: Failed to start Snap Daemon.
Dec 18 11:07:53 thedev systemd[1]: snapd.service: Scheduled restart job, restart counter is at 2.
Dec 18 11:07:53 thedev systemd[1]: Stopped Snap Daemon.
Dec 18 11:07:53 thedev systemd[1]: Starting Snap Daemon...
Dec 18 11:07:54 thedev snapd[1033]: overlord.go:272: Acquiring state lock file
Dec 18 11:07:54 thedev snapd[1033]: overlord.go:277: Acquired state lock file
Dec 18 11:07:54 thedev snapd[1033]: cannot run daemon: cannot read state: unexpected EOF
Dec 18 11:07:54 thedev systemd[1]: snapd.service: Main process exited, code=exited, 
status=1/FAILURE
Dec 18 11:07:54 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 18 11:07:54 thedev systemd[1]: Failed to start Snap Daemon.
Dec 18 11:07:54 thedev systemd[1]: snapd.service: Scheduled restart job, restart counter is at 3.
Dec 18 11:07:54 thedev systemd[1]: Stopped Snap Daemon.
Dec 18 11:07:54 thedev systemd[1]: Starting Snap Daemon...
Dec 18 11:07:54 thedev snapd[1078]: overlord.go:272: Acquiring state lock file
Dec 18 11:07:54 thedev snapd[1078]: overlord.go:277: Acquired state lock file
Dec 18 11:07:54 thedev snapd[1078]: cannot run daemon: cannot read state: unexpected EOF
Dec 18 11:07:54 thedev systemd[1]: snapd.service: Main process exited, code=exited, 
status=1/FAILURE
Dec 18 11:07:54 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 18 11:07:54 thedev systemd[1]: Failed to start Snap Daemon.
Dec 18 11:07:54 thedev systemd[1]: snapd.service: Scheduled restart job, restart counter is at 4.
Dec 18 11:07:54 thedev systemd[1]: Stopped Snap Daemon.
Dec 18 11:07:54 thedev systemd[1]: Starting Snap Daemon...
Dec 18 11:07:54 thedev snapd[1114]: overlord.go:272: Acquiring state lock file
Dec 18 11:07:54 thedev snapd[1114]: overlord.go:277: Acquired state lock file
Dec 18 11:07:54 thedev snapd[1114]: cannot run daemon: cannot read state: unexpected EOF
Dec 18 11:07:54 thedev systemd[1]: snapd.service: Main process exited, code=exited, 
status=1/FAILURE
Dec 18 11:07:54 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 18 11:07:54 thedev systemd[1]: Failed to start Snap Daemon.
Dec 18 11:07:54 thedev systemd[1]: snapd.service: Scheduled restart job, restart counter is at 5.
Dec 18 11:07:54 thedev systemd[1]: Stopped Snap Daemon.
Dec 18 11:07:54 thedev systemd[1]: Starting Snap Daemon...
Dec 18 11:07:55 thedev snapd[1150]: overlord.go:272: Acquiring state lock file
Dec 18 11:07:55 thedev snapd[1150]: overlord.go:277: Acquired state lock file
Dec 18 11:07:55 thedev snapd[1150]: cannot run daemon: cannot read state: unexpected EOF
Dec 18 11:07:55 thedev systemd[1]: snapd.service: Main process exited, code=exited, 
status=1/FAILURE
Dec 18 11:07:55 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 18 11:07:55 thedev systemd[1]: Failed to start Snap Daemon.
Dec 18 11:07:55 thedev systemd[1]: snapd.service: Scheduled restart job, restart counter is at 6.
Dec 18 11:07:55 thedev systemd[1]: Stopped Snap Daemon.
Dec 18 11:07:55 thedev systemd[1]: snapd.service: Start request repeated too quickly.
Dec 18 11:07:55 thedev systemd[1]: snapd.service: Failed with result 'exit-code'.
Dec 18 11:07:55 thedev systemd[1]: Failed to start Snap Daemon.
Dec 18 11:07:55 thedev systemd[1]: snapd.service: Triggering OnFailure= dependencies.

The snapd state file /var/lib/snapd/state.json appears to be corrupted or truncated. Can you share more details about the host system? The output of cat /etc/os-release would be useful.

@abeato @pedronis looks like a corrupted state file?

cat /etc/os-release PRETTY_NAME=“Ubuntu 22.04.3 LTS” NAME=“Ubuntu” VERSION_ID=“22.04” VERSION=“22.04.3 LTS (Jammy Jellyfish)” VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL=“https://www.ubuntu.com/” UBUNTU_CODENAME=jammy

cat /etc/os-release PRETTY_NAME=“Ubuntu 22.04.3 LTS” NAME=“Ubuntu” VERSION_ID=“22.04” VERSION=“22.04.3 LTS (Jammy Jellyfish)” VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL=“https://www.ubuntu.com/” UBUNTU_CODENAME=jammy

Is the host system a VM, or maybe a Raspberry Pi? Can you include the output of uname -a ?

Linux thedev 6.2.0-39-generic #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Linux thedev 6.2.0-39-generic #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Yes, it indeed looks like a corrupted file. thedev, do you still have this file handy? If so, would you please share?

Which file are you taking about ?

The file in question is /var/lib/snapd/state.json

There is no file named state.json in snapd.

How to read the content of this file…

Yes that’s the one, please share.

"data": {
    "auth": {
      "last-id": 1,
      "users": [
        {
          "id": 1,
          "username": "pushpendraaa2.0@gmail.com",
          "email": "pushpendraaa2.0@gmail.com",
          "macaroon": "REDACTED",
          "store-macaroon": "REDACTED",
          "store-discharges": [
            "REDACTED"
          ],
          "expiration": "0001-01-01T00:00:00Z"
        }
      ],
      "device": {
        "brand": "generic",
        "model": "generic-classic",
        "serial": "REDACTED",
        "key-id": "REDACTED",
        "session-macaroon": "REDACTED"
      },
      "macaroon-key": "REDACTED"
    },
    "config": {
      "core": {
        "refresh": {
          
        },
        "seed": {
          "loaded": true
        }
      }
    },
    "conns": {
      "firefox:audio-playback core:audio-playback": {
        "auto": true,
        "interface": "audio-playback"
      },
      "firefox:audio-record core:audio-record": {
        "auto": true,
        "interface": "audio-record"
      },
      "firefox:avahi-observe core:avahi-observe": {
        "auto": true,
        "interface": "avahi-observe"
      },
      "firefox:browser-sandbox core:browser-support": {
        "auto": true,
        "interface": "browser-support",
        "plug-static": {
          "allow-sandbox": true
        }
      },
      "firefox:camera core:camera": {
        "auto": true,
        "interface": "camera"
      },
      "firefox:cups-control core:cups-control": {
        "auto": true,
        "interface": "cups-control"
      },
      "firefox:desktop core:desktop": {
        "auto": true,
        "interface": "desktop",
        "plug-static": {
          "mount-host-font-cache": false
        }
      },
      "firefox:desktop-legacy core:desktop-legacy": {
        "auto": true,
        "interface": "desktop-legacy"
      },
      "firefox:dot-mozilla-firefox core:personal-files": {
        "auto": true,
        "interface": "personal-files",
        "plug-static": {
          "read": [
            "$HOME/.mozilla/firefox"
          ]
        }
      },
      "firefox:etc-firefox core:system-files": {
        "auto": true,
        "interface": "system-files",
        "plug-static": {
          "read": [
            "/etc/firefox"
          ]
        }
      }

If this is indeed whole the content of snapd.json, then it really is cut short. Now, snapd attempts to write the state file atomically, i.e. it’s written first to a temporary file, flushed and synced to disk, then rename takes place to replace the old state.json with the new one, after which there’s a sync on the parent directory.

Did you happen to have fsck run on boot and fix filesystem errors maybe? Maybe after loosing power?