<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to automatically start services with systemd in Yocto in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746502#M116153</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you ever get this to work?&amp;nbsp; I am having the same problem.&amp;nbsp;&amp;nbsp;The only way I can get my services to start at boot is by creating the symlink.&amp;nbsp; Even after following the link posted by gusarambula&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Aug 2018 21:04:33 GMT</pubDate>
    <dc:creator>ryanpabis</dc:creator>
    <dc:date>2018-08-14T21:04:33Z</dc:date>
    <item>
      <title>How to automatically start services with systemd in Yocto</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746499#M116150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am upgrading a product I have developed to the latest iMX6 BSP that is using Yocto Morty. One big change with the Morty based BSP is the use of Systemd in place of System V Init files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I read that systemd is supposed to be backaward compatible with the SysV Init files but I do not see this occur. I see that the generated service files are created but the services themselves are not started at boot up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get around this, I am regenerating the init files using "*.service" files handled by Systemd. I can generate the files but I need to find a way to specifiy the services that start at bootstrap from the Yocto recipes. I can do it by creating a symlink to the service file from /etc/systemd/system/multi-user.target.wants/ directory. However, I read that manually creating these symlinks is not suggested.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the preferred way within Yocto to create systemd service files that are automatically activated at boot? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doug Bailey&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2018 15:57:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746499#M116150</guid>
      <dc:creator>dougbailey</dc:creator>
      <dc:date>2018-03-28T15:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically start services with systemd in Yocto</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746500#M116151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Doug Bailey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are some documents online that may be of help, like the following thread on a third-party forum. I hope it helps!&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/45614578/enable-systemd-services-using-yocto"&gt;https://stackoverflow.com/questions/45614578/enable-systemd-services-using-yocto&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2018 20:42:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746500#M116151</guid>
      <dc:creator>gusarambula</dc:creator>
      <dc:date>2018-04-27T20:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically start services with systemd in Yocto</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746501#M116152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the information. &amp;nbsp;It's a big help.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2018 02:12:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746501#M116152</guid>
      <dc:creator>dougbailey</dc:creator>
      <dc:date>2018-04-30T02:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically start services with systemd in Yocto</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746502#M116153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you ever get this to work?&amp;nbsp; I am having the same problem.&amp;nbsp;&amp;nbsp;The only way I can get my services to start at boot is by creating the symlink.&amp;nbsp; Even after following the link posted by gusarambula&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2018 21:04:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746502#M116153</guid>
      <dc:creator>ryanpabis</dc:creator>
      <dc:date>2018-08-14T21:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically start services with systemd in Yocto</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746503#M116154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I ended up using a symlink when I wanted to force the startup in the build process. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added the following into my do_install function:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; install -d ${D}/etc/systemd/system/multi-user.target.wants&lt;BR /&gt;&amp;nbsp; &amp;nbsp; install -m 644 ${WORKDIR}/resetswx.service ${D}/etc/systemd/system/resetswx.service&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ## Add following link if you want auto start of service&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ## ln -s /etc/systemd/system/resetswx.service ${D}/etc/systemd/system/multi-user.target.wants/resetswx.service&lt;/P&gt;&lt;P&gt;fi&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2018 21:50:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746503#M116154</guid>
      <dc:creator>dougbailey</dc:creator>
      <dc:date>2018-08-14T21:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically start services with systemd in Yocto</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746504#M116155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Doug.&amp;nbsp; Not sure exactly what fixed it for me but this is what I did and it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NOTE&lt;/STRONG&gt;: Like many others I had a sysvinit script and then let the systemd-sysv-generator create a wrapper for me which I called dl-mgr.service.&amp;nbsp; This service starts and stops the dl-mgr.sh script.&amp;nbsp; You can find these files in (&lt;STRONG style="color: #2d2d2d; background-color: #ffffff; font-weight: bolder;"&gt;/run/systemd/generator.late/)&amp;nbsp;&lt;/STRONG&gt;if you don't have a .service file yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SRC_URI = "file://dl-mgr.sh \&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;file://dl-mgr.service \"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inherit update-rc.d &lt;STRONG&gt;systemd&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SYSTEMD_PACKAGES = "${PN}"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;INITSCRIPT_PACKAGES = "${PN}"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SYSTEMD_SERVICE_${PN} = "dl-mgr.service"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then added this to my do_install section&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i&lt;STRONG&gt;nstall -d ${D}${libexecdir}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; install -m 0755 ${WORKDIR}/dl-mgr.sh ${D}${libexecdir}/dl-mgr.sh&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; install -d ${D}${systemd_system_unitdir}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; install -m 0644 ${WORKDIR}/dl-mgr.service ${D}${systemd_system_unitdir} &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As well as this to the end of the .bb file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FILES_${PN} += "${libexecdir}/dl-mgr.sh"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;FILES_${PN} += "${systemd_system_unitdir}/dl-mgr.service"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then finally, i updated my dl-mgr.service (the one that was autogenerated) to include this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ExecStart=&lt;STRONG&gt;/usr/libexec/&lt;/STRONG&gt;dl-mgr.sh start&lt;BR /&gt;ExecStop=&lt;STRONG&gt;/usr/libexec/&lt;/STRONG&gt;dl-mgr.sh stop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[Install]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WantedBy=multi-user.target&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2018 00:13:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746504#M116155</guid>
      <dc:creator>ryanpabis</dc:creator>
      <dc:date>2018-08-15T00:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically start services with systemd in Yocto</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746505#M116156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Whereas my solution is more of a hack, this looks like a better way to implement the service.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for posting this. &amp;nbsp;I will use it in the future.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2018 13:53:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746505#M116156</guid>
      <dc:creator>dougbailey</dc:creator>
      <dc:date>2018-08-15T13:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically start services with systemd in Yocto</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746506#M116157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe the important lines related to enabling the service at startup -- that made your recipe work are:&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;BR /&gt;1.) in your recipe:&lt;BR /&gt;&lt;STRONG&gt;inherit&lt;/STRONG&gt; update-rc.d&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: bold;"&gt;systemd&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2.) in your service file&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;[Install]&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;WantedBy=multi-user.target&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Explanation:&lt;BR /&gt;&lt;/STRONG&gt;1. This line in the recipe, particularly,&lt;STRONG&gt; inherit systemd,&amp;nbsp;&lt;/STRONG&gt;makes use of the &lt;STRONG&gt;systemd.bbclass&lt;/STRONG&gt; located in &lt;STRONG&gt;poky/meta/classes&lt;/STRONG&gt; where&amp;nbsp;the default directive is to enable services&amp;nbsp;as seen from the lines:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;# Whether to enable or disable the services on installation.&lt;BR /&gt;SYSTEMD_AUTO_ENABLE ??= "enable"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;2. This line is important because in the process of enabling the service, it specifies -- in what systemd target directory the symlink will be installed. In this case, the symlink should be in etc/systemd/system/multi-user.target.wants directory.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2019 03:03:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/746506#M116157</guid>
      <dc:creator>la_basco</dc:creator>
      <dc:date>2019-05-23T03:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically start services with systemd in Yocto</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/1398411#M185720</link>
      <description>&lt;DIV class=""&gt;&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/73966"&gt;@ryanpabis&lt;/a&gt;&amp;nbsp; thanks for the solution. I am trying to achieve the same to start my custom script during boot-up. If I have 2 scripts to be executed once rootfs is mounted or during boot-up how should I include 2 files in image recipe? Should I create 2 separate systemd service files? Can you please let me know how to do this? Assuming script names are custom-script1.sh and custom-script2.sh&lt;/P&gt;&lt;P&gt;Your help will be much appreciated.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Jan 2022 22:01:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-automatically-start-services-with-systemd-in-Yocto/m-p/1398411#M185720</guid>
      <dc:creator>Sourabh1107</dc:creator>
      <dc:date>2022-01-12T22:01:46Z</dc:date>
    </item>
  </channel>
</rss>

