tcpdump not working when binding inside snap

We have a snap and we are binding tcpdump(Since it is custom OS based on and these cli tools not available by default) from inside our snap, previously for our snap base was core18 and it was working fine but after upgrade to core20 nmap and tcpdump command stopped working. nmap command we solved by adding

LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/blas"

but tcpdump problem still exist. Any help folks it is killing me.

Can you describe the problem in more detail? Binding to a raw socket fails? Is there a denial logged in dmesg? Have you tried using --strace to find out which call fails exactly?

Thanks for responding, tcpdump is giving error as couldn’t find user ‘tcpdump’ for my os tcpdump is not present and i cannot install on it as it is custom build so we are binding tcpdump into our snap itself. code snippet of how i bind it in snapcraft.yaml

apps:

tcpdump: command: sbin/tcpdump plugs: - bluetooth-control #tcpdump: Can’t open raw Bluetooth socket: Permission denied - network - network-control - network-bind - network-observe - hardware-observe - raw-usb - firewall-control - account-control - system-backup

and these are the some output/errors i am getting when i tried to get tcpdump

admin@2LK2F92:~$ sudo my-snap.tcpdump -i any tcpdump: Couldn’t find user ‘tcpdump’

root@2LK2F92:/home/admin# sudo my-snap.tcpdump -Z root -i any tcpdump: Couldn’t change to ‘root’ uid=0 gid=0: Operation not permitted

Both the above command is working if i change base in snapcraft.yaml to core18 When i tried --strace option

admin@2LK2F92:~$ sudo my-snap.tcpdump -i any --strace /snap/my-snap/x1/usr/sbin/tcpdump: unrecognized option ‘–strace’ tcpdump version 4.9.3 libpcap version 1.9.1 (with TPACKET_V3) OpenSSL 1.1.1f 31 Mar 2020 Usage: tcpdump [-aAbdDefhHIJKlLnNOpqStuUvxX#] [ -B size ] [ -c count ] [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ] [ -i interface ] [ -j tstamptype ] [ -M secret ] [ --number ] [ -Q in|out|inout ] [ -r file ] [ -s snaplen ] [ --time-stamp-precision precision ] [ --immediate-mode ] [ -T type ] [ --version ] [ -V file ] [ -w file ] [ -W filecount ] [ -y datalinktype ] [ -z postrotate-command ] [ -Z user ] [ expression ]