Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 502032 - net-misc/dhcpcd-6.2.0-r1 should not automatically start wpa_supplicant
Summary: net-misc/dhcpcd-6.2.0-r1 should not automatically start wpa_supplicant
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-21 20:06 UTC by mike
Modified: 2014-02-27 13:08 UTC (History)
2 users (show)

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 mike 2014-02-21 20:06:46 UTC
When starting dhcpcd via direct call "dhcpcd wlan0" this will auto-trigger a start of wpa_supplicant using the command "wpa_supplicant -B -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0" (first seen after last update). There is no reason for this and it's corrupting any other scripts which will start wpa_supplicant themselve (constantly disconnects due two instances running).
Service dependency gives:
/lib/rc/bin/rc-depend -a dhcpcd
sysfs udev-mount udev hwclock modules fsck root mtab localmount hostname syslog-ng dhcpcd


Reproducible: Always

Steps to Reproduce:
1. start dhcpcd via dhcpcd [networkinterface]
Actual Results:  
wpa_supplicant is starting with dhcpcd

Expected Results:  
wpa_supplicant is NOT auto-starting

Portage 2.2.7 (default/linux/x86/13.0, gcc-4.7.3, glibc-2.17, 3.10.25-gentoo i686)
=================================================================
System uname: Linux-3.10.25-gentoo-i686-AMD_E2-1800_APU_with_Radeon-tm-_HD_Graphics-with-gentoo-2.2
KiB Mem:     3519732 total,   2404492 free
KiB Swap:    5143548 total,   5143548 free
Timestamp of tree: Thu, 20 Feb 2014 17:45:01 +0000
ld GNU ld (GNU Binutils) 2.23.2
ccache version 3.1.9 [enabled]
app-shells/bash:          4.2_p45
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.5-r3, 3.2.5-r3, 3.3.3
dev-util/ccache:          3.1.9-r3
dev-util/cmake:           2.8.11.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.13.4
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.7.3-r1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo tud_overlay
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -march=i686 -pipe"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -march=i686 -pipe"
GENTOO_MIRRORS="http://de-mirror.org/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync1.de.gentoo.org/gentoo-portage"
USE="3dnow X acl acpi alsa bash-completion berkdb bzip2 cli cracklib crypt cxx dri dri2 dvi fortran gdbm iconv ipv6 jpeg jpeg2k jpg keymap mmx modules ncurses networkmanager nptl opengl openmp pam pcre png readline sdl session sse sse2 sse3 sse4a ssl ssse3 tcpd threads unicode v4l vaapi x86 xinerama zlib" ABI_X86="32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="radeon intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 rypervenche 2014-02-22 18:08:43 UTC
I too am having this issue. I notice that after upgrading from dhcpcd 5.6.4 to 6.2.0-r1, whenever I start my laptop, most times it fails to bring up my wireless interface due to wpa_supplicant already being run. (Sorry the spacing got messed up):

=====================================================
vitesse ~ # /etc/init.d/net.wlp3s0 restart                                                                                                                                                                                              [0/0]
 * Bringing up interface wlp3s0
 *   Starting wpa_supplicant on wlp3s0 ...
