Comment 18 for bug 1325142

Revision history for this message
jox (joxonox) wrote :

I have investigated this some more. I will provide a solution for UCK (Ubuntu Customization Kit) but it might apply to other contexts as well.

It is actually 3 distinct issues:

The main problem is the missing init scripts. This is a result from UCK deactivating initctl (see also in the output of uck-chroot-rootfs: "Deactivating initctl..."). This makes invoke-rc.d fail when trying to run upstart jobs (Ubuntu uses upstart (not init) for the services in question). The "/etc/init.d/* not found" is a followup error and actually misleading.

The fix described previously (modifying .prerm/.postinst files) does work, but it's better to fix it globally and not for each affected package. I found it's best to do it right in invoke-rc.d. Just change all "exit 100" to "exit 0" in /usr/sbin/invoke-rc.d (in the chroot!). That will generally ignore missing init scripts. Don't forget to revert the change afterwards.

The second problem is the missing /scripts directory ("Can't open /scripts/casper-functions" error). This can be fixed with the following command (in the chroot!):

  ln -s /usr/share/initramfs-tools/scripts /scripts

The third problem is that the UCK applies a hack on the zz-update-grub scripts which in my case creates an invalid syntax and thus breaks the upgrade as well (dependency problems on the linux-image-generic package). The fix is described in my comment #10.

In order to avoid applying these patches manually each time, I modified UCK to apply it when entering chroot, and revert it when exiting (amongst the other stuff that UCK does in these stages). It's all in /usr/lib/uck/remaster-live-cd.sh.

I made a fork of the UCK source code on github and applied the changes. You may just get the follwing file

  https://raw.githubusercontent.com/jox/UCK/master/libraries/remaster-live-cd.sh

and replace your /usr/lib/uck/remaster-live-cd.sh with it (this time *not* in the chroot...).

You might also apply the attached patch as follows:

  $ cd /usr/lib/uck
  $ sudo patch -p2 remaster-live-cd.sh.bak < \
      /path/to/fix-uck-missing-initd-scripts-1.patch

(The path in the patch is different since it is from the source code. Running patch with -p2 from the directory the file is located will apply it properly.)

You may view the changes on github as well:

Fixed missing /scripts dir in chroot.
https://github.com/jox/UCK/commit/2f14005cd47845d7496e6a2b1bdd72a553fd6be2

Fixed "grub-probe postinst/postrm hack" in chroot.
https://github.com/jox/UCK/commit/d2e2ffbbae80392357b8bf442d28678f9298c52a

Added hack to invoke-rc.d in chroot to ignore missing init scripts.
https://github.com/jox/UCK/commit/4c8277459c42f089fd73e6ae9a25d3e73177f491

Hope this helps