You are not logged in.
Hello,
Since systemd got pushed down with an update I decided to jump the ship (even though roughly a week ago I tried it and decided to wait a while, the irony ) With the help of my previous topic and the knowledge that e4rat does work with systemd, I got everything working and it's working faster than ever too. Win/win if you ask me.
There's only one issue: the netcfg.service that I have enabled with systemctl enable netcfg.service always fail on boot and I have to manually connect later. I don't know why it fails, so I hope you can help me tracking the issue.
This is the output of systemctl status netcfg.service right after booting:
┌─[jente @ lappy ~] 19:39:30
└─■ systemctl status netcfg.service
netcfg.service - Netcfg multi-profile daemon
Loaded: loaded (/usr/lib/systemd/system/netcfg.service; enabled)
Active: failed (Result: exit-code) since Fri, 31 Aug 2012 19:35:04 +0200; 4min 27s ago
Process: 253 ExecStart=/usr/bin/netcfg-daemon start (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/netcfg.service
And here's systemctl --failed list-units:
┌─[jente @ lappy ~] 19:39:32
└─■ systemctl --failed list-units
UNIT LOAD ACTIVE SUB JOB DESCRIPTION
netcfg.service loaded failed failed Netcfg multi-profile daemon
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
JOB = Pending job for the unit.
1 units listed. Pass --all to see inactive units, too.
And here's the journal output:
----- Reboot -----
Aug 31 19:35:04 lappy netcfg-daemon[253]: :: [ESSID] up interface wlan0 does not exist
Aug 31 19:35:04 lappy netcfg-daemon[253]: [fail]
I don't think it's any netcfg configuration file, because it did work with SysV and the net-profiles daemon.
Last edited by Unia (2012-10-31 14:20:21)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Units can depend on devices so you could have your netcfg unit require sys-subsystem-net-devices-wlan0.device. However, this is not a general solution as it assumes that your device is wlan0.
As a side note, if you don't need initscripts compatibility, I would use netcfg@.service instead of using the netcfg.service and a the networks array. You can create as many '/etc/systemd/system/multi-user.target.wants/netcfg@<your-profile>.service' symlinks to '/usr/lib/systemd/system/netcfg@.service' as you want.
Offline
Won't using netcfg@.service limit me to using one network at startup? When I'm roaming (which, admittedly, I'm not often) I like to make use of the NETWORKS=(last) option in /etc/conf.d/netcfg.
But, considering I'm not roaming that often, using the static netcfg@.service seems like a nice solution.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
----- Reboot ----- Aug 31 19:35:04 lappy netcfg-daemon[253]: :: [ESSID] up interface wlan0 does not exist Aug 31 19:35:04 lappy netcfg-daemon[253]: [fail]
Shouldn't you be investigating why your interface does not exist?
Offline
Unia wrote:----- Reboot ----- Aug 31 19:35:04 lappy netcfg-daemon[253]: :: [ESSID] up interface wlan0 does not exist Aug 31 19:35:04 lappy netcfg-daemon[253]: [fail]
Shouldn't you be investigating why your interface does not exist?
Well, as I said, I have no idea what to troubleshoot in systemd. It worked before in SysV and when I get to X (using systemd) it works too when I manually run netcfg [ESSID].
So, the error should be somewhere in systemd. It's just that I don't know where and that's why I'm asking here.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Won't using netcfg@.service limit me to using one network at startup? When I'm roaming (which, admittedly, I'm not often) I like to make use of the NETWORKS=(last) option in /etc/conf.d/netcfg.
But, considering I'm not roaming that often, using the static netcfg@.service seems like a nice solution.
While you can't use menu/lsat, as far as I know, you can enable multiple netcfg@.service units. However, this will have concurrency problems if you have multiple profiles trying to bring up the same interface.
-- edit:
@tomk: Netcfg is probably starting too early. The note about netcfg@.service was semi-off topic (As a side note...). But that is a good point.
@Unia: Try my first suggestion and see if it fixes your problem before messing with anything else.
Last edited by Stebalien (2012-08-31 20:38:02)
Offline
For my broadcom wireless I have added the following two lines in the "Unit" section of by network.service
After=sys-devices-pci0000:00-0000:00:1c.1-0000:02:00.0-bcma0:0-net-wlan0.device
BindTo=sys-devices-pci0000:00-0000:00:1c.1-0000:02:00.0-bcma0:0-net-wlan0.device
Now the connection starts reliably every boot.
Offline
@Stebalien: I tried your suggestion. I copied /usr/lib/systemd/system/netcfg.service to /etc/systemd/system/netcfg.service and I added Requires=sys-subsystem-net-devices-wlan0.device to the UNIT section. However, I still get the same error.
@vacant: I guess your solution is kinda the same, but I don't think I can copy your bits (think it's setup-dependant). Where did you find those lines? I checked the journal but didn't find them.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Maybe you could do something like this to wait for a wlan device or a connected cable before running netcfg (in a separate service file ordered with Before=netcfg.service)
#!/bin/sh
for i in {1..5} # wait up to 5 seconds for wlan or wire
do
[ -d /sys/class/net/wlan0 ] && exit
for f in /sys/class/net/eth*
do
carrier=$(cat "$f/carrier")
[ "$carrier" = "1" ] && exit 0
done
sleep 1
done
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
^ I could, but I don't consider that a "clean" fix. For now, I will see if something else works. If not, I might end up doing that.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
^ I could, but I don't consider that a "clean" fix. For now, I will see if something else works. If not, I might end up doing that.
Maybe this functionality is missing in netcfg? Waiting until a device exists. Or maybe this is part of net-auto-wireless.service / net-auto-wired.service ?
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
@vacant: I guess your solution is kinda the same, but I don't think I can copy your bits (think it's setup-dependant). Where did you find those lines? I checked the journal but didn't find them.
systemctl --full
First column gives the id of the unit you want, you should see your wireless device in the "description" column (I see "BCM43225 802.11b/g/n").
Offline
^ Thanks, got it. One question: are you sure it's network.service? I don't have it. I only have network.target. Is is that one, or is it netcfg.service?
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
I use a custom "network.service" as I have a static ip on my wireless lan (oh, and I chucked in the hdparm stuff because after suspend I found the disk had lost those settings, so don't copy that line). Based on this wiki section.
$ cat /etc/systemd/system/network.service
[Unit]
Description=Network Connectivity
Wants=network.target
Before=network.target
After=sys-devices-pci0000:00-0000:00:1c.1-0000:02:00.0-bcma0:0-net-wlan0.device
BindTo=sys-devices-pci0000:00-0000:00:1c.1-0000:02:00.0-bcma0:0-net-wlan0.device
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network
ExecStart=/sbin/hdparm --yes-i-know-what-i-am-doing -m 16 -S0 -B255 /dev/sda
ExecStart=/usr/sbin/wpa_supplicant -B -i ${interface} -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
ExecStart=/sbin/ip link set dev ${interface} up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStart=/sbin/ip route add default via ${gateway}
ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down
ExecStop=/usr/bin/killall wpa_supplicant
[Install]
WantedBy=multi-user.target
Offline
I see. So would I want to add this to network.target, or netcfg.service? Or should I create a (more minimal) network.service too?
Sorry, I'm a complete noob concerning systemd...
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
1) the /etc/systemd/system/network.service is a new file I created
2) then "systemctl enable network.service" so it starts at boot.
That replaces any netcfg.service and, in my case, wpa_supplicant????.service, so I have those disabled.
Offline
Yes, but I only need the Before= and BindTo= lines, so that doesn't require a whole new file (I think). Could I also add this to network.target or netcfg.service?
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Copy /usr/lib/systemd/system/netcfg.service to /etc/systemd/system/netcfg.service and modify that. The /etc version takes precedence and you still have the original kept safe.
Last edited by vacant (2012-08-31 21:58:08)
Offline
Yep, that seems to work!
Thanks everyone for the quick fix! Marking solved!
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Adding the After and BindTo requirements can cleanly be done by creating
a /etc/systemd/system/netcfg.service with a include directive:
.include /usr/lib/systemd/system/netcfg.service
[Unit]
After=sys-devices-pci0000:00-0000:00:1c.1-0000:03:00.0-bcma0:0-net-wlan0.device
BindTo=sys-devices-pci0000:00-0000:00:1c.1-0000:03:00.0-bcma0:0-net-wlan0.device
Last edited by shagrat (2012-09-01 21:37:53)
Offline
^ That's even sweeter! Thanks!
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Sorry for the slight bump, but this solution worked for us (two-person robotics team), and I wanted to add this info so that people who are desperately searching for information can find this thread more easily.
I'm guessing that this problem of systemd not loading the usb wifi device on time is caused by having a slow system. We had this problem with Arch Linux ARM on a Raspberry Pi <http://en.wikipedia.org/wiki/Raspberry_Pi>, which is understandable considering how slow it is compared to modern desktops. We were using a Belkin F5D8053 usb wifi adapter, and had no idea why we saw such seemingly inconsistent behavior with it, until we read this thread and I used shagrat's method.
By the way, if you replace every instance of "netcfg.service" with "netcfg@.service" you can use the "netcfg@<profile>.service" notation to start individual netcfg profiles at boot.
Last edited by thorion (2012-10-04 03:51:07)
Offline
I'd like to point to a potential problem with using the BindTo= directive. I used this directive in my net-auto-wireless.service and it looks like it prevented the connection to reestablish after getting lost.
Offline