9

I'm running Raspbian Wheezy, on a freshly installed SD card:

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.18.11+ #781 PREEMPT Tue Apr 21 18:02:18 BST 2015 armv6l GNU/Linux

I wanted to make my Raspberry Pi a Wifi access point, so I followed the instructions in this tutorial.

All was good until I got to the "Finishing up..." section. It says to avoid having to start hostapd and dhcp each time I boot the pi, I should run these commands:

sudo update-rc.d hostapd enable 
sudo update-rc.d isc-dhcp-server enable

When I run them, I get this:

pi@raspberrypi ~ $ sudo update-rc.d hostapd enable
update-rc.d: using dependency based boot sequencing
update-rc.d: error: no runlevel symlinks to modify, aborting!
pi@raspberrypi ~ $ sudo update-rc.d isc-dhcp-server enable
update-rc.d: using dependency based boot sequencing
pi@raspberrypi ~ $

So, the second command (for isc-dhcp-server) was successful, but the first command (for hostapd) was not. I have no idea what it's talking about, and don't know what to do next.

I had followed the instructions on the above-mentioned site exactly, including his instructions for building hostapd from source:

wget https://github.com/jenssegers/RTL8188-hostapd/archive/v1.1.tar.gz
tar -zxvf v1.1.tar.gz
cd RTL8188-hostapd-1.1/hostapd
sudo make
sudo make install

(So, I'm wondering if that's why isc-dhcp-server succeeded, and hostapd failed; because I installed isc-dhcp-server from apt and hostapd from source.)

I searched for the error message no runlevel symlinks to modify, aborting! and found this page. It seemed fairly specific to bluetooth, though, and I wasn't sure how to apply it to my situation with hostapd. The main thing I gleaned from that page was the tone of "If you removed the symlinks in rc?.d manually, you will have to recreate them manually," and "What went wrong is that you were doing things in there without a sufficient understanding of what should be done."

Well, I most definitely didn't remove any symlinks manually. And although the esoteric details of runlevels is definitely above my head, I haven't messed with anything except exactly what the tutorial told me to do.

Any thoughts on how I can fix this problem?

2 Answers 2

12

Please first try:

sudo update-rc.d hostapd defaults

This really isn't any different than what you've already called, just with a defaults argument instead of enable/disable. Then I believe the enable/disable commands should work as you're expecting.

Per man update-rc.d:

When run with the defaults option, update-rc.d makes links named /etc/rcrunlevel.d/[SK]NNname that point to the script /etc/init.d/name, using runlevel and dependency information from the init.d script LSB comment header.

So this should create the missing symbolic links in the various /etc/rc#.d/ directories, for which you were getting the "no runlevel symlinks to modify" error.

2
  • Can you explain to the OP what the update-rc.d script does? Many people are a little hesitant to try out new commands that they don't know, especially when invoked as root using sudo.
    – Phil B.
    Commented Oct 18, 2015 at 15:08
  • Thanks for mentioning enable, I needed to run that in addition to defaults.
    – sebastian
    Commented Oct 6, 2019 at 8:18
0

First, write an init script for hostapd. For example, you can create file /etc/init.d/hostapd and put the following content there.

#!/bin/sh

### BEGIN INIT INFO
# Provides:          hostapd
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Hostapd Service
# Description:       Intended to start hostapd on system startup.
### END INIT INFO

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

case "$1" in
    start)
        /usr/sbin/hostapd -B
        ;;
    *)
        echo "Usage: $NAME {start}" >&2
        exit 3
        ;;
esac

Now, run sudo update-rc.d hostapd defaults, then sudo update-rc.d hostapd enable. It should start hostapd when you start your system (for run levels 2,3,4 & 5). You can also use service hostapd start to start hostapd.

2
  • The file created should not be called /etc/init.d/hostapd.conf but just /etc/init.d/hostapd since it's not a config file. Commented Nov 30, 2017 at 10:46
  • @ChristianBeer Agreed! Updated the answer. Commented Dec 12, 2017 at 16:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.