usbtop icon indicating copy to clipboard operation
usbtop copied to clipboard

Run usbtop in a Docker

Open cjds opened this issue 4 years ago • 6 comments

I'm trying to run usbtop in a priveleged Docker.

It keeps saying

No USB bus can be captured thanks to libpcap. Check your name filter and make sure relevent permissions are set !

However, I have run

modprobe usbmon

outside the docker

When I run

lsmod | grep usbmon
usbmon                 28672  0

So the Docker can detect the module. What's going on?

cjds avatar Aug 13 '20 16:08 cjds

Why you need to monitor REAL hardware parameters from pseudo virtualization? it s normal kernel to kicks such nonreglamented remote access

Saentist avatar Aug 14 '20 04:08 Saentist

The reason I am using Docker is to package my code without easily without affecting the host system. However, the Docker being deployed has

--privileged --cap-add ALL

which does let me monitor devices and interact with kernel modules.

Because the Docker has programs that interact with devices on the USB bus I would like to monitor the CPU usage? Is that so unreasonable?


This isn't unheard of practice? What do you mean by remote access? It's on the same host?

cjds avatar Aug 14 '20 18:08 cjds

You want to act as some virus over kernel. Docker is a pseudo virtualisation with mean act as separate system in system.

Saentist avatar Aug 14 '20 19:08 Saentist

While that is true it also can access real devices on the system. Even virtualization can need to know the USB Bus bandwidth if it is accessing data on the USB bus and interacting with devices on it.

cjds avatar Aug 14 '20 20:08 cjds

I am also interested in learning how to run usbtop from docker. So far I have this Dockerfile:

FROM ubuntu:22.04

RUN apt update
RUN apt install usbtop -y
RUN apt install kmod -y

RUN usbtop

But I get the error: "No USB bus can be captured thanks to libpcap. Check your name filter and make sure relevent permissions are set !"

If I try to run modprobe like this:

FROM ubuntu:22.04

RUN apt update
RUN apt install usbtop -y
RUN apt install kmod -y

RUN modprobe usbmon

RUN usbmon

Then I get the error: "modprobe: FATAL: Module usbmon not found in directory /lib/modules/5.14.0-1038-oem"

alexspurling avatar Jun 13 '22 13:06 alexspurling

You should run sudo modprobe usbmon on your host before executing your docker run ..

livneros-greeneye avatar Jul 19 '23 11:07 livneros-greeneye