Successfully initialized wpa_supplicant
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/wpa_supplicant/wlp3s0' manually if it is not used anymore
Failed to initialize control interface 'DIR=/var/run/wpa_supplicant GROUP=wheel'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.

 *   start-stop-daemon: failed to start `/usr/sbin/wpa_supplicant'                                                                                                                                                                        [ $! ]
 * ERROR: net.wlp3s0 failed to start
vitesse ~ # ps -ef | grep wpa_
root      5192     1  0 09:55 ?        00:00:00 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlp3s0
root      5945  5795  0 09:56 pts/0    00:00:00 grep --colour=auto wpa_
vitesse ~ # killall wpa_supplicant
vitesse ~ # /etc/init.d/net.wlp3s0 restart                                                                                                                                                                                                      
 * Bringing up interface wlp3s0
 *   Starting wpa_supplicant on wlp3s0 ...
Successfully initialized wpa_supplicant                                                                                                                                                                                                   [ $k ]
 *   Starting wpa_cli on wlp3s0 ...                                                                                                                                                                                                       [ $k ]
 *   Backgrounding ... ...
 * WARNING: net.wlp3s0 has started, but is inactive


vitesse ~ # ps -ef | grep wpa_
root      6089     1  0 09:56 ?        00:00:00 /usr/sbin/wpa_supplicant -Dnl80211 -c /etc/wpa_supplicant/wpa_supplicant.conf -W -B -i wlp3s0 -P /var/run/wpa_supplicant-wlp3s0.pid
root      6096     1  0 09:56 ?        00:00:00 /usr/bin/wpa_cli -a /etc/wpa_supplicant/wpa_cli.sh -p /var/run/wpa_supplicant -i wlp3s0 -P /var/run/wpa_cli-wlp3s0.pid -B
ryperve+  6459     1  0 09:56 ?        00:00:00 /usr/bin/wpa_gui -t
root     11819 11738  0 12:06 pts/2    00:00:00 grep --colour=auto wpa_
=====================================================

Sometimes this does not happen, but most times it does.
Comment 2 Roy Marples 2014-02-25 13:52:28 UTC
I've released dhcpcd-6.3.0 today.
One of the improvements is the script which start wpa_supplicant. It now does the following checks:

  *  Load per interface config file if it exists over the main one
  *  Ensure that ctrl_interface is set in the config file
  *  Pass this value to wpa_cli and check if NOT running

If the above pass, only then will dhcpcd start wpa_supplicant.
Comment 3 William Hubbs gentoo-dev 2014-02-26 08:15:33 UTC
Dhcpcd-6.3.0 is now in the tree.
Comment 4 mike 2014-02-26 16:32:34 UTC
(In reply to Roy Marples from comment #2)
> I've released dhcpcd-6.3.0 today.
> One of the improvements is the script which start wpa_supplicant. It now
> does the following checks:
> 
>   *  Load per interface config file if it exists over the main one
>   *  Ensure that ctrl_interface is set in the config file
>   *  Pass this value to wpa_cli and check if NOT running
> 
> If the above pass, only then will dhcpcd start wpa_supplicant.

Well at the first glance that seems like an improvement but..I think
it's the opposite. Most times one does want to autostart the supplicant when asking for an ip on a wlan-interface..but that's not always the case. Image one is starting a ssh-deamon, do I want to auto-start my VPN-deamon at the same time? Most distros got a dependency-chaining for this (like Gentoo)
which does all the autostart-work. Getting back to the actual problem: My server connects a router by #1 starting wpa_supplicant and #2 starting dhcpd. Checking htop dhcpcd then starts a _second_ instance of wpa_supplicant. The following script is used for that:

einfo "connecting to router"
killall wpa_supplicant dhcpcd
sleep 1
wpa_supplicant -Dwext -c /etc/wpa_supplicant/wpa_supplicant_manual.conf -i $IF_INET &
sleep 10
dhcpcd $IF_INET
ping -c 3 google.de

wpa_supplicant gets a successfull connection (10 seconds wait time) and then
dhpcd starts in..disocnnecting...connecting and so on. I don't want to interfere with your development but in my opinion this auto-start behaviour (directly implemented into the deamon) is a bad idea -.-
Comment 5 Roy Marples 2014-02-26 17:43:48 UTC
So, assume I have a personal need for wpa_supplicant auto starting.
HINT: I have some OS's that have no interface hotplugging support in userland and dhcpcd is a natural fit and I make good use of a USB wireless dongle.

Saying that, this behaviour is controllable - simply add this to dhcpcd.conf(5)
nohook wpa_supplicant

When I last looked, wpa_supplicant doesn't come with a default configuration, so you would have had to configured with with the ctrl_interface directory. Then in your command line you use a different wpa_supplicant configuration file to the one you previously configured.

Lastly, your sleep 10 is redundant. Just give dhcpcd a big enougn timeout for your liking and it will carrier detect a working wpa connection.
Comment 6 mike 2014-02-26 17:49:40 UTC
(In reply to Roy Marples from comment #5)
> So, assume I have a personal need for wpa_supplicant auto starting.
> HINT: I have some OS's that have no interface hotplugging support in
> userland and dhcpcd is a natural fit and I make good use of a USB wireless
> dongle.
> 
> Saying that, this behaviour is controllable - simply add this to
> dhcpcd.conf(5)
> nohook wpa_supplicant
> 
> When I last looked, wpa_supplicant doesn't come with a default
> configuration, so you would have had to configured with with the
> ctrl_interface directory. Then in your command line you use a different
> wpa_supplicant configuration file to the one you previously configured.
> 
> Lastly, your sleep 10 is redundant. Just give dhcpcd a big enougn timeout
> for your liking and it will carrier detect a working wpa connection.

I think I'll stick with the "nohook wpa_supplicant", thanks.
Comment 7 Roy Marples 2014-02-26 17:52:46 UTC
I could also add a futher check (would require a code change) to the wpa_supplicant script to only run if the carrier was also "DOWN". The rationale being if anything is using decent detection with wpa outside of dhcpcd then the link must be UP before dhcpcd is called.
Comment 8 mike 2014-02-26 18:09:05 UTC
(In reply to Roy Marples from comment #7)
> I could also add a futher check (would require a code change) to the
> wpa_supplicant script to only run if the carrier was also "DOWN". The
> rationale being if anything is using decent detection with wpa outside of
> dhcpcd then the link must be UP before dhcpcd is called.

The dhcpcd.conf thing is good for me..perhaps nobody else will care about that (; More complexity will make any software more errorprone so the current logic should be ok.
Comment 9 Roy Marples 2014-02-27 13:08:58 UTC
(In reply to mike from comment #8)
> More complexity will make any software more errorprone so the
> current logic should be ok.

Well, I went ahead and did it anyway.
The extra check sure doesn't hurt.

http://roy.marples.name/projects/dhcpcd/ci/4d874ff1ae?sbs=0