Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 217082 - app-misc/dnetc-2.9015.504 error in /etc/init.d/dnetc
Summary: app-misc/dnetc-2.9015.504 error in /etc/init.d/dnetc
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Chris Gianelloni (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-10 03:23 UTC by Arthur Hagen
Modified: 2008-04-10 05:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur Hagen 2008-04-10 03:23:05 UTC
dnetc reports an error on startup:

/etc/init.d/dnetc: line 45: /sys/kernel/uids/104/cpu_share: No such file or directory

Previous versions do not have this error.

The relevant lines in /etc/init.d/dnetc read:

  # fair group cpu scheduler
  [ -d /sys/kernel/uids/ ] && echo 2 > \
    /sys/kernel/uids/$(grep -w dnetc /etc/passwd | cut -d: -f3)/cpu_share

In this case the file /sys/kernel/uids/104/cpu_share exists:

# ls -Zd /sys /sys/kernel /sys/kernel/uids /sys/kernel/uids/104 /sys/kernel/uids/104/cpu_share
drwxr-xr-x  root root system_u:object_r:sysfs_t  /sys
drwxr-xr-x  root root system_u:object_r:sysfs_t  /sys/kernel
drwxr-xr-x  root root system_u:object_r:sysfs_t  /sys/kernel/uids
drwxr-xr-x  root root system_u:object_r:sysfs_t  /sys/kernel/uids/104
-rw-r--r--  root root system_u:object_r:sysfs_t  /sys/kernel/uids/104/cpu_share


Reproducible: Always




The problem appears to be that when no other dnetc processes exist, the /sys/kernel/uids/{UID} directory doesn't exist either.

Suggested quick fix:

45,46c45,47
<       [ -d /sys/kernel/uids/ ] && echo 2 > \
<               /sys/kernel/uids/$(grep -w dnetc /etc/passwd | cut -d: -f3)/cpu_share
---
>       uidpath="/sys/kernel/uids/`id -u dnetc`"
>       [ -d $uidpath ] && echo 2 >$uidpath
>       unset uidpath

(Apropos, the proposed fix also fixeds another bug:  grepping /etc/passwd is wrong, because the actual user ID might be obtained through NIS or LDAP no matter what the passwd entry states.  "id" is in coreutils, so no extra dependencies would be needed.)
Comment 1 Arthur Hagen 2008-04-10 03:24:36 UTC
Err.  The correct patch is:

45,46c45,47
<       [ -d /sys/kernel/uids/ ] && echo 2 > \
<               /sys/kernel/uids/$(grep -w dnetc /etc/passwd | cut -d:
-f3)/cpu_share
---
>       uidpath="/sys/kernel/uids/`id -u dnetc`"
>       [ -d $uidpath ] && echo 2 >$uidpath/cpu_share
>       unset uidpath
Comment 2 Chris Gianelloni (RETIRED) gentoo-dev 2008-04-10 05:42:49 UTC
Oops... It looked good, anyway... hehe

I've fixed this in CVS now.  Thanks...