Giter Club home page Giter Club logo

Comments (20)

pythys avatar pythys commented on May 31, 2024 1

OK so I figured out what's causing the no protocol specified issue and got it fixed with the xhost command.

Now I can finally start testing. I still need to tune the settings before I can do the actual testing but we're in a much better shape now. Thank you for the support so far.

from dockerfiles.

pythys avatar pythys commented on May 31, 2024 1

OK great but a minor note. Before I was on Arch, I used linux mint (Ubuntu) and I still had the same problem. So I think the distro choice is less of a factor here

from dockerfiles.

andrewmackrodt avatar andrewmackrodt commented on May 31, 2024

Hey, apologies I have not replied until now (I forgot to watch my own repository đŸ¤Ļ). Which image did you have trouble with and are you connecting via Bluetooth or USB? I'm running Ubuntu 20.04 as my host OS (and previously 18.04) and the controller worked without requiring any special driver on the host/docker image. However (assuming Bluetooth), it is required that the controller is connected to the host before bringing the container up.

from dockerfiles.

pythys avatar pythys commented on May 31, 2024

Hello and thank you for looking into this.

I switched recently to Arch Linux and so even before reaching the controller issue I'm unable to test as I'm facing a bug with nvidia version. I'm not sure if the complaint is below is from not finding nVidia driver, or privileges on the system, or other requirements. I have a special setup in my system as follows:
Linux Distro: Arch
Desktop Environment: i3wm
nVidia device: NVIDIA GeForce MX150
nVidia driver: nvidia-lts 1:465.27-1

NVidia driver mismatch Host(465.27) <=> Container(460.67
460.67)
Automatic driver match will be attempted ...
Failed to locate a package with the same driver version
X11 apps may fail; mount drivers from your host as a volume
and set LD_LIBRARY_PATH to include the volume
No protocol specified
Unable to init server: Could not connect: Connection refused
22:39:46: Error: Unable to initialize GTK+, is DISPLAY set properly?

from dockerfiles.

andrewmackrodt avatar andrewmackrodt commented on May 31, 2024

The bundled nvidia drivers use the latest available from the Ubuntu repositories, unfortunately this does not include the latest feature preview (465.x). I've added the PPA for oem-solutions-group/nvidia-driver-staging which includes 465.24.02 but this is still a version behind the latest.

I'm currently running 460.73.01 but have had success with mounting drivers from the host into the container with previous versions. I've updated the error to point to this part of the README: https://github.com/andrewmackrodt/dockerfiles/tree/master/ubuntu-x11#nvidia-driver-note - this links to a gist which (on Ubuntu hosts at least), creates a directory with the necessary nvidia gl libraries. Sadly, I'm not sure whether this will work with Arch, hopefully the oem-solutions-group/nvidia-driver-staging PPA is updated with the latest drivers soon.

from dockerfiles.

andrewmackrodt avatar andrewmackrodt commented on May 31, 2024

465.27 is now available.

from dockerfiles.

pythys avatar pythys commented on May 31, 2024

Hmm, not sure but on issuing pacman -Q|grep -i nvidia I get the following

lib32-nvidia-utils 465.27-1
nvidia-lts 1:465.27-4
nvidia-settings 465.27-1
nvidia-utils 465.27-1

And when I issue the command to start the container:

nvidia driver mismatch Host(465.27) <=> Container(460.73)
Automatic driver match will be attempted ...
Removing old packages libnvidia-gl-460:i386  ...
E: Unable to locate package libnvidia-gl-460:i386
Installing package libnvidia-gl-465:i386=465.27-0ubuntu0.20.04.1 ...
E: Unable to correct problems, you have held broken packages.
No protocol specified
Unable to init server: Could not connect: Connection refused
17:16:31: Error: Unable to initialize GTK+, is DISPLAY set properly?

And the script that I have to initiate is:

#!/bin/bash
SCRIPT_DIR="$(cd -P "$(dirname "$0")" && pwd)"

GPU_DEVICES=$( \
    echo "$( \
        find /dev -maxdepth 1 -regextype posix-extended -iregex '.+/nvidia([0-9]|ctl|-modeset)' \
            | grep --color=never '.' \
          || echo '/dev/dri'\
      )" \
      | sed -E "s/^/--device /" \
  )

docker create \
  --name pcsx2 \
  --cap-add NET_ADMIN \
  --net host \
  --device /dev/input \
  --device /dev/snd \
  --privileged \
  $GPU_DEVICES \
  -v $SCRIPT_DIR/games:/games:ro \
  -v $SCRIPT_DIR/data:/data \
  -v $SCRIPT_DIR/bios:/bios \
  -v $SCRIPT_DIR/plugins:/plugins \
  -e BIOS_ZIP=${BIOS_ZIP:-} \
  -e BIOS_CHECKSUM=${BIOS_CHECKSUM:-} \
  -e PUID=$(id -u) \
  -e PGID=$(id -g) \
  -e DISPLAY=unix$DISPLAY \
  -e LANG=${LANG:-en_US.UTF-8} \
  -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
  -v /etc/machine-id:/etc/machine-id:ro \
  -v $HOME/.config/pulse:/home/ubuntu/.config/pulse:ro \
  -v /run/user/$(id -u)/pulse:/run/user/$(id -u)/pulse:ro \
  -v /run/udev/data:/run/udev/data:ro \
  -v /etc/localtime:/etc/localtime:ro \
  andrewmackrodt/pcsx2-x11

from dockerfiles.

andrewmackrodt avatar andrewmackrodt commented on May 31, 2024

Thanks for the log output, I've spotted the problem with cleaning up the old driver versions. A fix should be pushed to dockerhub in ~30 minutes depending how long it takes to build all the other images. I'll reply once it's done 🤞.

from dockerfiles.

andrewmackrodt avatar andrewmackrodt commented on May 31, 2024

A new version should be available on DockerHub now. I've tested with a PS4 controller and it works in game, but for some reason, trying to configure the controller in the OnePad settings window does not register key presses.

from dockerfiles.

pythys avatar pythys commented on May 31, 2024

OK great, so now it's installing the package but I still face the display error below. Does it have to do with me running i3wm and not gnome? Or do I need to do something about the display name perhaps? Not sure

nvidia driver mismatch Host(465.27) <=> Container(460.80)
Automatic driver match will be attempted ...
Removing old packages libnvidia-common-460 libnvidia-gl-460:i386  ...
Installing package libnvidia-gl-465:i386=465.27-0ubuntu0.20.04.1 ...
debconf: delaying package configuration, since apt-utils is not installed
No protocol specified
Unable to init server: Could not connect: Connection refused
18:40:06: Error: Unable to initialize GTK+, is DISPLAY set properly?

from dockerfiles.

andrewmackrodt avatar andrewmackrodt commented on May 31, 2024

I've not used i3wm so not sure on that error, I can reproduce the message "Unable to init server: Could not connect: Connection refused" if I set an invalid display but I'm not sure what causes "No protocol specified", perhaps something XAUTHORITY related?

If it is the latter, you could try mounting that in the container, e.g.

# from host
$ echo $XAUTHORITY
/run/user/1000/gdm/Xauthority
# add to docker create command
docker create \
  ... \
  -e "XAUTHORITY=$XAUTHORITY" \
  -v "$XAUTHORITY:$XAUTHORITY:ro" \
  ...

For reference, echo $DISPLAY from my host outputs :1 so the DISPLAY variable in the container is unix:1.

from dockerfiles.

andrewmackrodt avatar andrewmackrodt commented on May 31, 2024

So I decided to try some Simpsons Hit and Run and the performance was very bad compared to when I'd last tried. I narrowed it down to the nvidia driver (now) requiring the amd64 version installed alongside i386 else pcsx2 had a warning of "dri2 failed to authenticate".

Unfortunately this makes the total image 400mb larger ☚ī¸. I've changed the ubuntu-x11-i386 image to inherit from the ubuntu-x11 image to try and reuse as many layers from other images (e.g. all the other emulators). New images are building, performance is on par with running natively and fixes a problem when toggling fullscreen.

Due to the mentioned change, the first pull will be slower due to the 40% larger image size, but individual updates should be relatively small after that.

Should be available on dockerhub in 20-30 minutes.

from dockerfiles.

pythys avatar pythys commented on May 31, 2024

