在 Debian 系统上使用 dumpcap(Wireshark 套件里的命令行抓包工具)时,常见错误主要集中在 权限、网络接口、Linux 内核/安全机制、文件与磁盘 等方面。下面按类别给你一个常见错误与解决思路总结。
典型报错:
No permission to capture on that device
原因:
✅ 解决方案:
sudo dumpcap -i eth0
或赋予 dumpcap 能力(推荐):
sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap
然后:
getcap /usr/bin/dumpcap
即使安装了 wireshark 组,也可能没生效。
✅ 确认用户是否在 wireshark 组:
groups
如果不在:
sudo usermod -aG wireshark $USER
newgrp wireshark
The capture session could not be initiated on interface 'eth0'
常见原因:
ens33, enp0s3)✅ 排查:
ip link
ip addr
使用正确接口名:
dumpcap -i any
Device or resource busy
✅ 解决思路:
报错类似:
Child dumpcap not available
或启动时直接失败
✅ 排查 AppArmor:
aa-status
临时解决:
sudo aa-complain /usr/bin/dumpcap
Can't open netlink socket
原因:
nflog 捕获方式✅ 加载模块:
sudo modprobe nfnetlink_log
File size limit reached
✅ 检查:
df -h
建议:
-w 指定路径dumpcap -i eth0 -w /tmp/test.pcap -b filesize:100000
Permission denied
✅ 检查写入目录权限:
ls -ld /path/to/output
Debian 升级后可能出现:
dumpcap: error while loading shared libraries
✅ 解决:
sudo apt update
sudo apt install libpcap0.8 wireshark-common
dumpcap
❌ 报错:
No interface specified
✅ 正确:
dumpcap -i any
Too many packets in buffer
✅ 限制缓冲:
dumpcap -i eth0 -B 64
ip a
getcap /usr/bin/dumpcap
sudo dumpcap -i any -w test.pcap
dumpcap -i eth0 -f "port 80" -w test.pcap -V
如果你愿意,可以贴出 完整报错信息 + Debian 版本 + dumpcap 版本,我可以帮你精确分析是哪一类问题。