问题原文
原帖链接 · Slashterix · CC BY-SA 3.0
So systemd-sysv-generator converts old style init.d files into systemd service files. But it might do this before all mounts have been mounted.
I have some legacy commercial software that lives in /opt which is a separate mount point. It creates a symlink from /etc/init.d/their_service to a file in /opt
So when the server boots, systemd-sysv-generator cant yet read the linked file and fails to create a service and thus fails to start the service.
As the legacy software is managed by another team and they have the power to update it themselves, I don't want to start copying the file out of /opt and replacing the symlink. Or worse, try rewriting this into a systemd service myself.
Is there any way to have systemd-sysv-generator fire after opt.mount?
已采纳解答
原帖链接 · Slashterix · CC BY-SA 3.0
Thanks to the hint from iwaseatenbyagrue to read https://www.freedesktop.org/software/systemd/man/systemd.special.html I found this section
initrd-fs.target
systemd-fstab-generator(3) automatically adds dependencies of type Before= to sysroot-usr.mount and all mount points found in /etc/fstab that have x-initrd.mount and not have noauto mount options set.
So my fix was to do the following
- Edit
/etc/fstabto have the x-initrd.mount option for my /opt mount point
/dev/mapper/rootvg-opt /opt ext4 nodev,x-initrd.mount 0 0
- Edit
/etc/default/grubto list the extra mount point inGRUB_CMDLINE_LINUX
GRUB_CMDLINE_LINUX="rd.lvm.lv=rootvg/root rd.lvm.lv=rootvg/swap rd.lvm.lv=rootvg/usr rd.lvm.lv=rootvg/opt ipv6.disable=1 rhgb quiet"
- Rebuild the boot
grub2-mkconfig -o /boot/grub2/grub.conf
dracut -f
These steps combined cause SystemD to correctly mount /opt early in the boot and succeed with systemd-sysv-generator
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
