Package: hostapd
Version: 2:2.7+git20190128+0c1e29f-6
Severity: normal
Tags: patch

Dear Maintainer,

I'm just starting out with hostapd, so I'm using DAEMON_OPTS="-d" to
configure debug output and help me find my mistakes. Unfortunately, the
systemd journal abruptly stops, presumably because hostapd forks and
daemonizes. Syslog support does not seem to be compiled in, so I think
the only way to get debug information is to prevent the daemonization. I
have attached a patch to configure the systemd units this way; further
information in in the patch.

Thanks,
Corey

-- System Information:
Debian Release: 10.1
  APT prefers stable-debug
  APT policy: (500, 'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-6-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages hostapd depends on:
ii  init-system-helpers  1.56+nmu1
ii  libc6                2.28-10
ii  libnl-3-200          3.4.0-1
ii  libnl-genl-3-200     3.4.0-1
ii  libnl-route-3-200    3.4.0-1
ii  libssl1.1            1.1.1c-1
ii  lsb-base             10.2019051400

hostapd recommends no packages.

hostapd suggests no packages.

-- Configuration Files:
/etc/default/hostapd changed [not included]

-- no debconf information
commit 45107409549fc3b48f882dd85bc35e354d196038
Author: Corey Hickey <bugfoo...@fatooh.org>
Date:   Thu 2019-09-26 20:49:49

    change systemd units to use "exec" service type
    
    This makes it possible to view debug messages from the -d option during
    operation.
    
    When hostapd forks and daemonizes, messages on stdout cease; since the
    Debian build does not enable logs via syslog, there is no way to get any
    debug information past the initial startup.
    
    If hostapd is configured not to fork, then the debug information remains
    visibile for the lifetime of the eprocess.
    
    There is some history here:
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=918861
    This takes the other approach mentioned in the ticket, at the cost of
    systemd thinking the service has started a bit earlier. I think the
    tradeoff is worthwhile.

diff --git a/debian/hostapd.service b/debian/hostapd.service
index 7fbbc6a..e844440 100644
--- a/debian/hostapd.service
+++ b/debian/hostapd.service
@@ -3,13 +3,12 @@ Description=Advanced IEEE 802.11 AP and IEEE 
802.1X/WPA/WPA2/EAP Authenticator
 After=network.target
 
 [Service]
-Type=forking
-PIDFile=/run/hostapd.pid
+Type=exec
 Restart=on-failure
 RestartSec=2
 Environment=DAEMON_CONF=/etc/hostapd/hostapd.conf
 EnvironmentFile=-/etc/default/hostapd
-ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS 
${DAEMON_CONF}
+ExecStart=/usr/sbin/hostapd $DAEMON_OPTS ${DAEMON_CONF}
 
 [Install]
 WantedBy=multi-user.target
diff --git a/debian/hostapd@.service b/debian/hostapd@.service
index 5ac0377..78d653a 100644
--- a/debian/hostapd@.service
+++ b/debian/hostapd@.service
@@ -4,12 +4,11 @@ After=network.target
 BindsTo=sys-subsystem-net-devices-%i.device
 
 [Service]
-Type=forking
-PIDFile=/run/hostapd.%i.pid
+Type=exec
 Restart=on-failure
 RestartSec=2
 EnvironmentFile=-/etc/default/hostapd
-ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.%i.pid $DAEMON_OPTS 
/etc/hostapd/%i.conf
+ExecStart=/usr/sbin/hostapd $DAEMON_OPTS /etc/hostapd/%i.conf
 
 [Install]
 WantedBy=multi-user.target sys-subsystem-net-devices-%i.device

Reply via email to