Bug 1730938

Summary: Run the command with gdb option is not working: /usr/lib/snapd/snap-exec: No such file or directory.
Product: [Fedora] Fedora EPEL Reporter: Eugene Kanter <ekanter>
Component: snapdAssignee: Zygmunt Krynicki <me>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: go-sig, maciek.borzecki, me, ngompa13
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-02-17 10:30:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Eugene Kanter 2019-07-17 23:35:33 UTC
Description of problem:
Unable to debug snap packaged application as instructed in its manual page

Version-Release number of selected component (if applicable):
snapd-2.39.2-1.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. sudo snap install anyapp
2. snap run --gdb anyapp

Actual results:

GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-114.el7
Copyright (C) 2013 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/libexec/snapd/snap-confine...Reading symbols from /usr/libexec/snapd/snap-confine...(no debugging symbols found)...done.
(no debugging symbols found)...done.
Starting program: /usr/libexec/snapd/snap-confine snap.anyapp.anyapp /usr/lib/snapd/snap-exec --command=gdb anyapp
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Detaching after fork from child process 26555.
Detaching after fork from child process 26556.
process 26551 is executing new program: /usr/lib/snapd/snap-exec
/usr/lib/snapd/snap-exec: No such file or directory.
Catchpoint 1 (exec)
Continuing.
process 26551 is executing new program: /usr/lib/snapd/snap-gdb-shim
/usr/lib/snapd/snap-gdb-shim: No such file or directory.
Missing separate debuginfos, use: debuginfo-install snap-confine-2.39.2-1.el7.x86_64
(gdb)


Expected results, as seen on Fedora 29 for example:

GNU gdb (GDB) Fedora 8.2-7.fc29
Copyright (C) 2018 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-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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 /usr/libexec/snapd/snap-confine...(no debugging symbols found)...done.
Starting program: /usr/libexec/snapd/snap-confine snap.anyapp.anyapp /usr/lib/snapd/snap-exec --command=gdb anyapp
warning: Loadable section ".note.gnu.property" outside of ELF segments
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
...
...
process 746 is executing new program: /usr/lib/snapd/snap-exec
Missing separate debuginfos, use: dnf debuginfo-install snap-confine-2.39.1-1.fc29.x86_64
Missing separate debuginfo for target:/usr/lib/snapd/snap-exec
...
...
process 746 is executing new program: /usr/lib/snapd/snap-gdb-shim
Missing separate debuginfo for target:/usr/lib/snapd/snap-gdb-shim
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/06/f4b175e50662f76d5d23b8a895c5fab1798827.debug
Missing separate debuginfo for target:/lib64/ld-linux-x86-64.so.2
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/c0/adbad6f9a33944f2b3567c078ec472a1dae98e.debug
Missing separate debuginfo for target:/lib/x86_64-linux-gnu/libc.so.6
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/1c/a54a6e0d76188105b12e49fe6b8019bf08803a.debug


Welcome to `snap run --gdb`.
You are right before your application is execed():
- set any options you may need
- use 'cont' to start



Thread 1 "snap-gdb-shim" received signal SIGTRAP, Trace/breakpoint trap.
0x00007fdf0e840428 in raise () from target:/lib/x86_64-linux-gnu/libc.so.6
Catchpoint 1 (exec)
Continuing.
process 746 is executing new program: /bin/dash
Missing separate debuginfo for target:/lib64/ld-linux-x86-64.so.2
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/c0/adbad6f9a33944f2b3567c078ec472a1dae98e.debug

Thread 1 "command-anyapp" hit Catchpoint 1 (exec'd /bin/dash), 0x00007fbb2c12ac30 in ?? ()
   from target:/lib64/ld-linux-x86-64.so.2
(gdb)

Comment 1 Maciek Borzecki 2022-02-17 10:30:58 UTC
This should be working with the current versions of snapd available in EPEL.