Package: sysfsutils
Version: 2.1.0+repack-1
Severity: important

Dear Maintainer,

I found that /etc/init.d/sysfs did not set any attributes. When trying
on the command line I got:

merkaba:/sys> LANG=C /etc/init.d/sysfsutils restart
Setting sysfs variables...#

When replacing #!/bin/sh -e with #!/bin/bash -e I get:

merkaba:/sys> LANG=C /etc/init.d/sysfsutils restart
Setting sysfs variables.../etc/init.d/sysfsutils: line 51: echo: write error: 
Operation not permitted

When tracing via set -x I get:

Setting sysfs variables...+ sed 's/#.*$//; /^[[:space:]]*$/d; 
              
s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1
 \2 \3/' /etc/sysfs.conf
+ read f1 f2 f3
+ '[' module/pcie_aspm/parameters/policy = mode -a -n powersave -a -n '' ']'
+ '[' module/pcie_aspm/parameters/policy = owner -a -n powersave -a -n '' ']'
+ '[' module/pcie_aspm/parameters/policy -a -n powersave -a -z '' ']'
+ '[' -f /sys/module/pcie_aspm/parameters/policy ']'
+ echo -n powersave
+ echo powersave
/etc/init.d/sysfsutils: line 51: echo: write error: Operation not permitted

And indeed the parameter is no longer setable with kernel 3.2.9:

merkaba:/sys> LANG=C echo "powersave" > module/pcie_aspm/parameters/policy
echo: write error: operation not permitted
merkaba:/sys#1> ls -l module/pcie_aspm/parameters/policy
-rw-r--r-- 1 root root 4096 Mär  9 13:00 module/pcie_aspm/parameters/policy
merkaba:/sys> cat module/pcie_aspm/parameters/policy
[default] performance powersave 
merkaba:/sys>

(whyever - anyway, newer kernels should handle PCIe ASPM just well)


But the script didn´t report the failure with

merkaba:/sys> ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Mär  1 11:09 /bin/sh -> dash

except for a missing newline that Z-Shell marked with a "#" 

Expected results:

The script reports the failure.

Even better:

The script does not abort on failure but tries to set the other attributes
in there as well while still reporting which attributes it failed to set
and why. I can open a different bug report about that if wanted.

Thanks,
Martin


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (120, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages sysfsutils depends on:
ii  libc6      2.13-27
ii  libsysfs2  2.1.0+repack-1

sysfsutils recommends no packages.

sysfsutils suggests no packages.

-- Configuration Files:
Please note: This was an attempt to make the script continue when writing
an attribute fails. But it does not do any error reporting.

I added

echo "$f2" > "/sys/$f1" 2>/dev/null || true
                        ^^^^^^^^^^^^^^^^^^^

to it.

/etc/init.d/sysfsutils changed:
CONFFILE=/etc/sysfs.conf
[ -r "$CONFFILE" ] || exit 0
. /lib/lsb/init-functions
case "$1" in
    start|restart|force-reload)
        log_begin_msg "Setting sysfs variables..."
        sed  's/#.*$//; /^[[:space:]]*$/d; 
              
s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1
 \2 \3/' \
              $CONFFILE | {
            while read f1 f2 f3; do
                if [ "$f1" = "mode" -a -n "$f2" -a -n "$f3" ]; then
                    if [ -f "/sys/$f2" ]; then
                        chmod "$f3" "/sys/$f2"
                    else
                        log_failure_msg "unknown attribute $f2"
                    fi
                elif [ "$f1" = "owner" -a -n "$f2" -a -n "$f3" ]; then
                    if [ -f "/sys/$f2" ]; then
                        chown "$f3" "/sys/$f2"
                    else
                        log_failure_msg "unknown attribute $f2"
                    fi
                elif [ "$f1" -a -n "$f2" -a -z "$f3" ]; then
                    if [ -f "/sys/$f1" ]; then
                        # Some fields need a terminating newline, others
                        # need the terminating newline to be absent :-(
                         echo -n "$f2" > "/sys/$f1" 2>/dev/null ||
                            echo "$f2" > "/sys/$f1" 2>/dev/null || true
                    else
                        log_failure_msg "unknown attribute $f1"
                    fi
                else
                    log_failure_msg "syntax error in $CONFFILE: '$f1' '$f2' 
'$f3'"
                    log_end_msg 1
                    exit 1
                fi
            done
        }
        log_end_msg 0
        ;;
    stop)
        ;;
    *)
        echo "Usage: /etc/init.d/sysfsutils {start|stop|force-reload|restart}"
        exit 1
        ;;
esac

/etc/sysfs.conf changed:
module/pcie_aspm/parameters/policy = powersave
class/scsi_host/host1/link_power_management_policy = min_power
class/scsi_host/host2/link_power_management_policy = min_power
class/scsi_host/host3/link_power_management_policy = min_power
class/scsi_host/host4/link_power_management_policy = min_power
class/scsi_host/host5/link_power_management_policy = min_power
class/scsi_host/host6/link_power_management_policy = min_power


-- no debconf information



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to