The importance to be a "busybox"

The importance to be a "busybox"

Busybox is a swiss army knife utility that is very useful for system recovery. Recently I had a server with a SCSI backplane issue that caused SCSI drives to "fail" and remove themselves from the kernel. The drives were tested in other server and work fine, and this was happening with multiple different drives.

Before we determined it was the server backplane though, we were doing a migration of data:

sda: OS
(sdb, sdc) md1: data, virtual servers, databases

The goal was to move the OS off of sda to md1, set the MBR on both drives in the software raid array to be bootable, reboot, remove sda and let the server run with just the 2 drives in the sw raid array (md1).

Due to a grub configuration problem, the serial console was not working at bootup, only after boot started (i.e. grub was not sending control to the serial console).

These settings were commented out by mistake in grub.conf:
serial --unit=0 --speed=9600
terminal --timeout=10 serial console

This server was remote and there was not a quick and easy way to put a monitor on it or get hands on support at the minute. The server once booted was not able to find the root filesystem due to another mistake in the grub config so the system booted to a ramfs with busybox as the only tool available.

We were able to mount the actual/correct root filesystem from within the ramfs and correct the grub.conf and /etc/fstab files so that the system would correctly boot. We mounted the first member of the sw raid array directly (not as a raid volume) and after fixing the files and booting back up we re-synced the raid array using mdadm.

 

 

 

 

 

 

 

 

 

 

 

Busybox contains a minimal working vi editor in its binary, which enabled the editing of the files.

Busybox can also be very useful if you are upgrading a live operating system and get stuck with library problems. Make sure you install the statically linked version. This is normally never a problem with debian-based servers, but a wayward mv command or a nasty, poorly programmed shell script that deletes /sbin or /usr by accident (I have seen poor developers create both) can of course create situations where a statically linked busybox binary is invaluable.

debian:
apt-get install busybox-static