I tried to debug locally compiled snap with debug symbols enabled, and it failed:
ofry@ofry-virtual-machine:~$ snap run --gdb telegram-desktop
GNU gdb (Ubuntu 16.2-8ubuntu1) 16.2
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /snap/snapd/24792/usr/lib/snapd/snap-confine...
(No debugging symbols found in /snap/snapd/24792/usr/lib/snapd/snap-confine)
Starting program: /snap/snapd/24792/usr/lib/snapd/snap-confine --base core24 snap.telegram-desktop.telegram-desktop /usr/lib/snapd/snap-exec --command=gdb telegram-desktop.telegram-desktop
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/snap/snapd/current/usr/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 233023]
[Detaching after fork from child process 233024]
cannot create user data directory: /home/ofry/snap/telegram-desktop/x1: Permission denied
[Inferior 1 (process 233017) exited with code 01]
Catchpoint 1 (exec)
The program is not being run.
(gdb) exit
Journalctl entries:
июл 25 17:40:25 ofry-virtual-machine sudo[232593]: pam_unix(sudo:session): session closed for user root
июл 25 17:40:27 ofry-virtual-machine systemd[4321]: Started snap.telegram-desktop.telegram-desktop-e0ab683b-0312-4776-a673-b831451e46e3.scope.
июл 25 17:40:27 ofry-virtual-machine sudo[232687]: ofry : TTY=pts/1 ; PWD=/home/ofry ; USER=root ; COMMAND=/usr/bin/gdb -ex=run '-ex=catch exec' -ex=continue --args /snap/snapd/24792/usr/lib/snapd/snap-confine --base core24 snap.telegram-desktop.telegram-desktop /usr/lib/snapd/snap-exec --command=gdb telegram-desktop.telegram-desktop
июл 25 17:40:27 ofry-virtual-machine sudo[232687]: pam_unix(sudo:session): session opened for user root(uid=0) by ofry(uid=1000)
июл 25 17:40:34 ofry-virtual-machine sudo[232687]: pam_unix(sudo:session): session closed for user root
июл 25 17:41:26 ofry-virtual-machine rtkit-daemon[4187]: Supervising 9 threads of 6 processes of 1 users.
июл 25 17:41:26 ofry-virtual-machine rtkit-daemon[4187]: Supervising 9 threads of 6 processes of 1 users.
июл 25 17:41:26 ofry-virtual-machine kernel: audit: type=1400 audit(1753454486.157:1864): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/snap.firefox.firefox-43fc9730-c0b1-40dc-b588-f1249627866e.scope/cpu.max" pid=232746 comm=57656220436F6E74656E74 requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
июл 25 17:42:29 ofry-virtual-machine rtkit-daemon[4187]: Supervising 9 threads of 6 processes of 1 users.
июл 25 17:42:29 ofry-virtual-machine rtkit-daemon[4187]: Supervising 9 threads of 6 processes of 1 users.
июл 25 17:42:29 ofry-virtual-machine kernel: audit: type=1400 audit(1753454549.445:1865): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/snap.firefox.firefox-43fc9730-c0b1-40dc-b588-f1249627866e.scope/cpu.max" pid=232813 comm=57656220436F6E74656E74 requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
июл 25 17:42:40 ofry-virtual-machine systemd[4321]: Started snap.telegram-desktop.telegram-desktop-06864792-6ae2-45cd-8ca1-f965b49854a3.scope.
июл 25 17:42:41 ofry-virtual-machine sudo[232871]: ofry : TTY=pts/1 ; PWD=/home/ofry ; USER=root ; COMMAND=/usr/bin/gdb -ex=run '-ex=catch exec' -ex=continue --args /snap/snapd/24792/usr/lib/snapd/snap-confine --base core24 snap.telegram-desktop.telegram-desktop /usr/lib/snapd/snap-exec --command=gdb telegram-desktop.telegram-desktop
июл 25 17:42:41 ofry-virtual-machine sudo[232871]: pam_unix(sudo:session): session opened for user root(uid=0) by ofry(uid=1000)
июл 25 17:42:44 ofry-virtual-machine sudo[232871]: pam_unix(sudo:session): session closed for user root
июл 25 17:43:18 ofry-virtual-machine NetworkManager[2652]: <info> [1753454598.7188] dhcp4 (ens33): state changed new lease, address=192.168.59.128
июл 25 17:43:18 ofry-virtual-machine dbus-daemon[2441]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.14' (uid=0 pid=2652 comm="/usr/sbin/NetworkManager --no-daemon" label="unconfined")
июл 25 17:43:18 ofry-virtual-machine systemd[1]: Starting NetworkManager-dispatcher.service - Network Manager Script Dispatcher Service...
июл 25 17:43:18 ofry-virtual-machine dbus-daemon[2441]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
июл 25 17:43:18 ofry-virtual-machine systemd[1]: Started NetworkManager-dispatcher.service - Network Manager Script Dispatcher Service.
июл 25 17:43:28 ofry-virtual-machine systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
июл 25 17:43:38 ofry-virtual-machine sudo[232513]: pam_unix(sudo:session): session closed for user root
июл 25 17:43:38 ofry-virtual-machine systemd[1]: snap.snappy-debug.snappy-debug-1251d717-c957-4b5f-aaec-2e2b48100d76.scope: Deactivated successfully.
июл 25 17:43:38 ofry-virtual-machine sudo[232514]: pam_unix(sudo:session): session closed for user root
июл 25 17:43:46 ofry-virtual-machine systemd[4321]: Started snap.telegram-desktop.telegram-desktop-30547bda-aa9a-48bb-9e69-8fc7d44484f3.scope.
июл 25 17:43:47 ofry-virtual-machine sudo[232987]: ofry : TTY=pts/1 ; PWD=/home/ofry ; USER=root ; COMMAND=/usr/bin/gdb -ex=run '-ex=catch exec' -ex=continue --args /snap/snapd/24792/usr/lib/snapd/snap-confine --base core24 snap.telegram-desktop.telegram-desktop /usr/lib/snapd/snap-exec --command=gdb telegram-desktop.telegram-desktop
июл 25 17:43:47 ofry-virtual-machine sudo[232987]: pam_unix(sudo:session): session opened for user root(uid=0) by ofry(uid=1000)
июл 25 17:43:50 ofry-virtual-machine sudo[232987]: pam_unix(sudo:session): session closed for user root
июл 25 17:43:50 ofry-virtual-machine systemd[4321]: snap.telegram-desktop.telegram-desktop-30547bda-aa9a-48bb-9e69-8fc7d44484f3.scope: Consumed 1.077s CPU time, 65.4M memory peak.
июл 25 17:44:01 ofry-virtual-machine rtkit-daemon[4187]: Supervising 9 threads of 6 processes of 1 users.
июл 25 17:44:01 ofry-virtual-machine rtkit-daemon[4187]: Supervising 9 threads of 6 processes of 1 users.
июл 25 17:44:01 ofry-virtual-machine kernel: audit: type=1400 audit(1753454641.810:1866): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/snap.firefox.firefox-43fc9730-c0b1-40dc-b588-f1249627866e.scope/cpu.max" pid=233040 comm=57656220436F6E74656E74 requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
июл 25 17:45:02 ofry-virtual-machine CRON[233101]: pam_unix(cron:session): session opened for user root(uid=0) by root(uid=0)
июл 25 17:45:02 ofry-virtual-machine CRON[233117]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
июл 25 17:45:02 ofry-virtual-machine CRON[233101]: pam_unix(cron:session): session closed for user root
июл 25 17:46:24 ofry-virtual-machine rtkit-daemon[4187]: Supervising 9 threads of 6 processes of 1 users.
июл 25 17:46:24 ofry-virtual-machine rtkit-daemon[4187]: Supervising 9 threads of 6 processes of 1 users.
июл 25 17:46:24 ofry-virtual-machine kernel: audit: type=1400 audit(1753454784.464:1867): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/snap.firefox.firefox-43fc9730-c0b1-40dc-b588-f1249627866e.scope/cpu.max" pid=233272 comm=57656220436F6E74656E74 requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
июл 25 17:46:28 ofry-virtual-machine rtkit-daemon[4187]: Supervising 9 threads of 6 processes of 1 users.
июл 25 17:46:28 ofry-virtual-machine rtkit-daemon[4187]: Supervising 9 threads of 6 processes of 1 users.
июл 25 17:46:28 ofry-virtual-machine kernel: audit: type=1400 audit(1753454788.387:1868): apparmor="DENIED" operation="open" class="file" profile="snap.firefox.firefox" name="/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/snap.firefox.firefox-43fc9730-c0b1-40dc-b588-f1249627866e.scope/cpu.max" pid=233325 comm=57656220436F6E74656E74 requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
июл 25 17:46:38 ofry-virtual-machine systemd[4321]: Started snap.telegram-desktop.telegram-desktop-061ab84b-2848-43b4-b50e-73cd23bbb0a7.scope.
июл 25 17:46:38 ofry-virtual-machine sudo[233417]: ofry : TTY=pts/1 ; PWD=/home/ofry ; USER=root ; COMMAND=/usr/bin/gdb -ex=run '-ex=catch exec' -ex=continue --args /snap/snapd/24792/usr/lib/snapd/snap-confine --base core24 snap.telegram-desktop.telegram-desktop /usr/lib/snapd/snap-exec --command=gdb telegram-desktop.telegram-desktop
июл 25 17:46:38 ofry-virtual-machine sudo[233417]: pam_unix(sudo:session): session opened for user root(uid=0) by ofry(uid=1000)
июл 25 17:46:41 ofry-virtual-machine sudo[233417]: pam_unix(sudo:session): session closed for user root
I haven’t got such error when run any snap “as usual”:
telegram-desktop
or snap run --shell telegram-desktop
My OS is KUbuntu 25.04