Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error] How to fix USB connectivity? #762

Closed
secretmango opened this issue May 21, 2023 · 5 comments
Closed

[Error] How to fix USB connectivity? #762

secretmango opened this issue May 21, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@secretmango
Copy link

Describe the bug
The container has no access to /dev/bus/usb which doesnt make sense from Distroboxes unisolated approach.

To Reproduce
Try to use ADB in a Distrobox with an Android phone. There is a permission error, even though the device is detected.

Expected behavior
Full permission over all ports as wished.

Logs
Run the commands with --verbose and post the log here as a file upload
Attach also the output of podman logs or docker logs, possibly with --latest flag

Desktop (please complete the following information):

distrobox-1.4.2.1-2.fc38.noarch
podman-4.5.0-1.fc38.x86_64

--- Software ---
OS: Fedora Linux 38.20230521.0 (Kinoite)
KDE Plasma: 5.27.5
KDE Frameworks: 5.106.0
Qt: 5.15.9
Kernel: 6.2.15-300.fc38.x86_64
Compositor: wayland

--- Hardware ---
CPU: AMD Ryzen 5 PRO 3500U w/ Radeon Vega Mobile Gfx
RAM: 13.5 GB
GPU: AMD Radeon Vega 8 Graphics
Video memory: 2048MB
Thinkpad T495, no TLP e.g. installed, ports working normally with ADB on host

@secretmango secretmango added the bug Something isn't working label May 21, 2023
@oniboni
Copy link

oniboni commented Jun 15, 2023

I had a similar problem with serial devices, maybe my approach is adaptable?

  1. Add an udev rule to allow your user r/w-permissions (maybe you do not have to do this if dialout has the same GID on host and guest 🤔 ):
echo "# let serial devices be owned by the distrobox user\nKERNEL==\"ttyACM[0-9]*\", OWNER=\"$USER\"\n" | sudo dd of=/etc/udev/rules.d/42-distrobox.rules
  1. Find out the major number for the device you want to use inside the box:
ls -l /dev/ttyACM0
crw-rw---- 1   <user> dialout 166, 0 Jun 15 16:14 /dev/ttyACM0
                             #^^^ - this one :)
  1. Allow the cgroup appropriate rights to these device types:
    a. distrobox create -i <image> -n <name> --additional-flags "--device-cgroup-rule='c 166:* rmw'"
    b. or via distrobox.ini: container_manager_additional_flags="--device-cgroup-rule='c 166:* rmw'" if you are using assemble

I guess you have to look for a /dev/ttyS0 device.

@89luca89
Copy link
Owner

89luca89 commented Aug 4, 2023

You need to use a rootful distrobox for this
Please refer to the documentation

@89luca89 89luca89 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
@bam80
Copy link
Contributor

bam80 commented Dec 13, 2023

@89luca89 you mean here?
https://distrobox.it/useful_tips/#run-the-container-with-real-root

Is anything else needed?

@bam80
Copy link
Contributor

bam80 commented Dec 13, 2023

You need to use a rootful distrobox for this

Could we emphasize it in the docs as it's not obvious?

I looked at the docs but didn't find clear answer.
USB access is claimed in the Readme, without any conditions.

@mabequinho
Copy link

ADB worked well(adb shell) on MicroOS and Tumbleweed container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants