Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] USB device not accessible from SSH terminal unless also logged in on console

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
frogandspanner
Posts: 1
Joined: 2023-03-16 15:53

[Software] USB device not accessible from SSH terminal unless also logged in on console

#1 Post by frogandspanner »

I have a problem with linuxCNC accessing a USB joypad device.

I am unsure if the problem lies within linuxcnc or Debian - although experience suggests the latter.
------

Problem summary: program (halrun/hal_input.py) fails to open joypad/gamepad via ssh terminal, unless also logged in [as tc] on console – simultaneous logging in as root on console does not solve the problem.
“No input devices could be opened. This usually indicates a misconfigured system. Please read the section 'PERMISSIONS AND UDEV' in the hal_input manpage”

Details:

joypad already plugged into linuxcncdev usb at boot time.

> ssh -X linuxcncdev [from main computer]
[login as tc]

[OPSYS VERSION]

> cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian

> hostnamectl
Kernel: Linux 4.19.0-21-rt-amd64


[tc CONTEXT]

> groups
tc dialout cdrom sudo audio video plugdev wireshark

[DEVICE INFO]

> cat /etc/udev/rules.d/67-plugdev.rules
ATTR{idProduct}=="0001", ATTR{idVendor}=="0810",MODE="0660",GROUP="plugdev"

> lsusb
Bus 001 Device 013: ID 0810:0001 Personal Communication Systems, Inc. Dual PSX Adaptor

> cat /proc/bus/input/devices
I: Bus=0003 Vendor=0810 Product=0001 Version=0110
N: Name=" USB Gamepad "
P: Phys=usb-0000:00:1a.0-1.2/input0
S: Sysfs=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:0810:0001.000A/input/input26
U: Uniq=
H: Handlers=event4 js0
B: PROP=0
B: EV=20001b
B: KEY=fff00000000 0 0 0 0
B: ABS=30027
B: MSC=10
B: FF=107030000 0

> ls -l /dev/bus/usb/001/013
crw-rw---- 1 root plugdev 189, 12 Mar 16 14:13 /dev/bus/usb/001/013

> ls -l /dev/input/js0
crw-rw-r--+ 1 root input 13, 0 Mar 16 14:12 /dev/input/js0

[OTHER INFO]
jstest-gtk opens this OK.


[THE PROBLEM]
> halrun
halcmd: loadusr -W hal_input -KRAL Gamepad

No input devices could be opened. This usually indicates a misconfigured
system. Please read the section 'PERMISSIONS AND UDEV' in the hal_input
manpage

If also log in via console and desktop environment, but return to ssh terminal, then loadusr -W hal_input -KRAL Gamepad works.

Logged in as root or tc on console,
> ls -l /dev/bus/usb/001/013
crw-rw---- 1 root plugdev 189, 12 Mar 16 14:13 /dev/bus/usb/001/013

lindi
Debian Developer
Debian Developer
Posts: 412
Joined: 2022-07-12 14:10
Has thanked: 1 time
Been thanked: 77 times

Re: [Software] USB device not accessible from SSH terminal unless also logged in on console

#2 Post by lindi »

I would troubleshoot this using strace, it shows you system calls that a program makes. For example:

Login locally and run

Code: Select all

strace -o strace-local.txt -f -s4096 halrun
and then quit the program immediately. Then login remotely and run

Code: Select all

strace -o strace-remote.txt -f -s4096 halrun
Now you can use

Code: Select all

meld <(grep open strace-local.txt) <(grep open strace-remote.txt)
to see exactly how these situations differ with respect to opening files.

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: [Software] USB device not accessible from SSH terminal unless also logged in on console

#3 Post by Aki »

@frogandspanner : Did you make any progress?
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

User avatar
kent_dorfman766
Posts: 535
Joined: 2022-12-16 06:34
Location: socialist states of america
Has thanked: 57 times
Been thanked: 70 times

Re: [Software] USB device not accessible from SSH terminal unless also logged in on console

#4 Post by kent_dorfman766 »

I've had the same issues as a consequence of product licensing trickery. Cobham/Gaisler, a european company providing space certified tools and components, locks down their devboard JTAG programmer access so that you can only use it from the console. SSH won't cut it...Given their exuberant pricing and monopoly on the market I've taken to trying to find other vendors or custom solutions to no have to deal with that vendor at all if possible.

But to the point, never figured it out...They weren't paying enough to solve everyone elses problems when I had my own boards to contend with. so yes, this is "a thing" but I'm surprised it is surfacing on gamepads?

lindi
Debian Developer
Debian Developer
Posts: 412
Joined: 2022-07-12 14:10
Has thanked: 1 time
Been thanked: 77 times

Re: [Software] USB device not accessible from SSH terminal unless also logged in on console

#5 Post by lindi »

kent_dorfman766 wrote: 2023-03-22 17:39 But to the point, never figured it out...They weren't paying enough to solve everyone elses problems when I had my own boards to contend with. so yes, this is "a thing" but I'm surprised it is surfacing on gamepads?
I doubt this has anything to do with the USB device itself. It is a standard feature in Debian that local peripherals (USB drives, microphones, etc.) are accessible for users that have an active local session. In many cases this is technically implemented with linux ACLs as those can be set dynamically in response to what is happening. (With groups like dialout and plugdev you couldn't do this as processes that were already started would retain their access.)

You can see this action if you install Debian 11 with the defaults and run for example.

Code: Select all

while true; do getfacl /dev/video0; sleep 1; done
When I am logged in the output is

Code: Select all

getfacl: Removing leading '/' from absolute path names
# file: dev/video0
# owner: root
# group: video
user::rw-
user:lindi:rw-
group::rw-
mask::rw-
other::---
If I switch to another virtual console the output changes to

Code: Select all

getfacl: Removing leading '/' from absolute path names
# file: dev/video0
# owner: root
# group: video
user::rw-
group::rw-
mask::rw-
other::---

If I switch to the gdm3 login screen it again changes:

Code: Select all

getfacl: Removing leading '/' from absolute path names
# file: dev/video0
# owner: root
# group: video
user::rw-
user:Debian-gdm:rw-
group::rw-
mask::rw-
other::---
The "+" in the ls output of the original post shows that ACLs are set. However, without strace output I cannot say which exact device is the problem here.

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: [Software] USB device not accessible from SSH terminal unless also logged in on console

#6 Post by Aki »

@frogandspanner : Did you make any progress ?

@lindi: What you observed in the previous post is a good point.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: [Software] USB device not accessible from SSH terminal unless also logged in on console

#7 Post by Aki »

@frogandspanner : you could test how the OS responds to the device connection to the computer. You can unplung the USB Gamepad (game controller), then you can issue the following command:

Code: Select all

udevadm monitor --kernel --udev --property | tee udev.log
The previous command should show the command that are executed when udev recognizes it and it configures the required permission for the block or character device. Pressing CTRL-C you will stop it. In the file named udev.log will be stored the output of the program that you can share.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Post Reply