1

I want to change it to copy, rather than move.

OK, some googlefu suggests it's in this service raspberrypi-net-mods.service

https://github.com/RPi-Distro/raspberrypi-net-mods/blob/master/debian/raspberrypi-net-mods.service

An idea how to locate this once installed?

Stretch Lite 2019-04-08

7

As Dirk and Ghanima stated in their answers, the service may be overwritten by future updates/upgrades of the system. But systemd has a mechanism to avoid this. You can use a drop in file. An update/upgrade will only modify the main service. The drop in file is not effected by it and will also modify the updated main service. You can simply create a drop in file with:

rpi ~$ sudo systemctl edit raspberrypi-net-mods.service

In the empty editor insert these statements, save them and quit the editor:

[Service]
ExecStart=
ExecStart=/bin/cp /boot/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf

The first empty ExecStart= is important. It will suppress the original ExecStart in the main service.

Check the source of the whole service with:

rpi ~$ systemctl cat raspberrypi-net-mods.service

You will find the drop in at the end.

2

It's a service. In this case it's raspberrypi-net-mods.service.

systemctl status raspberrypi-net-mods.service will give status, including full path of the service file. systemctl cat raspberrypi-net-mods.service will show path and contents.

Be aware that an update/upgrade could modify the service file in the future.

2

As Dirk's answer pointed out the raspberrypi-net-mods.service is responsible for relocating wpa_supplicant.conf. It is located in /etc/systemd/multi-user-target.wants/.

This is the actual code (see here):

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/mv /boot/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
ExecStartPost=/bin/chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf

You could change that mv to cp and the script would do what you want. However, as Dirk's answer already pointed out, any future updates/upgrades of the system might overwrite that file. See Ingo's answer how to avoid that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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