| > I need to change the mode of a wifi driver (which I do via modprobe) Is that something that could be added to modprobe.conf to have it work right without any modprobe calls? > Huh, onehsot services are listed as stopped even though they've run. Do some research, find out I need the `RemainAfterExit` keyword yet. Sure, dependencies are working. Yeah I've also been burned not having RemainAfterExit=y in a oneshot unit. What's worse, such an unit can get started multiple times. > Well looking around at dmesg it looks like the problem is that networkmanager is trying to do something with the device at the same time I am. Looks like it's enumerating device capabilities at the same time I'm trying to create a new device? To be fair such race condition could have happened in any init system. > Oh well, I'll just add the retry keyword to my service. Perhaps having a dependency to start your service before network-manager would have solved this. > Long story short I ended up just writing a traditional shell-script based init script. Maybe I'm thinking about systemd wrong or something. It's perfectly fine IMO to have small shell script services for such stuff. Probably some of the problems are due to network-manager being mostly designed/used for desktop use cases. It also likes to take complete control of all the interfaces so calling iw/ifconfig behind it's back will cause tears (as you found out). I do agree that race conditions caused by parallel service startup really suck in embedded devices. Systemd really could use a "please be as deterministic as possible" mode for embedded (if it already doesn't have). |
Yes, that's how I do it. But that just switches the mode to one that supports virtual interfaces, I still need to add the virtual interface, and I can't do that in a modprobe conf.
>To be fair such race condition could have happened in any init system.
I feel like it's really easy to make that happen under systemd if you're not completely on the ball, where as it's more difficult in things like openrc.
>Yeah I've also been burned not having RemainAfterExit=y in a oneshot unit. What's worse, such an unit can get started multiple times.
You live and you learn, on its own something like that isn't a huge problem.
>Perhaps having a dependency to start your service before network-manager would have solved this.
It was one in a long-chain of similar issues, but yes. There are a lot of ways I probably could have made this work, but at the end of the day I'm still writing shell scripts and not using very many of systemd's "helpful" features.