Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 161290 - net-wireless/ipw3945d broken permissions handling in init script
Summary: net-wireless/ipw3945d broken permissions handling in init script
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Christian Heim (RETIRED)
URL:
Whiteboard:
Keywords:
: 194996 (view as bug list)
Depends on:
Blocks: ipw3945-tracker
  Show dependency tree
 
Reported: 2007-01-10 07:52 UTC by Taiyang Chen
Modified: 2007-12-05 16:36 UTC (History)
7 users (show)

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


Attachments
patch against ipw3945d-1.7.22-r4.ebuild (CVS 1.5) (patch,1000 bytes, patch)
2007-01-12 14:23 UTC, Jan Kundrát (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Taiyang Chen 2007-01-10 07:52:31 UTC
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 "rmmod ipw3945 && modprobe ipw3945"

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

08 Jan 2007; Christian Heim <phreak@gentoo.org>
-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'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 "ipw3945d" 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 "sleep 0.5" 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's check if the pidfile is still present.
        if [ -f "${PIDFILE}" ] ; then
                eerror "The pidfile ($PIDFILE) is still present."
                eerror "Please check that the daemon isn't running!"
                return 1
        fi
}

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

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



I hope this initscript could be fixed/updated to fix permission problems.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-01-10 08:02:24 UTC
*** Bug 161047 has been marked as a duplicate of this bug. ***
Comment 2 Jan Kundrát (RETIRED) gentoo-dev 2007-01-10 10:58:31 UTC
(In reply to comment #0)
> 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 "ipw3945d"
> 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 "sleep 0.5" to
> make it fully working for loading up my net.eth1 (which i believe was the
> original initscript).

The intention is that ipw3945d doesn't run as root. What are the permissions of /sbin/ipw3945d on your system?
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2007-01-10 14:28:37 UTC
(In reply to comment #2)
> The intention is that ipw3945d doesn't run as root. What are the permissions of
> /sbin/ipw3945d on your system?

The intention may be fine but this totally kills the (already pretty borked) thing, rendering it useless. 
Comment 4 Taiyang Chen 2007-01-10 19:03:40 UTC
(In reply to comment #2)
> (In reply to comment #0)
> > 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 "ipw3945d"
> > 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 "sleep 0.5" to
> > make it fully working for loading up my net.eth1 (which i believe was the
> > original initscript).
> 
> The intention is that ipw3945d doesn't run as root. What are the permissions of
> /sbin/ipw3945d on your system?
> 
here it is:
-r-Sr-x--- 1 root root 69176 Jan 10 02:17 /sbin/ipw3945d

I don't think it'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't do anything to it.
Comment 5 Jan Kundrát (RETIRED) gentoo-dev 2007-01-10 20:12:58 UTC
(In reply to comment #4)
> here it is:
> -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...

> I don't think it'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't do
> anything to it.

Everything should work out-of-box. If it doesn't and you aren't using a stale ebuild, there's a bug we'd like to fix.
Comment 6 Taiyang Chen 2007-01-10 20:53:35 UTC
Yes i synced and re-emerged ipw3945d-1.7.22-r4 but the problem is still there.
Manually doing "chown ipw3945d /sbin/ipw3945d" 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': 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
Comment 7 Jakub Moc (RETIRED) gentoo-dev 2007-01-11 01:18:16 UTC
(In reply to comment #6)
> ACCESS DENIED  chmod:     /sbin/ipw3945d
> chmod: changing permissions of `/sbin/ipw3945d': Permission denied

Someone should fix src_install to not try to fiddle w/ perms on live fs, it's violating sandbox... :P
Comment 8 Renat Lumpau (RETIRED) gentoo-dev 2007-01-11 16:19:33 UTC
exactly the same problem here, workaround seems to work.
Comment 9 Pacho Ramos gentoo-dev 2007-01-11 21:49:12 UTC
Same problem with sandbox violation here. Please, fix it

Thanks
Comment 10 Jan Kundrát (RETIRED) gentoo-dev 2007-01-12 12:41:08 UTC
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't make it work, please reopen.
Comment 11 Jan Kundrát (RETIRED) gentoo-dev 2007-01-12 14:11:15 UTC
(In reply to comment #10)
> It works for me on my test system in default configuration

Oops, it doesn't, I was using older init.d/conf.d files.
Comment 12 Jan Kundrát (RETIRED) gentoo-dev 2007-01-12 14:23:20 UTC
Created attachment 106682 [details, diff]
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 "1.5" as you can see on the third line of the ebuild)? It works for me.
Comment 13 Christian Heim (RETIRED) gentoo-dev 2007-01-12 16:50:01 UTC
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.
Comment 14 Taiyang Chen 2007-01-12 19:12:45 UTC
Thanks problem solved here.
Comment 15 Jan Kundrát (RETIRED) gentoo-dev 2007-12-05 16:36:17 UTC
*** Bug 194996 has been marked as a duplicate of this bug. ***