Bug 693974

Summary: systemd: /etc/init.d/boot.local not executed
Product: [openSUSE] openSUSE 12.1 Reporter: Jiri Slaby <jslaby>
Component: BasesystemAssignee: Frederic Crozat <fcrozat>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: werner
Version: Factory   
Target Milestone: ---   
Hardware: All   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on:    
Bug Blocks: 696902    

Description Jiri Slaby 2011-05-16 09:40:34 UTC
Maybe there is another way how to initialize something once at boot. But it's not definitely /etc/init.d/boot.local which worked with sysvinit. And I cannot find the way how to achieve that with systemd.

I have this in the script:
ethtool -s eth0 wol d
echo 3000 > /proc/sys/vm/dirty_writeback_centisecs
echo noop > /sys/block/sda/queue/scheduler
echo 5 > /proc/sys/vm/laptop_mode

But neither of that is set.
Comment 1 Kay Sievers 2011-05-18 19:01:21 UTC
It's not hooked-in at the moment. We need to add a service file for it,
I guess.

In general: /proc/sys/ belongs into /etc/sysctl.d/*.conf, /sys belongs
into /etc/udev/rules.d/*.rules

I think there is 'ethtool' support in the network config files, never tried any
of the static network setup though.
Comment 2 Frederic Crozat 2011-07-05 11:54:12 UTC
Jiri, could you create /etc/systemd/system/boot-local.service with the following content :
[Unit]
Description=Local service to start at end of boot
Requires=default.target
After=default.target
Type=oneshot
ExecStart=/etc/init.d/boot.local

and run :
systemctl daemon-reload
systemctl enable boot-local.service

(I didn't test the file ;)
Comment 3 Jiri Slaby 2011-07-06 12:34:43 UTC
(In reply to comment #2)
> Jiri, could you create /etc/systemd/system/boot-local.service with the
> following content :
> [Unit]
> Description=Local service to start at end of boot
> Requires=default.target
> After=default.target
> Type=oneshot
> ExecStart=/etc/init.d/boot.local
> 
> and run :
> systemctl daemon-reload
> systemctl enable boot-local.service

It yields:
Unit files contain no applicable installation information. Ignoring.

> (I didn't test the file ;)

Well, you apparently should have.
Comment 4 Frederic Crozat 2011-07-06 13:48:02 UTC
Sorry about that.

Correct content for /etc/systemd/system/boot-local.service:
[Unit]
Description=Local service to start at end of boot

[Service]
Requires=default.target
After=default.target
Type=oneshot
ExecStart=/etc/init.d/boot.local

[Install]
WantedBy=multi-user.target
Comment 5 Jiri Slaby 2011-07-06 13:59:37 UTC
(In reply to comment #4)
> Sorry about that.
> 
> Correct content for /etc/systemd/system/boot-local.service:

I can enable the service, but every "systemctl isolate multi-user.target" invocation runs the boot.local script. However it should be run exactly once at boot time. Like with sysvinit.
Comment 6 Frederic Crozat 2011-07-06 15:25:39 UTC
please add 
RemainAfterExit=true

in the Service section

it should fix the isolate problem.
Comment 7 Jiri Slaby 2011-07-06 17:59:40 UTC
(In reply to comment #6)
> please add 
> RemainAfterExit=true
> 
> in the Service section
> 
> it should fix the isolate problem.

Yeah, it looks like it does what is expected from it now.
Comment 8 Frederic Crozat 2011-07-07 09:05:52 UTC
Thanks for your feedback. I'm going to integrate a unit file slighly different, since systemd has a similar unit file, which is fedora specific. I'll adapt it for suse. And I'll do similar port for halt.local
Comment 9 Frederic Crozat 2011-08-03 17:01:53 UTC
fixed in Factory
Comment 10 Sascha Peilicke 2012-10-29 13:17:25 UTC
Are there any plans to do a maintenance update for 12.2?
Comment 11 Frederic Crozat 2012-10-29 13:26:11 UTC
Hmm, this has been fixed before 12.2 was released.
Comment 12 Sascha Peilicke 2012-10-29 14:46:52 UTC
Indeed, /lib/systemd/system/local.service is there, /etc/init.d/boot.local has 744 perms and is executed. So it's a different issue, sorry for the noise.