Today our custom Linux wasn’t being loaded from PXE as usual, instead, we were stuck at «initramfs».
- Loading Linux Lubuntu 16_04 via PXE
- Hardware: ThinClient HP-T630
- No local disks where used in the process, the whole O.S is loaded in RAM.
- Turning on the machine will Load Kernel > Call Initramfs > get stuck in initramfs prompt.
BusyBox vxxxxx (Ubuntu xxxxubuntux) built-in shell (ash) Enter 'help' for a list of built-in commands. (initramfs)
There I was able to take a look on dmesg where I couldn’t find anything useful. Later I’ve checked the ethernet configuration (some network cards may interfere with the boot loading process) so I took a look on /run/<ETH>.conf. In my case it was «net-enp1s0.conf»:
(initramfs) cat /run/net-enp1s0.conf DEVICE='enp1s0' PROTO='none' IPV4ADDR='xx.xx.xx.xx' IPV4BROADCAST='xx.xx.xx.xx' IPV4NETMASK='255.255.252.0' IPV4GATEWAY='xx.xx.xx.xx' IPV4DNS0='0.0.0.0' IPV4DNS1='0.0.0.0' HOSTNAME='' DNSDOMAIN='' NISDOMAIN='' ROOTSERVER='xx.xx.xx.xx' ROOTPATH='' filename='' UPTIME='5' DHCPLEASETIME='0' DOMAINSEARCH=''
Also after executing ip addr I saw the same information, I did a ping from another machine and it worked, so the network card wasn’t my problem.
Checking the mounted file systems everything seemed right, I’ve executed mount to check them:
(initramfs) mount rootfs on / type rootfs (rw) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) udev on /dev type devtmpfs (rw,nosuid,relatime,size=1726452k,nr_inodes=431613,mode=755) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=355460k,mode=755) /dev/sdb2 on /tmp/test type ext4 (rw,relatime,data=ordered)
/dev/sdb2 was a pendrive I’ve prevously connected and mounted in /tmp/test to export the files and read them in other computer with vim, forget about vi, less or tail which are not included in the initramfs binaries. The pendrive must be connected before starting the computer.
Running out of ideas I’ve tried executing sh init just to see that it didn’t provide any output and just hanged there, but that was a clue.
Writing exit after being dropped in (initramfs) triggered a kernel panic:
(initramfs) exit Kernel panic - not sycing: Attempted to kill init! exitcode= .... Pid: 1, comm: init Not tainted 3.8.0-44-generic #66~precise1-Ubuntu Call trace: ....
Usually when mount problems are present, executing «exit» will show us the errors to resolve in order to continue. In this case the kernel panic wasn’t something good.
So I’ve started disabling the new features of the HP-T630 in the BIOS such as: fast boot, ACPI modes, and those ones that could have any conflict with the kernel). No luck.
Next step was passing parameters to the kernel:
label linux kernel kernel_16.04 append initrd=initrd_16.04 root=/dev/nfs netboot=nfs nfsroot=xx.xx.xx.xx:/exports/rootfs ip=dhcp keeppxe rw nfshost=xx.xx.xx.xx nomodeset ipv6.disable=1 net.ifnames=0 ipappend 1 default linux
- nomodeset: The newest kernels have moved the video mode setting into the kernel. So all the programming of the hardware specific clock rates and registers on the video card happen in the kernel rather than in the X driver when the X server starts.. This makes it possible to have high resolution nice looking splash (boot) screens and flicker free transitions from boot splash to login screen. Unfortunately, on some cards this doesnt work properly and you end up with a black screen. Adding the nomodeset parameter instructs the kernel to not load video drivers and use BIOS modes instead until X is loaded. (this one solved my problem of being stuck at initramfs).
- ipv6.disable=1 I do not require IPV6
- net.ifnames=0 This one was required because an startup script had «eth0» hardcoded and the network card was being recognized as enp1s0.
Finally after fixing a custom splashscreen using (fbi – Linux framebuffer image viewer) which was throwing this error:
A start job is running for LSB: Sho...om splashscreen (13s / no limit)
because I didn’t enable the kernel parameter vga=791 I was able to boot Linux correctly.