[Bug 1840772] Re: Script cannot access network when triggered by udev rule

Kai Kasurinen 1840772 at bugs.launchpad.net
Thu Aug 6 21:14:39 UTC 2020


** Package changed: udev (Ubuntu) => systemd (Ubuntu)

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

Title:
  Script cannot access network when triggered by udev rule

Status in systemd package in Ubuntu:
  New

Bug description:
  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.

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



More information about the foundations-bugs mailing list