[systemd-devel] Fwd: With my layer, Systemd not invoking my application at startup

Colin Guthrie colin at mageia.org
Wed Jul 1 01:11:05 PDT 2015


Vipin Nair wrote on 01/07/15 07:00:
> 
> 
> Hi All,
> 
> I am using the yacto style project and I have  created a layer (my first
> layer) and have build it with WindRiver media which uses Systemd for the
> startup services. 
> 
> As per my application need, I have to create a new user on the final
> image and change the owner permissions of certain files to the new user. 
> Since I could not get it done on the build machine, I have written the
> post install script such that it gets executed on the  target board
> during the 1st boot cycle
> and from within the post install script I am creating the new user and
> changing the file ownership. And this works. 
> 
> But the only problem I have now is that, even though I register my
> service with Systemd at pre-install (or postinstall) section (using the
> systemctl enable command)
> my service is not getting launched by Systemd during the 1st boot. On
> subsequent reboots, it invokes my service at boot up. 


It's hard to say without seeing your actual service (specifically it's
[Install] section) as otherwise we cannot tell what data systemctl
enable has to work with.

However, from the description of your problem I think you're likely
trying to solve it the wrong way.

systemd comes with two concepts to do what you want. sysusers is a
mechanism to initialise system users and can be confirured to run on
first boot. It will create your user for you.

tmpfiles can create and change ownership of files and directories. It
runs on every boot.

Dropping in the appropriate configuration snippet for both might be
sufficient for your needs and is likely cleaner than using a service.

Hope this helps.

Col


-- 

Colin Guthrie
colin(at)mageia.org
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list