You are not logged in.

#1 2017-09-05 17:12:44

starfry
Member
From: Surrey, UK
Registered: 2010-08-18
Posts: 230

systemd requires symlinks in initramfs - can mkinitcpio deliver?

Is it possible to instruct mkinitcpio to preserve symlinks in the initramfS it creates?

Systemd since 233 ignores unit files it expects to be symlinks but aren't. This means that any unit dependencies (e.g. some_unit.wants/something.service) must be symlinks. Before 233 it did not matter.

When mkinitcpio creates the initramfs it COPIES the files given in the FILES block. Any of those which are symlinks in the filesystem will become regular files in the initramfs due to this copy. I cannot see a way to specify preservation of symlinks to mkinitcpio.

I have manually created a "cpio" that does contain symlinks and that does work fine. For anyone interested, here's how I did that:

$ mkdir initcpio
$ cd initcpio
$ lsinitcpio -x /boot/initramfs-linux.img
$ ..... (replace files with symlinks)
$ find -mindepth 1 -printf '%P\0' | LANG=C bsdcpio -0 -o -H newc --quiet | gzip > /boot/initramfs-linux.img

This changed in version 233 of systemd, I think the related commit is 1f9e5cf
5/feb/17 to file src/core/load-dropin.c

Last edited by starfry (2017-09-05 18:20:17)

Offline

#2 2017-09-05 21:16:38

progandy
Member
Registered: 2012-05-17
Posts: 5,196

Re: systemd requires symlinks in initramfs - can mkinitcpio deliver?

You could write your own hook that uses add_symlink and maybe reads an array from mkinitcpio.conf.
Or maybe an install hook with add_systemd_unit. This should pull all dependencies and also add *.wants/new_unit if it exists in your systemd configuration.

Last edited by progandy (2017-09-05 21:26:17)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2017-09-06 11:32:50

starfry
Member
From: Surrey, UK
Registered: 2010-08-18
Posts: 230

Re: systemd requires symlinks in initramfs - can mkinitcpio deliver?

Thanks @prograndy I've done that kind of thing before so could do so here. But I wouldn't have thought the need to include units in the initramfs is so niche that nobody else would have this issue....

Offline

#4 2017-09-06 12:08:20

progandy
Member
Registered: 2012-05-17
Posts: 5,196

Re: systemd requires symlinks in initramfs - can mkinitcpio deliver?

I think the provided hooks suffice for most tasks, I never needed to add custom files.
Maybe you would like mkinitcpio-systemd-tools from the AUR. https://aur.archlinux.org/packages/mkin … temd-tool/
You could try a feature request for a simple way to add symlinks or systemd units, but I don't know if that would be accepted. https://bugs.archlinux.org/index.php?st … 1&do=index

Last edited by progandy (2017-09-06 12:15:59)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#5 2017-09-06 13:07:24

starfry
Member
From: Surrey, UK
Registered: 2010-08-18
Posts: 230

Re: systemd requires symlinks in initramfs - can mkinitcpio deliver?

I took a quick look at mkinitcpio-systemd-tools. I can see it has a provision for symlinks. It might be overkill for my needs though. I'd like to see if this is something that mkinitcpio could support so I have raised a feature request: https://bugs.archlinux.org/task/55535

Offline

Board footer

Powered by FluxBB