Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I created my own initramfs script (based on live-initramfs) and I need set up network connection (using DHCP) to get remote file. So what do I need to add to initramfs hook file (ifconfig, dhclient?). And how to write my initramfs script? Now I am trying something like this:

mkdir -p /var/run/network  # needed by ifup
modprobe af_packet         # for DHCP?
udevadm trigger            
udevadm settle  
ifup eth0                  #???            

for ifup I need /etc/network/interfaces file to have:

auto eth0
iface eth0 inet dhcp

But generally I don't know what exactly need to be done for network device to work properly in initramfs.

Any idea or help?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The simplest solution is to use ipconfig with the ip= option (following the kernel name) in grub.cfg (or pxelinux.cfg or however you boot your kernel). I'm not aware of a man page for it, but you can probably find a README file in /usr/share/doc/klibc-utils. So your grub.cfg might have a line such as the following:

linux   /boot/vmlinuz-3.1.0-1-amd64 root=UUID=someuuid ro quiet ip=:::::eth0:dhcp

Then you can make a simple script in local-top that sources the functions file and then calls the *configure_networking* function such as:

. /scripts/functions

Edit: Had mistakenly thought *configure_networking* was called by default, but it has to be called - either through your own script or one from a package (in my case, from open-iscsi).

share|improve this answer

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.