* systemd - how do I wait for a driver to load? @ 2014-08-26 19:52 Chris Tapp 2014-08-26 20:02 ` Sven Ebenfeld 2014-08-26 20:07 ` Khem Raj 0 siblings, 2 replies; 8+ messages in thread From: Chris Tapp @ 2014-08-26 19:52 UTC (permalink / raw) To: Yocto Project I've got a service running under systemd that will only start once a kernel module has loaded and created its /dev/dvb/adaptor nodes. Unfortunately, it doesn't load until after the service has failed and gone into an error state due to too many restarts. I could "fix" this by increasing the restart interval, but is there a way of adding a dependancy on the kernel module? -- Chris Tapp opensource@keylevel.com www.keylevel.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: systemd - how do I wait for a driver to load? 2014-08-26 19:52 systemd - how do I wait for a driver to load? Chris Tapp @ 2014-08-26 20:02 ` Sven Ebenfeld 2014-08-26 20:51 ` Chris Tapp 2014-08-26 20:07 ` Khem Raj 1 sibling, 1 reply; 8+ messages in thread From: Sven Ebenfeld @ 2014-08-26 20:02 UTC (permalink / raw) To: Chris Tapp, Yocto Project You should look at "ConditionPathExists=" Options of systemd-units. Otherwise if udev is loading your device module, you could add the device-unit to "Requires=" option. Am 26.08.2014 21:52, schrieb Chris Tapp: > I've got a service running under systemd that will only start once a kernel module has loaded and created its /dev/dvb/adaptor nodes. > > Unfortunately, it doesn't load until after the service has failed and gone into an error state due to too many restarts. > > I could "fix" this by increasing the restart interval, but is there a way of adding a dependancy on the kernel module? > > -- > > Chris Tapp > opensource@keylevel.com > www.keylevel.com > > > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: systemd - how do I wait for a driver to load? 2014-08-26 20:02 ` Sven Ebenfeld @ 2014-08-26 20:51 ` Chris Tapp 2014-08-27 7:46 ` Sven Ebenfeld 0 siblings, 1 reply; 8+ messages in thread From: Chris Tapp @ 2014-08-26 20:51 UTC (permalink / raw) To: Sven Ebenfeld; +Cc: Yocto Project On 26 Aug 2014, at 21:02, Sven Ebenfeld <sven.ebenfeld@gmail.com> wrote: > You should look at "ConditionPathExists=" Options of systemd-units. Thanks, that looks like it would do the job. I was hoping not to hard code paths as they may change if a configuration file is changed, but... > Otherwise if udev is loading your device module, you could add the > device-unit to "Requires=" option. This sounds better. Is there an easy way to tell if udev did load the module? There's nothing obvious in the syslog. > Am 26.08.2014 21:52, schrieb Chris Tapp: >> I've got a service running under systemd that will only start once a kernel module has loaded and created its /dev/dvb/adaptor nodes. >> >> Unfortunately, it doesn't load until after the service has failed and gone into an error state due to too many restarts. >> >> I could "fix" this by increasing the restart interval, but is there a way of adding a dependancy on the kernel module? >> >> -- >> >> Chris Tapp >> opensource@keylevel.com >> www.keylevel.com >> >> >> >> -- Chris Tapp opensource@keylevel.com www.keylevel.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: systemd - how do I wait for a driver to load? 2014-08-26 20:51 ` Chris Tapp @ 2014-08-27 7:46 ` Sven Ebenfeld 2014-08-28 16:57 ` Chris Tapp 0 siblings, 1 reply; 8+ messages in thread From: Sven Ebenfeld @ 2014-08-27 7:46 UTC (permalink / raw) To: Chris Tapp; +Cc: Yocto Project Am 26.08.2014 22:51, schrieb Chris Tapp: > > On 26 Aug 2014, at 21:02, Sven Ebenfeld <sven.ebenfeld@gmail.com> wrote: > >> You should look at "ConditionPathExists=" Options of systemd-units. > > Thanks, that looks like it would do the job. I was hoping not to hard code paths as they may change if a configuration file is changed, but... > >> Otherwise if udev is loading your device module, you could add the >> device-unit to "Requires=" option. > > This sounds better. Is there an easy way to tell if udev did load the module? There's nothing obvious in the syslog. If you didn't load the module by hand it's probably udev. If you didn't run modprobe or insmod. Then you should try to create a device-unit for the device. For /dev/dvb/adaptor the unit should probably be something like dev-dvb-adaptor.device . > >> Am 26.08.2014 21:52, schrieb Chris Tapp: >>> I've got a service running under systemd that will only start once a kernel module has loaded and created its /dev/dvb/adaptor nodes. >>> >>> Unfortunately, it doesn't load until after the service has failed and gone into an error state due to too many restarts. >>> >>> I could "fix" this by increasing the restart interval, but is there a way of adding a dependancy on the kernel module? >>> >>> -- >>> >>> Chris Tapp >>> opensource@keylevel.com >>> www.keylevel.com >>> >>> >>> >>> > > -- > > Chris Tapp > opensource@keylevel.com > www.keylevel.com > > > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: systemd - how do I wait for a driver to load? 2014-08-27 7:46 ` Sven Ebenfeld @ 2014-08-28 16:57 ` Chris Tapp 2014-08-28 19:51 ` Sven Ebenfeld 0 siblings, 1 reply; 8+ messages in thread From: Chris Tapp @ 2014-08-28 16:57 UTC (permalink / raw) To: Sven Ebenfeld; +Cc: Yocto Project On 27 Aug 2014, at 08:46, Sven Ebenfeld <sven.ebenfeld@gmail.com> wrote: > > > Am 26.08.2014 22:51, schrieb Chris Tapp: >> >> On 26 Aug 2014, at 21:02, Sven Ebenfeld <sven.ebenfeld@gmail.com> wrote: >> >>> You should look at "ConditionPathExists=" Options of systemd-units. >> >> Thanks, that looks like it would do the job. I was hoping not to hard code paths as they may change if a configuration file is changed, but... >> >>> Otherwise if udev is loading your device module, you could add the >>> device-unit to "Requires=" option. >> >> This sounds better. Is there an easy way to tell if udev did load the module? There's nothing obvious in the syslog. > > If you didn't load the module by hand it's probably udev. If you didn't > run modprobe or insmod. Then you should try to create a device-unit for > the device. > > For /dev/dvb/adaptor the unit should probably be something like > dev-dvb-adaptor.device . Thanks. I've now got a udev rule firing when the device loads. I'm using this to create a device alias (SYMLINK) so I can get consistent names, and this is working great. I've added TAG+="systemd" to the rule and I'm getting a .device generated automatically when the driver loads. However, the name for this isn't friendly (lots of bus id components). Is there a way to create my own name as my service doesn't want to know where the device is on the bus? I've tried adding something like ENV{SYSTEMD_WANTS}="some-new-name.device" - this also gets created, but it never becomes active (and can't be manually started). > Am 26.08.2014 21:52, schrieb Chris Tapp: >>>> I've got a service running under systemd that will only start once a kernel module has loaded and created its /dev/dvb/adaptor nodes. >>>> >>>> Unfortunately, it doesn't load until after the service has failed and gone into an error state due to too many restarts. >>>> >>>> I could "fix" this by increasing the restart interval, but is there a way of adding a dependancy on the kernel module? >>>> >>>> -- >>>> >>>> Chris Tapp >>>> opensource@keylevel.com >>>> www.keylevel.com >>>> >>>> >>>> >>>> >> >> -- >> >> Chris Tapp >> opensource@keylevel.com >> www.keylevel.com >> >> >> >> -- Chris Tapp opensource@keylevel.com www.keylevel.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: systemd - how do I wait for a driver to load? 2014-08-28 16:57 ` Chris Tapp @ 2014-08-28 19:51 ` Sven Ebenfeld 2014-08-28 20:57 ` Chris Tapp 0 siblings, 1 reply; 8+ messages in thread From: Sven Ebenfeld @ 2014-08-28 19:51 UTC (permalink / raw) To: Chris Tapp; +Cc: Yocto Project Am 28.08.2014 18:57, schrieb Chris Tapp: > > On 27 Aug 2014, at 08:46, Sven Ebenfeld <sven.ebenfeld@gmail.com> wrote: >> Am 26.08.2014 22:51, schrieb Chris Tapp: >>> On 26 Aug 2014, at 21:02, Sven Ebenfeld <sven.ebenfeld@gmail.com> wrote: >>> >>>> You should look at "ConditionPathExists=" Options of systemd-units. >>> >>> Thanks, that looks like it would do the job. I was hoping not to hard code paths as they may change if a configuration file is changed, but... >>> >>>> Otherwise if udev is loading your device module, you could add the >>>> device-unit to "Requires=" option. >>> >>> This sounds better. Is there an easy way to tell if udev did load the module? There's nothing obvious in the syslog. >> >> If you didn't load the module by hand it's probably udev. If you didn't >> run modprobe or insmod. Then you should try to create a device-unit for >> the device. >> >> For /dev/dvb/adaptor the unit should probably be something like >> dev-dvb-adaptor.device . > > Thanks. I've now got a udev rule firing when the device loads. > > I'm using this to create a device alias (SYMLINK) so I can get consistent names, and this is working great. > > I've added TAG+="systemd" to the rule and I'm getting a .device generated automatically when the driver loads. However, the name for this isn't friendly (lots of bus id components). Is there a way to create my own name as my service doesn't want to know where the device is on the bus? > > I've tried adding something like ENV{SYSTEMD_WANTS}="some-new-name.device" - this also gets created, but it never becomes active (and can't be manually started). > There should be an option like SYSTEMD_ALIAS in udev database. I haven't used it yet, but I think it should help out here. http://www.freedesktop.org/software/systemd/man/systemd.device.html describes it as "SYSTEMD_ALIAS= Adds an additional alias name to the device unit. This must be an absolute path that is automatically transformed into a unit name. (See above.)" >> Am 26.08.2014 21:52, schrieb Chris Tapp: >>>>> I've got a service running under systemd that will only start once a kernel module has loaded and created its /dev/dvb/adaptor nodes. >>>>> >>>>> Unfortunately, it doesn't load until after the service has failed and gone into an error state due to too many restarts. >>>>> >>>>> I could "fix" this by increasing the restart interval, but is there a way of adding a dependancy on the kernel module? >>>>> >>>>> -- >>>>> >>>>> Chris Tapp >>>>> opensource@keylevel.com >>>>> www.keylevel.com >>>>> >>>>> >>>>> >>>>> >>> >>> -- >>> >>> Chris Tapp >>> opensource@keylevel.com >>> www.keylevel.com >>> >>> >>> >>> > > -- > > Chris Tapp > opensource@keylevel.com > www.keylevel.com > > > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: systemd - how do I wait for a driver to load? 2014-08-28 19:51 ` Sven Ebenfeld @ 2014-08-28 20:57 ` Chris Tapp 0 siblings, 0 replies; 8+ messages in thread From: Chris Tapp @ 2014-08-28 20:57 UTC (permalink / raw) To: Sven Ebenfeld; +Cc: Yocto Project On 28 Aug 2014, at 20:51, Sven Ebenfeld <sven.ebenfeld@gmail.com> wrote: > Am 28.08.2014 18:57, schrieb Chris Tapp: >> >> On 27 Aug 2014, at 08:46, Sven Ebenfeld <sven.ebenfeld@gmail.com> wrote: >>> Am 26.08.2014 22:51, schrieb Chris Tapp: >>>> On 26 Aug 2014, at 21:02, Sven Ebenfeld <sven.ebenfeld@gmail.com> wrote: >>>> >>>>> You should look at "ConditionPathExists=" Options of systemd-units. >>>> >>>> Thanks, that looks like it would do the job. I was hoping not to hard code paths as they may change if a configuration file is changed, but... >>>> >>>>> Otherwise if udev is loading your device module, you could add the >>>>> device-unit to "Requires=" option. >>>> >>>> This sounds better. Is there an easy way to tell if udev did load the module? There's nothing obvious in the syslog. >>> >>> If you didn't load the module by hand it's probably udev. If you didn't >>> run modprobe or insmod. Then you should try to create a device-unit for >>> the device. >>> >>> For /dev/dvb/adaptor the unit should probably be something like >>> dev-dvb-adaptor.device . >> >> Thanks. I've now got a udev rule firing when the device loads. >> >> I'm using this to create a device alias (SYMLINK) so I can get consistent names, and this is working great. >> >> I've added TAG+="systemd" to the rule and I'm getting a .device generated automatically when the driver loads. However, the name for this isn't friendly (lots of bus id components). Is there a way to create my own name as my service doesn't want to know where the device is on the bus? >> >> I've tried adding something like ENV{SYSTEMD_WANTS}="some-new-name.device" - this also gets created, but it never becomes active (and can't be manually started). >> > > There should be an option like SYSTEMD_ALIAS in udev database. I haven't > used it yet, but I think it should help out here. > > http://www.freedesktop.org/software/systemd/man/systemd.device.html > describes it as "SYSTEMD_ALIAS= Adds an additional alias name to the > device unit. This must be an absolute path that is automatically > transformed into a unit name. (See above.)" My original attempt is now working - I just had a typo in the dynamic .device name where it was referenced in the .service :-( So, assigning a SYMLINK to the udev rule and adding the "systemd" tag dynamically creates a device unit with a name of SYMLINK.device (which makes sense). The service then "BindsTo" to this device and runs "After" it is ready. Thanks for your help in getting this going :-) > Am 26.08.2014 21:52, schrieb Chris Tapp: >>>>>> I've got a service running under systemd that will only start once a kernel module has loaded and created its /dev/dvb/adaptor nodes. >>>>>> >>>>>> Unfortunately, it doesn't load until after the service has failed and gone into an error state due to too many restarts. >>>>>> >>>>>> I could "fix" this by increasing the restart interval, but is there a way of adding a dependancy on the kernel module? -- Chris Tapp opensource@keylevel.com www.keylevel.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: systemd - how do I wait for a driver to load? 2014-08-26 19:52 systemd - how do I wait for a driver to load? Chris Tapp 2014-08-26 20:02 ` Sven Ebenfeld @ 2014-08-26 20:07 ` Khem Raj 1 sibling, 0 replies; 8+ messages in thread From: Khem Raj @ 2014-08-26 20:07 UTC (permalink / raw) To: Chris Tapp; +Cc: Yocto Project On 14-08-26 20:52:58, Chris Tapp wrote: > I've got a service running under systemd that will only start once a kernel module has loaded and created its /dev/dvb/adaptor nodes. > > Unfortunately, it doesn't load until after the service has failed and gone into an error state due to too many restarts. > > I could "fix" this by increasing the restart interval, but is there a way of adding a dependancy on the kernel module? if you module is loaded automatically on boot then dependent service could use below dependency After=systemd-modules-load.service > > -- > > Chris Tapp > opensource@keylevel.com > www.keylevel.com > > > > > -- > _______________________________________________ > yocto mailing list > yocto@yoctoproject.org > https://lists.yoctoproject.org/listinfo/yocto ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-08-28 20:57 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-08-26 19:52 systemd - how do I wait for a driver to load? Chris Tapp 2014-08-26 20:02 ` Sven Ebenfeld 2014-08-26 20:51 ` Chris Tapp 2014-08-27 7:46 ` Sven Ebenfeld 2014-08-28 16:57 ` Chris Tapp 2014-08-28 19:51 ` Sven Ebenfeld 2014-08-28 20:57 ` Chris Tapp 2014-08-26 20:07 ` Khem Raj
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.