1

I am trying to run a binary that's from a snap through strace to debug its workings.

Because the executable is accessed via /snap/bin/prog which is symlinked to /usr/bin/snap I will only see snap's system calls, not the program's.

How can I go about running the binary?

I tried using chroot, but that tells me the binary does not exit:

$ sudo chroot /snap/prog/current /usr/bin/prog
chroot: failed to run command ‘/usr/bin/prog’: No such file or directory

Even though there is a binary at /snap/prog/current/usr/bin/prog that it could run.

Can I have a more direct access to the snap's execution?

NOTE: The same issue would arise if I wanted to run it through gdb instead of strace.

UPDATE

I thought I had a good start when I found --devmode and /var/lib/snapd/hostfs but running a host bin just causes a segmentation violation.

$ sudo snap run --shell PROGNAME
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/lib/snapd/hostfs/usr/lib/x86_64-linux-gnu/
# /var/lib/snapd/hostfs/usr/bin/strace                                    
Segmentation fault (core dumped)

It seemed promising, but alas.

Bram
  • 2,169
  • 24
  • 42
  • The simple answer to your question Can I have a more direct access to the snap's execution? is no. When you do some research you will see snaps are closed self contained systems. – David Sep 29 '22 at 06:24

0 Answers0