OK so I've fixed everything, got the settings working, resolved issues around nvidia with optimus-manager, and everything is fine.

Now I'm back to my old problem, I cannot AT ALL detect the PS4 controller from docker. The steps that I did are:

  1. cleanup docker and remove all containers
  2. Pair the controller with the computer (bluetooth). It is paired and trusted. rfkill shows everything is unblocked
  3. start pcsx2 image with --privileged to avoid any possibilities of not accessing the correct devices
  4. I am again faced with the "Gamepad not detected" issue

I have no idea why I cannot get the gamepad detected neither on ubuntu nor arch linux. So I suppose it's something in my hardware and not the software as I suspect --privileged should eliminate any possibilities of misconfigured --device settings.

So Yeah I'm exactly stuck right back at where I was before. I'm not even sure how to debug this. Any hints are appreciated.

I should also mention that I'm getting no success in USB nor in bluetooth

from dockerfiles.

andrewmackrodt avatar andrewmackrodt commented on May 31, 2024

Does dmesg from the host show anything related? With the firefox image it's required to mount some additional dbus related files, it could help: https://github.com/andrewmackrodt/dockerfiles/blob/master/firefox-x11/docker-compose.yml#L34 (although I've not had to do so for PCSX2).

You can also try installing jstest-gtk to see if that is able to see the gamepad, if it does, it could be that some i386 package is required on the host:

Start a temporary container:

docker run --rm -it \
  --device /dev/input \
  --device /dev/nvidia0 \
  --device /dev/nvidiactl \
  --device /dev/nvidia-modeset \
  --device /dev/snd \
  -e SUDO_NOPASSWD=1 \
  -e PUID=$(id -u) \
  -e PGID=$(id -g) \
  -e DISPLAY=unix$DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
  -v /etc/machine-id:/etc/machine-id:ro \
  -v $HOME/.config/pulse:/home/ubuntu/.config/pulse:ro \
  -v /run/user/$(id -u)/pulse:/run/user/$(id -u)/pulse:ro \
  -v /run/udev/data:/run/udev/data:ro \
  -v /etc/localtime:/etc/localtime:ro \
  andrewmackrodt/pcsx2-x11 \
  bash -l

Install and run jstest-gtk in the container:

sudo apt update -qqy
sudo apt install -qqy jstest-gtk
jstest-gtk

Edit, you can also try gamepadtool to see if SDL detects your controller and compare it's UID against the pcsx2 database:

In the container:

wget https://www.generalarcade.com/gamepadtool/linux/gamepadtool_1.2_i386.deb
sudo dpkg -i gamepadtool_1.2_i386.deb
sudo apt update -qqy
sudo apt install -qqy --fix-broken
gamepad-tool

If I run this, I can see the output (which exists in the linked database above):

[LOG] Searching gamepads...
[LOG] Found 2 gamepad(s):
[LOG] "XInput Controller", 030000006b1400000906000014010000 (mapping available)
[LOG] "PS4 Controller", 050000004c050000cc09000000810000 (mapping available)

from dockerfiles.

pythys avatar pythys commented on May 31, 2024

OK I've installed jstest-gtk and I can confirm the controller works perfectly well. it is mounted on /dev/input/js0 and dmesg output for USB connection is shown below. YET I still cannot access the damn thing at all. Is it possible that I have some security settings in docker or something? Very perplexing issue

[ 1788.417069] usb 1-2: new full-speed USB device number 7 using xhci_hcd
[ 1788.598497] usb 1-2: New USB device found, idVendor=054c, idProduct=09cc, bcdDevice= 1.00
[ 1788.598505] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1788.598510] usb 1-2: Product: Wireless Controller
[ 1788.598513] usb 1-2: Manufacturer: Sony Interactive Entertainment
[ 1788.608724] input: Sony Interactive Entertainment Wireless Controller Touchpad as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.3/0003:054C:09CC.000B/input/input48
[ 1788.609132] input: Sony Interactive Entertainment Wireless Controller Motion Sensors as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.3/0003:054C:09CC.000B/input/input49
[ 1788.677148] input: Sony Interactive Entertainment Wireless Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.3/0003:054C:09CC.000B/input/input47
[ 1788.677958] sony 0003:054C:09CC.000B: input,hidraw4: USB HID v81.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-0000:00:14.0-2/input3

