<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>161290</bug_id>
          
          <creation_ts>2007-01-10 07:52 0000</creation_ts>
          <short_desc>net-wireless/ipw3945d broken permissions handling in init script</short_desc>
          <delta_ts>2007-12-05 16:36:17 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Ebuilds</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>158420</blocked>
          
          <everconfirmed>1</everconfirmed>
          <reporter>taiyang.chen@gmail.com</reporter>
          <assigned_to>phreak@gentoo.org</assigned_to>
          <cc>jkt@gentoo.org</cc>
    
    <cc>juan@xdracco.net</cc>
    
    <cc>pacho@condmat1.ciencias.uniovi.es</cc>
    
    <cc>rl03@gentoo.org</cc>
    
    <cc>sawk.ita@gmail.com</cc>
    
    <cc>seemant@gentoo.org</cc>
    
    <cc>will.briggs@gmail.com</cc>

      

      
          <long_desc isprivate="0">
            <who>taiyang.chen@gmail.com</who>
            <bug_when>2007-01-10 07:52:31 0000</bug_when>
            <thetext>hi,

I am using these to get my wireless card working:

gentoo-sources-2.6.18-r6
ieee80211-1.2.15
ipw3945d-1.7.22-r4
ipw3945-1.1.3
wireless-tools-28

After a recent update my ipw3945d init script stopped working (loading on boot) without using &quot;rmmod ipw3945 &amp;&amp; modprobe ipw3945&quot;

After reading the ipw3945d ChangeLog i found out that this was recently changed:

08 Jan 2007; Christian Heim &lt;phreak@gentoo.org&gt;
-ipw3945d-1.7.22-r3.ebuild, ipw3945d-1.7.22-r4.ebuild:
Removing the old revision, using chmod / chown directly (sue me, fowners /
fperms won&apos;t work on files outside of $).

So i found these two chown/chmod lines inside my /etc/init.d/ipw3945d and deleted them and everything works fine now. It turns out that chown &quot;ipw3945d&quot; group to the /sys/bus/pci/drivers/ipw3945/00*/cmd did not give permission to root so ipw3945d could not start the wireless card. I also added &quot;sleep 0.5&quot; to make it fully working for loading up my net.eth1 (which i believe was the original initscript).

This is what my /etc/init.d/ipw3945d look like now:

#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-wireless/ipw3945d/files/ipw3945d-init.d,v 1.4 2006/12/22 10:11:26 phreak Exp $

PIDFILE=/var/run/ipw3945d/ipw3945d.pid

depend() {
        before net
}

check() {
        # Let&apos;s check if the pidfile is still present.
        if [ -f &quot;${PIDFILE}&quot; ] ; then
                eerror &quot;The pidfile ($PIDFILE) is still present.&quot;
                eerror &quot;Please check that the daemon isn&apos;t running!&quot;
                return 1
        fi
}

start() {
        check
        ebegin &quot;Starting ipw3945d&quot;
        start-stop-daemon --start --exec /sbin/ipw3945d --pidfile ${PIDFILE} -- \
                --pid-file=${PIDFILE} ${ARGS}
        sleep 0.5
        eend ${?}
}

stop() {
        ebegin &quot;Stopping ipw3945d&quot;
        start-stop-daemon --stop --exec /sbin/ipw3945d --pidfile ${PIDFILE}
        eend ${?}
}



