Public bug reported:

I have a script that is triggered by a udev rule, and that needs to
connect to a remote host.

The example below works fine in 16.04, but fails in 18.04. It seems that
the process executing the script is somehow limited wrt. network access.
The script works fine when started from a shell prompt.

To reproduce:


- create /tmp/myscript:

#/bin/sh
wget -o /tmp/wget.log -O /tmp/index.html http://www.google.com


- create /etc/udev/rules.d/52-netaccess.rules

ACTION=="add", ATTRS{idVendor}=="cafe", MODE="0660", GROUP="root",
SUBSYSTEM=="usbmisc", RUN+="/tmp/myscript"


- Plugin a USB device with vendor ID 0xcafe, and check the wget output in 
/tmp/wget.log. 

On ubuntu 18.04 wget fails with this output:

--2019-08-19 14:49:43--  http://www.google.com/
Resolving www.google.com (www.google.com)... failed: Name or service not known.
wget: unable to resolve host address 'www.google.com'


If I use an IP address in the URL there is no resolve error, but then wget 
blocks in the socket connect() syscall (according to strace). At some point the 
script is killed.

** Affects: udev (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1840772

Title:
  Script cannot access network when triggered by udev rule

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/udev/+bug/1840772/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to