aguinet / usbtop

usbtop is a top-like utility that shows an estimated instantaneous bandwidth on USB buses and devices.
BSD 3-Clause "New" or "Revised" License
277 stars 45 forks source link

Run usbtop in a Docker #33

Open cjds opened 4 years ago

cjds commented 4 years ago

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?

Saentist commented 4 years ago

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

cjds commented 4 years ago

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?

Saentist commented 4 years ago

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

cjds commented 4 years ago

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.

alexspurling commented 2 years ago

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"

livneros-greeneye commented 1 year ago

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