I hope this initscript could be fixed/updated to fix permission problems.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2007-01-10 08:02:24 0000</bug_when>
            <thetext>*** Bug 161047 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jkt@gentoo.org</who>
            <bug_when>2007-01-10 10:58:31 0000</bug_when>
            <thetext>(In reply to comment #0)
&gt; So i found these two chown/chmod lines inside my /etc/init.d/ipw3945d and
&gt; deleted them and everything works fine now. It turns out that chown &quot;ipw3945d&quot;
&gt; group to the /sys/bus/pci/drivers/ipw3945/00*/cmd did not give permission to
&gt; root so ipw3945d could not start the wireless card. I also added &quot;sleep 0.5&quot; to
&gt; make it fully working for loading up my net.eth1 (which i believe was the
&gt; original initscript).

The intention is that ipw3945d doesn&apos;t run as root. What are the permissions of /sbin/ipw3945d on your system?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2007-01-10 14:28:37 0000</bug_when>
            <thetext>(In reply to comment #2)
&gt; The intention is that ipw3945d doesn&apos;t run as root. What are the permissions of
&gt; /sbin/ipw3945d on your system?

The intention may be fine but this totally kills the (already pretty borked) thing, rendering it useless. </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>taiyang.chen@gmail.com</who>
            <bug_when>2007-01-10 19:03:40 0000</bug_when>
            <thetext>(In reply to comment #2)
&gt; (In reply to comment #0)
&gt; &gt; So i found these two chown/chmod lines inside my /etc/init.d/ipw3945d and
&gt; &gt; deleted them and everything works fine now. It turns out that chown &quot;ipw3945d&quot;
&gt; &gt; group to the /sys/bus/pci/drivers/ipw3945/00*/cmd did not give permission to
&gt; &gt; root so ipw3945d could not start the wireless card. I also added &quot;sleep 0.5&quot; to
&gt; &gt; make it fully working for loading up my net.eth1 (which i believe was the
&gt; &gt; original initscript).
&gt; 
&gt; The intention is that ipw3945d doesn&apos;t run as root. What are the permissions of
&gt; /sbin/ipw3945d on your system?
&gt; 
here it is:
-r-Sr-x--- 1 root root 69176 Jan 10 02:17 /sbin/ipw3945d

I don&apos;t think it&apos;s this permission that matters.
ipw3945d cannot read the hardware at /sys/bus/pci/drivers/ipw3945/00*/cmd if it is owned by the ipw3945d group. A new modprobe changed the ownership back to root so ipw3945d can find the wireless card again. I am not sure how to make this intention work. I tried making a new group called ipw3945d but didn&apos;t do anything to it.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jkt@gentoo.org</who>
            <bug_when>2007-01-10 20:12:58 0000</bug_when>
            <thetext>(In reply to comment #4)
&gt; here it is:
&gt; -r-Sr-x--- 1 root root 69176 Jan 10 02:17 /sbin/ipw3945d

It should be owned by the ipw3945d user, not by root. Could you please sync your tree and re-emerge the ipw3945d-1.7.22-r4 ebuild (yup, once again)? Christian has recently added stuff that should take care of such problems...

&gt; I don&apos;t think it&apos;s this permission that matters.
&gt; ipw3945d cannot read the hardware at /sys/bus/pci/drivers/ipw3945/00*/cmd if it
&gt; is owned by the ipw3945d group. A new modprobe changed the ownership back to
&gt; root so ipw3945d can find the wireless card again. I am not sure how to make
&gt; this intention work. I tried making a new group called ipw3945d but didn&apos;t do
&gt; anything to it.

Everything should work out-of-box. If it doesn&apos;t and you aren&apos;t using a stale ebuild, there&apos;s a bug we&apos;d like to fix.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>taiyang.chen@gmail.com</who>
            <bug_when>2007-01-10 20:53:35 0000</bug_when>
            <thetext>Yes i synced and re-emerged ipw3945d-1.7.22-r4 but the problem is still there.
Manually doing &quot;chown ipw3945d /sbin/ipw3945d&quot; did not help either.

Here are some things i found while emerging ipw3945d:

First this shows up:

ACCESS DENIED  chmod:     /sbin/ipw3945d
chmod: changing permissions of `/sbin/ipw3945d&apos;: Permission denied

Then, these seem to be helpful:

* Fixing permissions of /sbin/ipw3945d ...                               [ ok ]
* Fixing ownership of /var/run/ipw3945d ...                              [ ok ]

But after this /sbin/ipw3945d is owned by root again! instead of ipw3945d.

Only deleting these 2 lines in /etc/init.d/ipw3945d makes it work:

chown ipw3945d /sys/bus/pci/drivers/ipw3945/00*/cmd
chmod a-w,u+rw /sys/bus/pci/drivers/ipw3945/00*/cmd</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2007-01-11 01:18:16 0000</bug_when>
            <thetext>(In reply to comment #6)
&gt; ACCESS DENIED  chmod:     /sbin/ipw3945d
&gt; chmod: changing permissions of `/sbin/ipw3945d&apos;: Permission denied

Someone should fix src_install to not try to fiddle w/ perms on live fs, it&apos;s violating sandbox... :P
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rl03@gentoo.org</who>
            <bug_when>2007-01-11 16:19:33 0000</bug_when>
            <thetext>exactly the same problem here, workaround seems to work.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>pacho@condmat1.ciencias.uniovi.es</who>
            <bug_when>2007-01-11 21:49:12 0000</bug_when>
            <thetext>Same problem with sandbox violation here. Please, fix it

Thanks</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jkt@gentoo.org</who>
            <bug_when>2007-01-12 12:41:08 0000</bug_when>
            <thetext>Could you please resync your tree and re-emerge the ipw3945d-1.7.22-r4 version yet again? Christian has added a fix for this issue.

It works for me on my test system in default configuration, ie. the daemon runs as non-root. If you can&apos;t make it work, please reopen.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jkt@gentoo.org</who>
            <bug_when>2007-01-12 14:11:15 0000</bug_when>
            <thetext>(In reply to comment #10)
&gt; It works for me on my test system in default configuration

Oops, it doesn&apos;t, I was using older init.d/conf.d files.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jkt@gentoo.org</who>
            <bug_when>2007-01-12 14:23:20 0000</bug_when>
            <thetext>Created an attachment (id=106682)
patch against ipw3945d-1.7.22-r4.ebuild (CVS 1.5)

Could you please try to apply this patch to the recent -r4 ebuild (ie. CVS version &quot;1.5&quot; as you can see on the third line of the ebuild)? It works for me.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>phreak@gentoo.org</who>
            <bug_when>2007-01-12 16:50:01 0000</bug_when>
            <thetext>Thanks to Jan, I fixed all the issues in CVS. Feel free to reopen this bug if its still not working after your next sync.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>taiyang.chen@gmail.com</who>
            <bug_when>2007-01-12 19:12:45 0000</bug_when>
            <thetext>Thanks problem solved here.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jkt@gentoo.org</who>
            <bug_when>2007-12-05 16:36:17 0000</bug_when>
            <thetext>*** Bug 194996 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>106682</attachid>
            <date>2007-01-12 14:23 0000</date>
            <desc>patch against ipw3945d-1.7.22-r4.ebuild (CVS 1.5)</desc>
            <filename>patch</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIC91c3IvcG9ydGFnZS9uZXQtd2lyZWxlc3MvaXB3Mzk0NWQvaXB3Mzk0NWQtMS43LjIyLXI0
LmVidWlsZAkyMDA3LTAxLTExIDIwOjA2OjE3LjAwMDAwMDAwMCArMDEwMAorKysgL3Vzci9sb2Nh
bC9wb3J0YWdlL25ldC13aXJlbGVzcy9pcHczOTQ1ZC9pcHczOTQ1ZC0xLjcuMjItcjQuZWJ1aWxk
CTIwMDctMDEtMTIgMTU6MTU6NTUuNzg4NzUxODk3ICswMTAwCkBAIC0zNSw2ICszNSw3IEBACiAK
ICAgICAgICAga2VlcGRpciAvdmFyL3J1bi9pcHczOTQ1ZAogICAgICAgICBjaG93biBpcHczOTQ1
ZDpyb290ICIke0R9L3Zhci9ydW4vaXB3Mzk0NWQiCisgICAgICAgIGNobW9kIDA3NTUgIiR7RH0v
dmFyL3J1bi9pcHczOTQ1ZCIKIAogICAgICAgICBuZXdjb25mZCAiJHtGSUxFU0RJUn0vJHtQTn0t
Y29uZi5kIiAke1BOfQogICAgICAgICBuZXdpbml0ZCAiJHtGSUxFU0RJUn0vJHtQTn0taW5pdC5k
IiAke1BOfQpAQCAtNjIsMTMgKzYzLDE0IEBACiAKICAgICAgICAgIyBGaXggdGhlIHBlcm1pc3Np
b25zIG9mIC9zYmluL2lwdzM5NDVkCiAgICAgICAgIGViZWdpbiAiRml4aW5nIHBlcm1pc3Npb25z
IG9mICR7Uk9PVH1zYmluL2lwdzM5NDVkIgotICAgICAgICBjaG1vZCAwNDQ1MCAiJHtST09UfXNi
aW4vaXB3Mzk0NWQiCiAgICAgICAgIGNob3duIGlwdzM5NDVkOnJvb3QgIiR7Uk9PVH1zYmluL2lw
dzM5NDVkIgorICAgICAgICBjaG1vZCAwNDQ1MCAiJHtST09UfXNiaW4vaXB3Mzk0NWQiCiAgICAg
ICAgIGVlbmQgJD8KIAogICAgICAgICAjIEZpeGluZyBvd25lcnNoaXAgb2YgL3Zhci9ydW4vaXB3
Mzk0NWQKICAgICAgICAgZWJlZ2luICJGaXhpbmcgb3duZXJzaGlwIG9mICR7Uk9PVH12YXIvcnVu
L2lwdzM5NDVkIgogICAgICAgICBjaG93biBpcHczOTQ1ZDpyb290ICIke1JPT1R9dmFyL3J1bi9p
cHczOTQ1ZCIKKyAgICAgICAgY2htb2QgMDc1NSAiJHtST09UfXZhci9ydW4vaXB3Mzk0NWQiCiAg
ICAgICAgIGVlbmQgJD8KIAogICAgICAgICBlY2hvCg==
</data>        

          </attachment>
    </bug>

</bugzilla>