0

I am in the process of upgrading a sysv-based system to systemd (CentOS 6 -> 7), and I would like to rely on systemd-sysv-generator to run some of services that still have their scripts under /etc/init.d.

The problem is, some of the files under /etc/init.d are actually soft links to files on a secondary partition.

It looks like this partition is not yet mounted when systemd-sysv-generator runs, and all I see in the log is a bunch of "no such file or directory" errors from the generator script. Systemd documentation says that the generators run "very early at bootup", and the processing of /etc/fstab happens much later.

I think what I need to do is somehow make initramfs or the kernel mount the secondary drive, but I don't know if that's possible. The responses for this and this questions are not very encouraging, and seem to suggest that this is at the very least an unorthodox approach.

Another option might be to re-run the generator after the drive has been mounted, but I don't know how to do that, and whether it will be "too late", so to speak, and the services will get created but not started.

What should I do?

EDIT: To make it more concrete, let's say my root partition is at /dev/sda1, and I have a secondary partition at /dev/sda2, usually mounted as /secondary. /etc/init.d/myservice is a symbolic link to /secondary/myservice. This used to work fine, but stopped working under systemd for the reasons mentioned.

1

I would take the time to go ahead and do a one-time creation of proper systemd ".service" files for your legacy services. This will simplify your system overall, solving your boot order problem and eliminating the sysV->systemd translation later.

If your legacy services are provided by a third party, you may find that they have published systemd .service files for newer versions which you can likely easily adapt for the older versions you are running.


Another option is to simply copy the init scripts from the second partition to the boot partition. Add a comment to the files to remind future admins to copy them to the second location if they make changes.

| improve this answer | |
0

Force systemd mounting some partititions before anything

It would work if you treated your [secondary filesystem] like usr, i.e. mount it in the initramfs. Obviously this will require the initramfs to set up networking. The initramfs transition is equivalent to a daemon-reload, but you're not introducing one of those at a new point. dracut has specific support for mounting additional filesystems. ... I would specifically recommend using the mount option x-initrd.mount in fstab to mark the mount, as systemd also applies some special handling in this case.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.