Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 646274 - net-wireless/hostapd-2.6-r1 - When PID file is missing hostapd won't restart
Summary: net-wireless/hostapd-2.6-r1 - When PID file is missing hostapd won't restart
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Andriy Utkin (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on: 652716
Blocks:
  Show dependency tree
 
Reported: 2018-02-01 07:31 UTC by Xander
Modified: 2018-05-11 00:11 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 Xander 2018-02-01 07:31:38 UTC
When PID file is missing (daemon starts but somehow exits on its own), the service is marked as crashed in rc-status & cannot be stopped/restarted by the init script. Similar to #645842

Reproduction:
- /etc/init.d/hostapd start
- mv /var/run/hostapd.pid /tmp/hostapd.pid
- check rc-status that it is marked as crashed
- /etc/init.d/hostapd restart

Expected: daemon starts again.
Actual: "Failed to stop hostapd"

Manual resolution: starting the process manually specifying the same pid file in options.

net-wireless/hostapd-2.6-r1::gentoo was built with the following:
USE="crda ipv6 ssl -logwatch -netlink -sqlite -wps" ABI_X86="(64)"


Portage 2.3.19 (python 3.5.4-final-0, default/linux/amd64/17.0, gcc-6.4.0, glibc-2.25-r9, 4.12.5-gentoo x86_64)
=================================================================
System uname: Linux-4.12.5-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E5462_@_2.80GHz-with-gentoo-2.4.1
KiB Mem:    63963392 total,  56612120 free
KiB Swap:    3145724 total,   3145724 free
Timestamp of repository gentoo: Fri, 26 Jan 2018 00:45:01 +0000
Head commit of repository gentoo: f59c667e9c206e59fea9f13f47eac488822ebba2
sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
distcc 3.2rc1 x86_64-pc-linux-gnu [disabled]
ccache version 3.2.4 [disabled]
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.3::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.5.4-r1::gentoo
dev-util/ccache:          3.2.4::gentoo
dev-util/cmake:           3.9.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.34.11::gentoo
sys-apps/sandbox:         2.12::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            6.4.0-r1::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r9::gentoo
Repositories:

gentoo
    location: /mnt/olddrive/portage
    sync-type: rsync
    sync-uri: rsync://mirror.internode.on.net/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts:

Xander
    location: /mnt/olddrive/portage-overlay
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA PUEL FraunhoferFDK Oracle-BCLA-JavaSE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.3/conf"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=core2 -pipe"
DISTDIR="/mnt/olddrive/distfiles"
EMERGE_DEFAULT_OPTS="--ask --ask-enter-invalid"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs candy config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news nodoc noinfo parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.iinet.net.au/pub/Gentoo"
LANG="en_AU.UTF-8"
LC_ALL="en_AU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j8"
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 --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="aac acl acpi admin alsa amd64 avx bash-completion berkdb bzip2 cli crypt cxx directfb dri dvb dvd fastcgi ffmpeg gdbm iconv ipv6 lame matroska mmx mmxext modules mp3 mp4 mpeg multilib mysql ncurses nfs nls nptl ogg opengl openmp pam pcre policykit qt3support readline samba seccomp sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 startup-notification tcpd threads udev unicode upnp v4l2 x264 xattr xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc efi-64" INPUT_DEVICES="libinput keyboard mouse" 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-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" QEMU_USER_TARGETS="arm" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="nvidia radeon r600" 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:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Andriy Utkin (RETIRED) gentoo-dev 2018-03-30 17:00:32 UTC
Will look into the ticket soon. Have not read it yet.
Comment 2 Andriy Utkin (RETIRED) gentoo-dev 2018-04-06 19:44:30 UTC
This is an openrc issue, however it can be worked arount at hostapd init script level if needed. I've also noticed this issue in the past, and not just with hostapd I think.

I've talked a bit on #openrc about this. The fact that hostapd removes pidfile on termination is considered legit, so I proposed a patch https://gist.github.com/andrey-utkin/cf3fd47aeacf6dd0657d18e1811dd72f . dwfreed said he's thinking of a different way to fix it. So please hang on a bit more.
Comment 3 Andriy Utkin (RETIRED) gentoo-dev 2018-05-02 20:05:01 UTC
With future release of openrc 0.36, this will be fixed.
Comment 4 William Hubbs gentoo-dev 2018-05-02 20:26:54 UTC
I haven't reverted your change, but I wanted to bring this back up
because there might be a better fix.

The "zap" command can be used to reset a daemon which has crashed to the
stopped state.

The restart command is currently the equivalent of "stop" followed by
"start".
Would it be better if the restart command ran "stop" then "zap" then
"start"?
Comment 5 Andriy Utkin (RETIRED) gentoo-dev 2018-05-02 21:01:38 UTC
(In reply to William Hubbs from comment #4)
> I haven't reverted your change, but I wanted to bring this back up
> because there might be a better fix.

So that when a better fix comes, the current one will be reverted?

> The "zap" command can be used to reset a daemon which has crashed to the
> stopped state.

True, however AFAIK "zap" is a unique OpenRC/Gentoo thing so it takes newcomers/foreigners some mental effort to learn to operate this concept. I actually never liked to use it :)

> The restart command is currently the equivalent of "stop" followed by
> "start".
> Would it be better if the restart command ran "stop" then "zap" then
> "start"?

I am frowny about this because this (restart by default is stop followed by start) is a documented fundamental thing, so changing this complicates beginner level docs.

So, are you going to make just pure "stop" operation return failure? Or will you make it always do implicit "zap" after the stopping operation?

Practical example: I do "openrc single && kexec -e" to reboot a server quickly after kernel upgrade. "openrc single" basically stops a bunch of services. Will "openrc single" fail if it encounters described situation in one of services? If yes, then this is an undesirable effect for me.

Sorry for a bit messy text, typed in a bit of hurry, hope it makes some sense to you.
Comment 6 William Hubbs gentoo-dev 2018-05-02 22:56:04 UTC
Please move discussion to the OpenRC bug I reopened instead,
bug #652716.
Comment 7 Andriy Utkin (RETIRED) gentoo-dev 2018-05-11 00:11:02 UTC
Closing for now.

The openrc fix hasn't been reverted, so things should work as requested by reporter in future.

If that fix gets reverted, which is deemed possible, then, in the worst case, the resolution will be for reporter to stick with doing "rc-service hostapd zap" before "... start" and just deal with it.