You are not logged in.
Hi there,
I run an arch machine on my laptop, on a separate partition.
I also have this set up to boot as a virtual machine, directly from the partition.
Whilst I have most things working, I can't quite figure out how to handle netctl-auto.
Currently I have a systemd service for netctl-auto on wlp4s0 (my wireless adaptor), and another for netctl-ifplugd on enp5s0f1 (ethernet).
Unfortunately when I boot the partition as a VM, neither of these interfaces are present, so I get a 1.5 minute timeout.
Ideally I would just not load netctl in these situations, but I'm not exactly sure how to do that...
Any advice would be greatly appreciated!
Thanks in advance,
Zach
Last edited by zacharyrs (2018-11-04 22:31:54)
Offline
Welcome to the arch linux forums zacharyrs.
Possibly Systemd#Editing_provided_units add ConditionVirtualization=false see man 5 systemd.unit
Offline
Thanks for the suggestion!
I gave it a look, and duplicated the netctl services, adding that under the unit section.
Unfortunately, as they appear to rely on sys-subsystem-net-devices-<xyz> I still get a timeout.
Taking a look regarding removable usb wifi dongles, I did find some info regarding udev, but was unable to get it to work...
Supposedly I needed to create a udev rule like...
ACTION=="add", SUBSYSTEM=="net", KERNEL=="<xyz>", SYMLINK=="wlan0", TAG+="systemd", ENV{SYSTEMD_WANTS}="netctl-auto@wlan0.service"In my case, I substituted <xyz> with wlp4s0, and renamed my netctl profiles to wlan0-...
Any suggestions where I might be going wrong?
Offline
That should not be an issue if the unit is not started because its start conditions are not met.
Does `systemd-detect-virt` detect the virtualization in use when the system is being used as a VM?
Offline
Yes, that returns 'vmware'.
Offline
What is the output of `systemctl cat $servicename` and `systemctl status $servicename` where $servicename is the name of one of the services causing the issue.
Edit:
What the output from `systemctl cat X@Y.service` should be like to stop the service running under virtualization. Tested locally on a netctl service this does work for me.
# /etc/systemd/system/X@Y.service.d/override.conf
[Unit]
ConditionVirtualization=falseLast edited by loqs (2018-11-04 01:24:51)
Offline
A vanilla copy of netctl-auto causes the issue, as does one modified with ConditionVirtualization as below.
# /etc/systemd/system/netctl-auto@.service
[Unit]
Description=Automatic wireless network connection using netctl profiles
Documentation=man:netctl.special(7)
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device network-pre.target
Before=network.target
Wants=network.target
ConditionVirtualization=false
[Service]
Type=forking
RemainAfterExit=yes
ExecStart=/usr/bin/netctl-auto start %I
ExecStop=/usr/bin/netctl-auto stop %I
ExecStopPost=/usr/bin/netctl-auto clean %I
[Install]
WantedBy=multi-user.targetAfter waiting for the timeout and running the second command, I get...
● netctl-auto@wlp4s0.service - Automatic wireless network connection using netctl profiles
Loaded: loaded (/etc/systemd/system/netctl-auto@.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:netctl.special(7)
Nov 05 03:20:01 ltv systemd[1]: Dependency failed for Automatic wireless network connection using netctl profiles.
Nov 05 03:20:01 ltv systemd[1]: netctl-auto@wlp4s0.service: Job netctl-auto@wlp4s0.service/start failed with result 'dependency'.Offline
'netctl-auto@wlp4s0.service' is the service you want to edit with `systemctl edit netctl-auto@wlp4s0.service` add just the following two lines to the override
[Unit]
ConditionVirtualization=falseOffline
Correct me if I'm wrong, but the @ symbol just designates the variable %I within the service.
That is, editing netctl-auto@.service, and linking as netctl-auto@wlp4s0.service as I have, means the changes made to netctl-auto@.service are in effect.
Offline
What is the output of 'systemctl cat netctl-auto@wlp4s0.service'
Offline
~ zach@ltv
❯ systemctl cat netctl-auto@wlp4s0.service
# /etc/systemd/system/netctl-auto@.service
[Unit]
Description=Automatic wireless network connection using netctl profiles
Documentation=man:netctl.special(7)
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device network-pre.target
Before=network.target
Wants=network.target
ConditionVirtualization=false
[Service]
Type=forking
RemainAfterExit=yes
ExecStart=/usr/bin/netctl-auto start %I
ExecStop=/usr/bin/netctl-auto stop %I
ExecStopPost=/usr/bin/netctl-auto clean %I
[Install]
WantedBy=multi-user.targetOffline
If you swap ConditionVirtualization=false for AssertVirtualization=false does that make any difference?
Edit:
If that fails edit systemd-user-sessions.service and remove network.target from the After line to remove the delay.
Last edited by loqs (2018-11-04 09:06:54)
Offline
I'll try it in a sec, currently compiling something.
Would editing that not just be covering up the delay?
I might try reading into udev and see if I can get it to avoid even loading the file, but that'll have to wait till after my exams are over.
Offline
It removes the dependency so user sessions do not wait for the networking.target. It does not stop the services from failing due to the missing device dependency.
Offline
Yes that's what I meant.
Hence it just covers up the symptoms without solving the issue.
Offline
Unfortunately I had no luck with AssertVirtualization.
Currently removed network.target as suggested. I'll look into udev in a few days.
Thanks for the help anyway!
Offline
Well, I ended up reverting that change, as although the VM didn't wait to load anymore, I still couldn't SSH in for 90 seconds.
Ended up reading into udev, and discovering it do what I want (as far as I could tell).
Instead I discovered the virtual network systemd units can be extended to want netctl, so for anyone reading, I did the following...
Made a directory under
/etc/systemd/systemcalled
sys-subsystem-net-devices-wlp4s0.device.wantsSymlinked
netctl-auto@.serviceunder that directory as
netctl-auto@wlp4s0.serviceRepeated for enp5s0f1 with netctl-ifplugd@.service.
Booting directly into arch now loads netctl as necessary. Booting in a VM (where those devices aren't present) now loads without the timer.
Last edited by zacharyrs (2018-11-04 22:32:15)
Offline
I suspect this works without manual tinkering in netctl 1.19 (currently in [testing]).
Offline