Bug 5159 - systemd doesn't execute /etc/rcS.d
Summary: systemd doesn't execute /etc/rcS.d
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.5
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.7 M4
Assignee: Chen Qi
QA Contact:
URL:
Whiteboard: 25 September 2014: Documentation issu...
: 4862 (view as bug list)
Depends on:
Blocks: 5441
  Show dependency tree
 
Reported: 2013-09-10 09:06 UTC by LiRongQing
Modified: 2014-09-25 15:47 UTC (History)
7 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Done (doc changes complete)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description LiRongQing 2013-09-10 09:06:08 UTC
There are some scripts and service under /etc/rcS.d, but they will not
be called by systemd. If they are useless, please remove them when use
systemd, if some of them are useful, please creat *.service for them
follow the systemd standard.
Comment 1 Chen Qi 2013-09-10 12:18:04 UTC
The systemd.bbclass now deletes files under /etc/init.d when 'sysvinit' is not in DISTRO_FEATURES and it detetes files under systemd_unitdir if 'systemd' is not in DISTRO_FEATURES.

So is there any reason that a recipe inherits update-rc.d and it doesn't inherit systemd?

//Chen Qi
Comment 2 Saul Wold 2013-09-12 00:39:44 UTC
Please verify if you are using both sysvinit and systemd?  Is there a specific package / recipe that you are concerned with?  As Qi points out it may need to inherit systemd.
Comment 3 LiRongQing 2013-09-12 06:46:15 UTC
No, I only use systemd, the cause is that some packages did not inherit systemd,
or did not supply systemd unit file, so the sysvinit files can not be removed.
Comment 4 Ross Burton 2013-09-25 10:49:22 UTC
*** Bug 4862 has been marked as a duplicate of this bug. ***
Comment 5 Ross Burton 2013-10-03 16:11:59 UTC
So I have a patch that enables rcS (mostly from Debian, which has the same problem) but it's a bit too invasive for 1.5 at this point in time.
Comment 6 Chen Qi 2013-12-18 02:53:04 UTC
Hi Ross & Roy,

IMHO, I don't think we should execute *all* scripts under /etc/rcS.d/.
The real problem here is that some packages lack systemd support.
And I think we should fix such packages one by one if needed.

Of course, adding a unit file specifying 'ExecStart=/etc/rcS.d/xxx start' is one of the forms of adding systemd support.

What do you think?

//Chen Qi
Comment 7 Chen Qi 2014-01-24 03:13:29 UTC
Set in local.conf:

VIRTUAL_RUNTIME_initscripts = ""

I think such configuration should be recommended in a systemd based image.
Hope this could be included in our documentation.

//Chen Qi
Comment 9 Holger Freyther 2014-02-10 08:00:18 UTC
#4220 is mentioned in the commit message. I have some doubts towards the dropbear change.

1.) Does upgrading using opkg upgrade through a ssh session with dropbear still work when dropbear is being updated?

2.) We had the problem that dropbear created the host keys in place. So when the device is switched off at a bad moment or not fsync/fdatasync was used the hostkeys can have a zero size. The dropbearkey service appears prone to that issue again.


And to be honest the bug mentioned in the topic is not fixed. From what I assume is that there are no more /etc/rcS.d scripts to be executed. So besides the potential regressions introduced the bug is not relevant anymore.
Comment 10 Chen Qi 2014-02-10 08:36:45 UTC
(In reply to comment #9)
> #4220 is mentioned in the commit message. I have some doubts towards the
> dropbear change.
> 
> 1.) Does upgrading using opkg upgrade through a ssh session with dropbear
> still work when dropbear is being updated?
> 

Such case hasn't been tested. If there's any problem, could you please open a new bug? To be honest, I currently don't have environment to easily test such case.

> 2.) We had the problem that dropbear created the host keys in place. So when
> the device is switched off at a bad moment or not fsync/fdatasync was used
> the hostkeys can have a zero size. The dropbearkey service appears prone to
> that issue again.

You are right. I saw your patch.
There's a directive in systemd's unit file called ConditionFileNotEmpty=.
If you have time, would you please try this out?

Thanks,
Chen Qi

> 
> 
> And to be honest the bug mentioned in the topic is not fixed. From what I
> assume is that there are no more /etc/rcS.d scripts to be executed. So
> besides the potential regressions introduced the bug is not relevant anymore.
Comment 12 Scott Rifenbark 2014-04-14 14:34:47 UTC
Hi, 

I have applied Paul's review comments for the affected areas in Comment 11.  Here is the feedback:

"As we discussed, the bit about VIRTUAL-RUNTIME_initscripts = "" needs to be
removed everywhere you've added it. The only place we want to keep it is under
"Selecting an Initialization Manager", however it needs to be removed from
"Using Systemd for the Main Image and Using SysVinit for the Rescue Image",
and then specifically under "Using Systemd Exclusively", the following changes
need to be made:

* it needs to be moved *after* the other lines

* "Set this variable in your local.conf file:" -> "To remove  initscripts from
your image altogether, set this variable also:" (note, *not* in local.conf,
the custom distro config - and since the section has just talked about that,
that should be implied.)"

See the links for the changes.  I am marking this documentation flag to "Done."

Thanks, 
Scott
Comment 13 Holger Freyther 2014-05-12 14:03:01 UTC
The issue is not fully resolved in Dora. I sadly don't have the time to look at master right now. We are using a TI Davinci SoC which is a ARMv5te and doesn't support unaligned memory access. The "CPU alignment" script does not run and there is no .service file for changing the ignore to fixup.

I think the issue should be considered to be re-opened. Can you please check if the problem applies to master?
Comment 14 Ross Burton 2014-05-12 14:30:19 UTC
I think there was bug confusion between this and another bug, this certainly isn't fixed.
Comment 15 Scott Rifenbark 2014-07-07 07:40:50 UTC
Hi, 

I am not sure where we stand on this bug regarding the documentation needs.  Right now, the Documentation flag is set to "Done" due to fixes I had applied before it was reopened.  

Please consider the doc flag and set it to "Yes" if there are further fixes I need to apply to the docs. 

Scott
Comment 16 Chen Qi 2014-08-13 08:21:56 UTC
systemd cares about /etc/rc[0~6].d/ but it doesn't care about /etc/rcS.d.
I think the logic here is that anything under /etc/rcS.d should be handled by the systemd package itself. For example, the utility of the urandom script under /etc/rcS.d is now accomplished by the systemd-random-seed.service.

So the problem is not that systemd doesn't execute things under /etc/rcS.d, instead, it's that we should convert anything remained under /etc/rcS.d to systemd unit files.

If nobody objects, I'm going to close this bug.

//Chen Qi
Comment 17 Ross Burton 2014-08-13 09:25:50 UTC
Our sysvinit executes init scripts from rcS.d as well as rc[123456]d, so our systemd needs to as well.

rcS came from Debian, so they have a patch to add rcS support to their systemd.  We can likely just apply that.
Comment 18 Ross Burton 2014-09-25 15:33:56 UTC
Fixed in 198ed4b5bb11ea045b69523abb9244bd8d5df465.
Comment 19 Scott Rifenbark 2014-09-25 15:47:41 UTC
Hi, 

Sounds as if docs are not an issue here.  

Thanks, 
Scott