Discussion:
[yocto] Enable wpa_supplicant@wlan0.service on boot with systemd
Conor Slater
2018-11-14 09:11:10 UTC
Permalink
Dear All,

I'm trying to start wpa_supplicant with wlan0 as the interface on boot
using systemd.

I've created the following .bbappend for wpa_supplicant to install the new
configuration and enable the ***@wlan0.service. This doesn't
enable the service and somehow breaks being able the start the
***@wlan0.service.

Has anybody else figured out how to get this to work?

$ cat wpa-supplicant_2.%.bbppend:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI_append = " file://wpa_supplicant-wlan0.conf"

inherit systemd

SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} += " ***@wlan0.service"
SYSTEMD_AUTO_ENABLE = "enable"

do_install_append () {
install -d ${D}${sysconfdir}/wpa_supplicant
install -m 0644 ${WORKDIR}/wpa_supplicant-wlan0.conf
${D}/${sysconfdir}/wpa_supplicant/
}

As a workaround, I created a .bbappend to manually create the symlink for
systemd which does enable the service. Although, I would like to know if
there is a better way of doing this.

$ cat wpa-supplicant_2.%.bbppend:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI_append = " file://wpa_supplicant-wlan0.conf"

do_install_append () {
install -d ${D}${sysconfdir}/wpa_supplicant
install -m 0644 ${WORKDIR}/wpa_supplicant-wlan0.conf
${D}/${sysconfdir}/wpa_supplicant/
install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants
ln -s ../../../../lib/systemd/system/***@.service
${D}${sysconfdir}/systemd/system/multi-user.target.wants/***@wlan0.service
}
ChenQi
2018-11-14 09:30:04 UTC
Permalink
For the current codes, manually creating symlink is the easiest way to
achieve your goal.
The current mechanism in systemd.bbclass has to 'enable' or 'disable'
all services in SYSTEMD_SERVICE_xxx. There's no mechanism to enable or
disable a subset of them.
This might need to be improved.

Best Regards,
Chen Qi
Post by Conor Slater
Dear All,
I'm trying to start wpa_supplicant with wlan0 as the interface on boot
using systemd.
I've created the following .bbappend for wpa_supplicant to install the
doesn't enable the service and somehow breaks being able the start the
Has anybody else figured out how to get this to work?
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " file://wpa_supplicant-wlan0.conf"
inherit systemd
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_AUTO_ENABLE = "enable"
do_install_append () {
install -d ${D}${sysconfdir}/wpa_supplicant
install -m 0644 ${WORKDIR}/wpa_supplicant-wlan0.conf
${D}/${sysconfdir}/wpa_supplicant/
}
As a workaround, I created a .bbappend to manually create the symlink
for systemd which does enable the service. Although, I would like to
know if there is a better way of doing this.
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " file://wpa_supplicant-wlan0.conf"
do_install_append () {
install -d ${D}${sysconfdir}/wpa_supplicant
install -m 0644 ${WORKDIR}/wpa_supplicant-wlan0.conf
${D}/${sysconfdir}/wpa_supplicant/
install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants
}
Conor Slater
2018-11-14 09:26:37 UTC
Permalink
Thank you Chen Qi,

This makes it a lot clearer...
Post by ChenQi
For the current codes, manually creating symlink is the easiest way to
achieve your goal.
The current mechanism in systemd.bbclass has to 'enable' or 'disable' all
services in SYSTEMD_SERVICE_xxx. There's no mechanism to enable or disable
a subset of them.
This might need to be improved.
Best Regards,
Chen Qi
Dear All,
I'm trying to start wpa_supplicant with wlan0 as the interface on boot
using systemd.
I've created the following .bbappend for wpa_supplicant to install the new
enable the service and somehow breaks being able the start the
Has anybody else figured out how to get this to work?
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " file://wpa_supplicant-wlan0.conf"
inherit systemd
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_AUTO_ENABLE = "enable"
do_install_append () {
install -d ${D}${sysconfdir}/wpa_supplicant
install -m 0644 ${WORKDIR}/wpa_supplicant-wlan0.conf
${D}/${sysconfdir}/wpa_supplicant/
}
As a workaround, I created a .bbappend to manually create the symlink for
systemd which does enable the service. Although, I would like to know if
there is a better way of doing this.
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " file://wpa_supplicant-wlan0.conf"
do_install_append () {
install -d ${D}${sysconfdir}/wpa_supplicant
install -m 0644 ${WORKDIR}/wpa_supplicant-wlan0.conf
${D}/${sysconfdir}/wpa_supplicant/
install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants
}
Loading...