from dockerfiles.

pythys avatar pythys commented on May 31, 2024

Another update. I followed all of your suggestions and the summary is:

  • jstest-gtk works correctly on the host machine
  • jstest-gtk works correctly inside the container
  • gamepad-tool works correctly in the host system
  • gamepad-tool does not work inside the container (error message below)

I can absolutely say this is definitely a docker problem, but I'm not sure exactly how to resolve it

SDL2 Gamepad Tool v1.2 by General Arcade (compiled with SDL version 2.0.7, DLL version 2.0.10)
Website: http://generealarcade.com/gamepadtool/

Searching gamepads...
No gamepads found
Environment variable "SDL_GAMECONTROLLERCONFIG" is not defined
Checking if new mappings available from github: https://github.com/gabomdq/SDL_GameControllerDB

from dockerfiles.

andrewmackrodt avatar andrewmackrodt commented on May 31, 2024

I suspect this is something to do with (I think) udev namespacing which is something I encountered with my firefox image. I suspect the difference between this working normally with a Ubuntu host versus Arch is related to this also. I will try testing a wired connection over the weekend as my log output above was done using Bluetooth.

In the meantime, does adding the following volume mounts help?

  -v /run/user/$(id -u)/bus:/run/user/$(id -u)/bus:ro \
  -v /run/dbus:/run/dbus:ro \
  -v /run/udev/data:/run/udev/data:ro \
  -v /var/lib/dbus/machine-id:/var/lib/dbus/machine-id:ro \

from dockerfiles.

andrewmackrodt avatar andrewmackrodt commented on May 31, 2024

Unfortunately I've been unable to reproduce this, do you have an older version of the pcsx2 OnePad plugin perhaps and does setting a new/omitting the plugins mount work?

From my host, if I run dmesg --follow and connect the PS4 controller, I see the output:

[70228.157437] usb 1-5.1: new full-speed USB device number 4 using xhci_hcd
[70228.276850] usb 1-5.1: New USB device found, idVendor=054c, idProduct=09cc, bcdDevice= 1.00
[70228.276852] usb 1-5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[70228.276854] usb 1-5.1: Product: Wireless Controller
[70228.276855] usb 1-5.1: Manufacturer: Sony Interactive Entertainment
[70228.385330] mc: Linux media interface: v0.10
[70228.398942] input: Sony Interactive Entertainment Wireless Controller Touchpad as /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:07:00.1/usb1/1-5/1-5.1/1-5.1:1.3/0003:054C:09CC.0009/input/input33
[70228.399141] input: Sony Interactive Entertainment Wireless Controller Motion Sensors as /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:07:00.1/usb1/1-5/1-5.1/1-5.1:1.3/0003:054C:09CC.0009/input/input34
[70228.457524] input: Sony Interactive Entertainment Wireless Controller as /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:07:00.1/usb1/1-5/1-5.1/1-5.1:1.3/0003:054C:09CC.0009/input/input32
[70228.457766] sony 0003:054C:09CC.0009: input,hidraw8: USB HID v81.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-0000:07:00.1-5.1/input3
[70228.583185] usbcore: registered new interface driver snd-usb-audio

Bringing the container up with:

docker run --rm -it \
  --cap-add NET_ADMIN \
  --net host \
  --device /dev/input \
  --device /dev/snd \
  --device /dev/nvidia-modeset \
  --device /dev/nvidia0 \
  --device /dev/nvidiactl \
  -v /mnt/e/Emulation/Bios/PS2:/bios:ro \
  -v /mnt/e/Emulation/Roms/PS2:/games:ro \
  -e PUID=$(id -u) \
  -e PGID=$(id -g) \
  -e DISPLAY=unix$DISPLAY \
  -e LANG=${LANG:-en_US.UTF-8} \
  -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
  -v /etc/machine-id:/etc/machine-id:ro \
  -v $HOME/.config/pulse:/home/ubuntu/.config/pulse:ro \
  -v /run/user/$(id -u)/pulse:/run/user/$(id -u)/pulse:ro \
  -v /run/udev/data:/run/udev/data:ro \
  -v /etc/localtime:/etc/localtime:ro \
  andrewmackrodt/pcsx2-x11

