You are not logged in.

#1 2015-01-29 16:58:02

gsgleason
Member
Registered: 2012-10-08
Posts: 71

can netctl start a profile when a device appears?

I use a usb wireless interface that has very pool native kernel support, so I use a dkms version from the aur.

After a kernel update, upon the next reboot, dkms will rebuild the kernel module for the wireless interface.

However, the module isn't done yet when netctl starts, so the wireless interface doesn't even exist.

With network manager, it will start the network whenever it sees the device appear.  So after booting and logging in, once dkms has built the new kernel module and inserted it, network manager will start it up and it works.

I'd like to accomplish the same thing with netctl, if possible. 

Is it?

Last edited by gsgleason (2015-01-29 17:00:07)

Offline

#2 2015-01-29 17:05:56

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: can netctl start a profile when a device appears?

According to the project page, ifplugd might work.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#3 2015-01-29 17:23:08

gsgleason
Member
Registered: 2012-10-08
Posts: 71

Re: can netctl start a profile when a device appears?

I think ifplugd is only for wired interfaces, not wireless.

Offline

#4 2015-01-29 17:35:54

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: can netctl start a profile when a device appears?

I didn't link the project page arbitrarily. See the second to last feature in the Overview section.

Of course, that doesn't mean it's appropriate for your needs. Another [possible] option is to create a udev rule to start a netctl profile via systemd when the device is attached.

Last edited by alphaniner (2015-01-29 17:41:48)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#5 2015-01-30 00:10:17

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: can netctl start a profile when a device appears?

The simplest way to accomplish this is to setup a timer unit, e.g. to start 15 sec after boot.


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#6 2015-01-30 05:10:04

gsgleason
Member
Registered: 2012-10-08
Posts: 71

Re: can netctl start a profile when a device appears?

alphaniner wrote:

I didn't link the project page arbitrarily. See the second to last feature in the Overview section.

Of course, that doesn't mean it's appropriate for your needs. Another [possible] option is to create a udev rule to start a netctl profile via systemd when the device is attached.

I think the udev rule sounds like an attractive option, if it's indeed feasible.  I'll have to do some research on the logistics of it.

Offline

#7 2015-01-30 15:26:03

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: can netctl start a profile when a device appears?

Despite being dead simple, it took me quite a while to work it out due to all the misleading info floating around. <cough>jwr<cough> -_-

Here's the rule that finally worked for me with a USB thumb drive:

SUBSYSTEMS=="scsi", ATTRS{model}=="v3.3.9.8        ", ENV{SYSTEMD_WANTS}+="udevruletest.service"

As the service name indicates it was just for testing, and I haven't used it for any practical purpose.

##########

Edit: I happened to come across a *wired* usb network adapter and managed to get it brought up automatically when plugged in:

/etc/udev/rules.d/11-usbeth.rules

SUBSYSTEMS=="usb", ATTRS{product}=="DUB-E100", ENV{SYSTEMD_WANTS}+="netctl@eth0.service"

/etc/netctl/eth0

Description='usb eth'
Interface=eth0
Connection=ethernet
IP=dhcp

/etc/systemd/system/netctl@eth0.service

.include /usr/lib/systemd/system/netctl@.service

[Unit]
Description=usb eth
BindsTo=sys-subsystem-net-devices-eth0.device
After=sys-subsystem-net-devices-eth0.device

Last edited by alphaniner (2015-01-30 19:23:51)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

Board footer

Powered by FluxBB