0

I looked here Kernel boot process and I tried to understand how to run a script before initrd filesystem removed and but after the root filesystem has been mounted (EncFS), If I understand it correctly, /sbin/init is executed after initrd filesystem is removed so if I'll put a script in /etc/rc.d/ it won't have access to the initrd filesystem, I'm looking for solution to solve this problem.

Thanks.

BTW, the documentation kernel initrd mentions that /sbin/init is launched before initrd filesystem is freed, so It is possible to add scripts to /etc/rc.d/ and they will run before initrd is freed?

  • That depends on how the initrd is organized. How is your initrd organized? Is it the one from some distribution? Are you sure it's an initrd and not an initramfs (most distributions have switched, even if the file is still called initrd)? – Gilles 'SO- stop being evil' Mar 5 '16 at 23:49
1

(Only tested on debian/ubuntu based systems, don't know about suse/redhat etc.)

The best way is to add a file in /usr/share/initramfs-tools/scripts - init-bottom or local-bottom are the right directories in your case. Don't forget to make a update-initramfs -c -k all afterwards.

| 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.