I then see the PS4 controller recognised in the pcsx log output:

	Opening USB
onepad: controller (Sony Interactive Entertainment Wireless Controller) detected with rumble support, GUID:030000004c050000cc09000011810000

It worked as expected with Simpsons Hit and Run.

Edit: gamepad-tool also detects my controller:

ubuntu@6e9b069f9db9:~$ gamepad-tool
[LOG] SDL2 Gamepad Tool v1.2 by General Arcade (compiled with SDL version 2.0.7, DLL version 2.0.10)
[LOG] Website: http://generealarcade.com/gamepadtool/

[LOG] Searching gamepads...
[LOG] Found 1 gamepad(s):
[LOG] "PS4 Controller", 030000004c050000cc09000011810000 (mapping available)

Edit 2: Adding my docker version:

$ docker --version
Docker version 20.10.6, build 370c289

$ dpkg -l | grep ii | grep docker
ii  docker-ce                                     5:20.10.6~3-0~ubuntu-bionic                                        amd64        Docker: the open-source application container engine
ii  docker-ce-cli                                 5:20.10.6~3-0~ubuntu-bionic                                        amd64        Docker CLI: the open-source application container engine
ii  docker-ce-rootless-extras                     5:20.10.6~3-0~ubuntu-bionic                                        amd64        Rootless support for Docker.
ii  docker-compose                                1.25.0-1                                                           all          Punctual, lightweight development environments using Docker
ii  docker-scan-plugin                            0.7.0~ubuntu-bionic                                                amd64        Docker scan cli plugin.
ii  golang-docker-credential-helpers              0.6.3-1                                                            amd64        native stores to safeguard Docker credentials
ii  python3-docker                                4.1.0-1                                                            all          Python 3 wrapper to access docker.io's control socket
ii  python3-dockerpty                             0.4.1-2                                                            all          Pseudo-tty handler for docker Python client (Python 3.x)

from dockerfiles.

pythys avatar pythys commented on May 31, 2024

I would like to thank you again for taking so much time trying to fix this. Really appreciate it.

Anyway following your steps, first the output of dmesg when connecting using bluetooth:

84014.926431] input: Wireless Controller Touchpad as /devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/bluetooth/hci0/hci0:256/0005:054C:09CC.001C/input/input82
[84014.926950] input: Wireless Controller Motion Sensors as /devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/bluetooth/hci0/hci0:256/0005:054C:09CC.001C/input/input83
[84014.927508] input: Wireless Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/bluetooth/hci0/hci0:256/0005:054C:09CC.001C/input/input81
[84014.929006] sony 0005:054C:09CC.001C: input,hidraw0: BLUETOOTH HID v81.00 Gamepad [Wireless Controller] on 38:ba:f8:d1:36:29

Next the output of the container:

nvidia driver mismatch Host(465.31) <=> Container(460.80)
Automatic driver match will be attempted ...
The latest package will be installed libnvidia-gl-465=465.27-0ubuntu0.20.04.2
Failed to locate a package with the same driver version
X11 apps may fail; mount drivers from your host as a volume
and set LD_LIBRARY_PATH to include the volume
https://github.com/andrewmackrodt/dockerfiles/blob/master/ubuntu-x11-i386/README.md#nvidia-driver-note
Removing old packages libnvidia-common-460 libnvidia-gl-460:i386  ...
Installing packages libnvidia-gl-465=465.27-0ubuntu0.20.04.2 libnvidia-gl-465:i386=465.27-0ubuntu0.20.04.2 ...
debconf: delaying package configuration, since apt-utils is not installed

(PCSX2:758): dbind-WARNING **: 02:48:50.568: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
Interface is initializing.  Entering Pcsx2App::OnInit!
Applying operating system default language...
Command line parsing...
Command line parsed!
Releasing host memory maps for virtual systems...

The only thing that I see as a suspect is this org.a11y.Bus which has to do with dbus but I'm not sure. BUT I am 100% sure that the controller works just fine without docker and I can run pcsx2 outside docker.

from dockerfiles.

pythys avatar pythys commented on May 31, 2024

Seems like an environment issue and not worth effort more than that was put into it. Hence closing this ticket

from dockerfiles.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.