Bug 4588

Summary: Missing symlink to /etc/init.d/functions.initscripts on first boot
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Marc Ferland <marc.ferland>
Component: coreAssignee: Saul Wold <sgw>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: Medium CC: meta.mr.watcher, meta.watcher, poky.bs.watcher, poky.watcher, Qi.Chen
Version: 1.4   
Target Milestone: 1.4.2   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---
Attachments:
Description Flags
log.do_rootfs
none
initscripts postinst
none
initscripts bbappend none

Description Marc Ferland 2013-05-31 14:59:17 UTC
While upgrading to 1.4, I noticed that udev and other init scripts where not run on the first boot.

This seems to be caused by a missing symlink to /etc/init.d/functions.initscripts.

Currently, a number of scripts source the /etc/init.d/functions file on startup. Beginning with 1.4 this file has been replaced with a symlink which is created later in the boot process.

Once the symlink is created everything runs fine, but this means you have to reboot at least once (I don't know what happens on RO rootfs...?).

The symlink is created in the /etc/init.d/S98run-postinsts script which looks like a temporary script.
Comment 1 Marc Ferland 2013-06-04 15:57:35 UTC
change product to oe-core
Comment 2 Saul Wold 2013-06-04 18:06:41 UTC
I just verified a 1.4 core-image-minimal image and found that the functions files is correctly linked to functions.initscripts.

lrwxrwxrwx 1 sgw sgw   33 May  6 13:57 functions -> /etc/init.d/functions.initscripts
-rw-r--r-- 1 sgw sgw 1391 May  6 13:48 functions.initscripts

Can you confirm what your settings are for building your image?

Are you using 1.4.1, master?  my Head is: 789b2b7, which is the Dylan-9.0.0 tag.
Comment 3 Marc Ferland 2013-06-04 18:23:26 UTC
(In reply to comment #2)
> I just verified a 1.4 core-image-minimal image and found that the functions
> files is correctly linked to functions.initscripts.
> 
The symlink exists on my image too, the problem is that it is created at the _end_ of the first boot process i.e.: it's not there early on the first boot.

> Can you confirm what your settings are for building your image?
> 
> Are you using 1.4.1, master?  my Head is: 789b2b7, which is the Dylan-9.0.0
> tag.

I'm using dylan branch, commit:b15bdd842092.

The image uses udev/sysv (no systemd).

Current layers are:
BBLAYERS ?= " \
  /home/marc/yocto/build/yocto13/poky/meta \
  /home/marc/yocto/build/yocto13/poky/meta-yocto \
  /home/marc/yocto/build/yocto13/poky/meta-yocto-bsp \
  /home/marc/yocto/build/yocto13/poky/meta-intel \
  /home/marc/yocto/build/yocto13/poky/meta-intel/meta-crownbay \
  /home/marc/yocto/build/yocto13/poky/meta-sonatest \
  /home/marc/yocto/build/yocto13/poky/meta-sonatest/meta-osprey \
  /home/marc/yocto/build/yocto13/poky/meta-openembedded/meta-oe \
  /home/marc/yocto/build/yocto13/poky/meta-openembedded/meta-networking \
  "
Comment 4 Marc Ferland 2013-06-04 18:33:41 UTC
For example, this fixes the bug for udev (but like I said other scripts are also affected):

diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index cd87f50..d58ecc5 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -9,7 +9,7 @@
 # Short-Description: Start udevd, populate /dev and load drivers.
 ### END INIT INFO
 
-. /etc/init.d/functions
+. /etc/init.d/functions.initscripts
 
 export TZ=/etc/localtime
 
Probably not the right thing to do but it shows what I had to do to get around this issue.
Comment 5 Saul Wold 2013-06-05 00:23:09 UTC
Marc, I was looking at the generated rootfs image prior to first boot, by loop-back mount of the .ext3 (in my case).

Can you look at your rootfs image, I pulledthe dylan you have since it is a different git tag than what was 9.0.0, it seems to be Dylan Head for 1.4.1 and when I look at the image (prior to first boot) via a loop back mount those files are correctly linked.

I double checked my first boot and udev starts up with no issues and the symlinks are correct, can you try a straight up poky build, I wonder if we are chasing some other issue.

Thanks
Comment 6 Chen Qi 2013-06-05 03:21:51 UTC
Hi Marc,

The symlink is created by update-alternatives. It's specified in the postins section of the .spec (take rpm package manager as and example), and is created when installed into the rootfs.

In your case, the symlink is not created properly at rootfs time?
Could you please check the do_rootfs log to see whether there are any failures?
I think maybe the postinst of initscripts failed on your host at rootfs time.

Could you please provide more information?

Thanks,
Chen Qi
Comment 7 Marc Ferland 2013-06-05 13:57:08 UTC
Created attachment 1241 [details]
log.do_rootfs
Comment 8 Marc Ferland 2013-06-05 13:58:58 UTC
Created attachment 1242 [details]
initscripts postinst
Comment 9 Marc Ferland 2013-06-05 13:59:58 UTC
I see update-alternatives linking lots of things but no sign of /etc/init.d/functions. I'm not seeing any failures either.

I also see this line in my log.do_rootfs:
...
Delayed package scriptlet: # initscripts - postinst
...

as well as this in my post-install scripts:
tmp/work/veo1664-poky-linux/sonatest-image/1.0-r29/rootfs/etc/rpm-postinsts:
  total used in directory 20K available 423755752
  drwxr-xr-x 1 marc marc   96 Jun  4 13:36 .
  drwxr-xr-x 1 marc marc 1.4K Jun  4 13:37 ..
  -rwxr-xr-x 1 marc marc  327 Jun  4 13:35 initscripts
...

Note: both files attached to bug report.
Comment 10 Saul Wold 2013-06-05 16:08:17 UTC
OK, so we need to understand what's different between your setup and ours such that the postinsts is being delayed, looking in my logs I see the following:

update-alternatives: Linking /srv/hdd/releases/dylan/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/rootfs//boot/bzImage to bzImage-3.8.11-yocto-standard
  18:Installing initscripts     ######################################## [ 20%]
Output from initscripts-1.0-r140@i586:
update-alternatives: Linking /srv/hdd/releases/dylan/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/rootfs//etc/init.d/functions to /etc/init.d/functions.initscripts

Which is confirmed by the fact that the link exists in my rootfs image.

What additional targets are you building from the meta-oe and meta-sonatest?  Have you tried with out those layers (as a verification test).  Something in those layers might be affecting this.

BTW, are you on #yocto on freenode?
Comment 11 Marc Ferland 2013-06-05 17:48:16 UTC
(In reply to comment #10)
> What additional targets are you building from the meta-oe and meta-sonatest?
> Have you tried with out those layers (as a verification test).  Something in
> those layers might be affecting this.
> 
> BTW, are you on #yocto on freenode?

I have a couple of images defined in meta-sonatest that I build. They all inherit from core-image. They where working correctly with 1.3.

I'll try to build core-image-minimal without these two layers.

P.S. No, I'm not on #yocto, I should probably create an account.
Comment 12 Marc Ferland 2013-06-05 18:09:28 UTC
Got it!

I have a initscripts_1.0.bbappend in my meta-sonatest layer. It defines a pkg_postinst_${PN} function thats used to generate the /etc/hostname on first boot.

It looks like this messes up how update-alternative generates its symlinks.

If I comment out the pkg_postinst function and rebuild, I get:
lrwxrwxrwx 1 marc marc   33 Jun  5 13:56 functions -> /etc/init.d/functions.initscripts
-rw-r--r-- 1 marc marc 1.4K Jun  5 13:55 functions.initscripts

like I was suppose to.

Is this a bug, or did I miss something here?
Comment 13 Saul Wold 2013-06-05 21:12:39 UTC
Great!!

If you could attach your .bbappend that might help understand what's really happening.

I think a better place to set your hostname would be in the base-files recipe since that's where is created there.  We might need to change that to be hostname ?= "openembedded" or maybe even ??= to allow distro and / or local.conf override.

You could try from a .bbappend, but I think it will need more.
Comment 14 Marc Ferland 2013-06-05 21:27:57 UTC
Created attachment 1243 [details]
initscripts bbappend
Comment 15 Marc Ferland 2013-06-05 21:32:48 UTC
Thanks for your help on this one!

I'll make the change to bbappend base-files instead of initscripts.
Comment 16 Saul Wold 2013-06-06 05:05:26 UTC
I am not entirely sure, but I think your bbappend is actaully overriding the default and you should try using _append, but since your would fail on the host it gets deferred to the target which is why you where seeing it happen late.

I will close this bug now.