Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to learn how the initramfs works and how it may be configured. I would like curl to be added to the packages available in the initramfs, and run a script which uses curl during boot (which means the network has to be set up, before it).

How should I do it? (I need it to work when upgrading my kernel too.)

share|improve this question

You need to edit your initramfs hooks. Create your own file like so:

$ cat /usr/share/initramfs-tools/hooks/curl
#!/bin/sh -e
case $1 in
        prereqs) echo "${PREREQS}"; exit 0;;
. /usr/share/initramfs-tools/hook-functions
copy_exec /usr/bin/curl /bin

Rebuild your initramfs:

$ sudo update-initramfs -u
update-initramfs: Generating /boot/initrd.img-3.8.0-4-generic

Check that it actually landed in there:

$ lsinitramfs -l /boot/initrd.img-3.8.0-4-generic | grep curl
-rw-r--r--   1 root     root       385704 Nov 28 18:32 usr/lib/x86_64-linux-gnu/
-rwxr-xr-x   1 root     root       150344 Nov 28 18:32 bin/curl
share|improve this answer

First thing you wanna know is that Ubuntu is using a system called Upstart instead of the traditional init. The initial ramdisk is still used, but you'll be reconfiguring upstart instead of init.

Second, are you wanting to do this entirely within the context of an initrd? If so, this would be much more complicated.

share|improve this answer
I actually new about Upstart, but thanks for the heads up. I have also learned that initrd isn't used with the 2.6 kernels, it's initramfs nowdays. And yes, I do want to do this inside the initramfs. What I am actually trying to do is more complicated than using curl, but it's a step in the right direction. I am trying to make it possible to login using SSH and provide the cryptphrase from my encrypted LVM. – Deleted Jun 20 '10 at 22:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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