1

I've been working on a ramdisk template for running a complete root filesystem on the RAM of a baremetal server(over IPMI so no physical access) that boots over PXE. I used debootstrap to create an ubuntu trusty filesystem and applied some modifications. The server boots successfully and mounts the root filesystem on /dev/ram0, however, network never comes up and the login prompt doesn't respond for keyboard input.

Here are the steps that I followed:

1) Create a rootfs file

dd if=/dev/zero of=rootfs bs=1k count=$((768 * 1024))

2) Create an ext3 file system

mkfs.ext3 -m0 -F -L root rootfs

3) Create a mount point

 mkdir /root/rootfs/

4) Mount

mount -t ext3 -o loop rootfs /root/rootfs

5) Debootstrapping Ubuntu trusty

debootstrap --arch=amd64  trusty /root/rootfs

6) chroot /root/rootfs

chroot /root/rootfs

7) vi /etc/fstab

/dev/ram0   /           ext2        defaults        0       0
proc        /proc       proc        defaults        0       0 
none        /tmp        tmpfs       defaults        0       0 
none        /var/run    tmpfs       defaults        0       0 
none        /var/lock   tmpfs       defaults        0       0 
none        /var/tmp    tmpfs       defaults        0       0   

8) /etc/network/interfaces

auto lo 
iface lo inet loopback 

auto eth0 
iface eth0 inet dhcp 

9) Some other modifications

......

10) Umounting and compressing the image

gzip -c rootfs | dd of=/path/to/webserver/rootfs.gz

11) Copying the kernel to webserver

cp /boot/vmlinuz-$(uname -r) /path/to/webserver/

Thanks in advance

Mehdi Yedes
  • 141
  • 6

1 Answers1

0

try adding

5.1)

# cp /etc/hostname /root/rootfs/etc/
# cp /etc/hosts /root/rootfs/etc/

6)

# mount --bind /dev  /root/rootfs/dev
# mount --bind /proc /root/rootfs/proc
# mount --bind /sys  /root/rootfs/sys
# chroot /root/rootfs/ /bin/bash --login

source

Pat
  • 3,519
  • 2
  • 17
  • 17
  • Thank you for the answer. I couldn't get it to work so I just turned to creating a custom CentOS LiveCD using the `livecd-creator` tool. – Mehdi Yedes Dec 28 '15 at 10:05