LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-07-2010, 12:51 AM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
envar PATH when run by udev - poor choice?


Hello

The value of envar PATH for processes run by the udev system is "/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.". If peer review (that's you!) agrees it is a poor choice how can I submit an enhancement request? The man pages do not say anything about bug reporting.

Here are reasons why it is a bizarre choice:
  • There is no /gnu/bin directory on as-installed Slackware.
  • /usr/local/bin is empty (or very nearly empty?) on as-installed Slackware.
  • Processes running under udev run as root; having "." in PATH is not good practice when running as root.
  • Processes running under udev are likely to be doing "system" work so executables from the sbin directories are likely to be used. For example, udevadm itself is /sbin/udevadm.
Presumably this PATH is set by udevd itself; it is not the PATH in effect when udevd is started by rc.M.

AFAIK udevd's PATH is not configurable.

The workaround is for processes initiated by udev to set a sane PATH for themselves, perhaps "/usr/sbin:/sbin:/usr/bin:/bin".

EDIT: seen on Slackware 13.0 32 bit.

EDIT2: rc.udev is run from rc.S, not rc.M as stated above

Best

Charles

Last edited by catkin; 04-07-2010 at 02:22 PM.
 
Old 04-07-2010, 01:20 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Apparently older udevd cleaned PATH but not anymore (circumstantial). W/o need for patching, could starting Udev like 'env PATH=/usr/sbin:/sbin:/usr/bin:/bin /sbin/udevd --whatever-args' work? That is, if the "Steps to reproduce" method shows that helper apps inherit that path.

Last edited by unSpawn; 04-07-2010 at 03:12 PM. Reason: //unhide link target
 
Old 04-07-2010, 02:21 PM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by unSpawn View Post
Apparently older udevd cleaned PATH but not anymore (circumstantial: ). W/o need for patching, could starting Udev like 'env PATH=/usr/sbin:/sbin:/usr/bin:/bin /sbin/udevd --whatever-args' work? That is, if the "Steps to reproduce" method shows that helper apps inherit that path.
Thanks unSpawn Have modified rc.udev and will report result after next reboot.
 
Old 04-08-2010, 12:42 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Further investigation confirms the initial impression that udev changes envar PATH, setting it to "/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:."
  1. During execution of rc.udev, immediately before starting the udev daemon, $PATH is "/sbin:/bin".
  2. The command used to start the udev daemon was modified to
    Code:
    env PATH=/usr/sbin:/sbin:/usr/bin:/bin/sbin/ udevd --daemon
  3. A script called via a udev rule was modified to log $PATH and showed "/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:."
Looking deeper, trying to find out where this PATH is set:
Code:
root@CW8:~# strings /sbin/udevd | grep sbin
root@CW8:~# file /sbin/udevd
/sbin/udevd: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped
root@CW8:~# ldd /sbin/udevd
        linux-gate.so.1 =>  (0xffffe000)
        libc.so.6 => /lib/libc.so.6 (0xb7eb3000)
        /lib/ld-linux.so.2 (0xb802d000)
And there I got stuck.

Last edited by catkin; 04-08-2010 at 12:43 AM.
 
Old 04-08-2010, 01:07 AM   #5
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
Perhaps an strace would reveal something.
 
Old 04-08-2010, 02:58 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by mRgOBLIN View Post
Perhaps an strace would reveal something.
Thanks mRgOBLIN

I tried that but the strace output stopped before a device could be plugged in. strace showed reading many udev rules and ended with
Code:
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7d9c708) = 6604
munmap(0xb7d2d000, 163840)              = 0
close(4)                                = 0
close(5)                                = 0
exit_group(0)                           = ?
I guess it "exec"ed a new process and the new process was not "strac"ed ???

Unless there are any further suggestions on how to investigate this so I can make a more useful request, how can I submit an enhancement request?
 
Old 04-15-2010, 09:56 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Further investigation shows that the $PATH is bash' default so presumably udevd is not setting a PATH environment variable
Code:
c@CW8:~$ unset PATH
c@CW8:~$ /bin/bash
c@CW8:~$ echo $PATH
/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
 
Old 04-15-2010, 10:00 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by catkin View Post
... how can I submit an enhancement request?
I sent an email to info <antelope> AT <fish> slackware.com asking them to consider modifying udevd to set a PATH or bash to have a default PATH that is useful on Slackware.
 
  


Reply

Tags
path, udev, udevd


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
udev on /dev/disk/by-path devices thllgo Linux - Server 4 11-06-2008 05:20 PM
LXer: Poor Microsoft Gives Poor Software to Youngsters, Hopeless LXer Syndicated Linux News 0 02-20-2008 07:20 AM
udev RUN+= doesn't seem to work PlancksCnst Linux - General 18 05-15-2007 06:44 PM
Can't run openoffice from bash-script with udev krisealv Programming 1 04-16-2007 11:17 AM
udev does not run program on remove uselpa Slackware 2 10-22-2006 04:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration