Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 526008

Summary: sys-apps/busybox-1.22.1-r1 - ?
Product: Gentoo Linux Reporter: Helmut Jarausch <jarausch>
Component: [OLD] Core systemAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED NEEDINFO    
Severity: normal CC: alex_y_xu, neil
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=537364
Whiteboard:
Package list:
Runtime testing required: ---

Description Helmut Jarausch 2014-10-20 10:57:54 UTC
With sys-apps/busybox-1.22.1-r1 installed, my kernel (3.17.1-gentoo-r1)
doesn't boot anymore because of a broken initramfs.
As alyways, I have updated by initramfs.txt which is used by my kernel to
generate the initramfs itself.

With this version of busybox, commands like cat, mount, ... don't work anymore.
Just stepping back to version 1.22.1 cures this.

It took my quite time to nail this down, so it's critical.

Helmut
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2014-10-20 11:10:46 UTC
1) Please post your `emerge --info' output in a comment.
2) Please explain how you generate that initramfs
3) Please explain (with error output) what goes wrong exactly.
Comment 2 Helmut Jarausch 2014-10-20 11:27:18 UTC
(In reply to Jeroen Roovers from comment #1)
> 1) Please post your `emerge --info' output in a comment.

please see below

Please keep in mind that I have been using this setup successfully for
severl kernel version including 3.17.1-gentoo-r1 with the previous
version of busybox (i.e. 1.22.1)

> 3) Please explain (with error output) what goes wrong exactly.
The kernel doesn't find / cannot execute commands like cat, mount, switch_root, ...
and thus fails during the inital boot when using the initramfs

Stepping back to busybox-1.22.1 cures this.

> 2) Please explain how you generate that initramfs

Here is my initramfs.txt (used by the kernel option CONFIG_INITRAMFS_SOURCE

dir     /bin            0755 0 0
dir     /dev            0755 0 0
dir     /etc            0755 0 0
dir     /lib64          0755 0 0
dir     /mnt            0755 0 0
dir     /mnt/root       0755 0 0
dir     /mnt/root/usr   0755 0 0
dir     /newroot        0755 0 0
dir     /proc           0755 0 0
dir     /sys            0755 0 0
dir     /usr            0755 0 0
dir     /usr/share      0755 0 0
dir     /lib64/systemd  0755 0 0

nod     /dev/console    0600 0 0 c 5 1
nod     /dev/loop0      0644 0 0 b 7 0
nod     /dev/null       0666 0 0 c 1 3
nod     /dev/tty        0666 0 0 c 5 0
nod     /dev/sdb1       0600 0 0 b 8 17
nod     /dev/sdb2       0600 0 0 b 8 18
nod     /dev/sdc2       0600 0 0 b 8 34
nod     /dev/sdd2       0600 0 0 b 8 50

file    /init   /usr/src/Gen_InitRamFS/init 0755 0 0

file    /etc/fstab      /etc/fstab      0644 0 0
file    /bin/busybox    /bin/busybox    0755 0 0  /bin/bb /bin/mdev
# slink   /bin/bb         /bin/busybox          0755 0 0
file    /bin/true       /bin/true       0755 0 0
file    /bin/btrfs      /sbin/btrfs     0755 0 0
file    /bin/btrfsck    /sbin/btrfsck   0755 0 0
file    /bin/fsck       /sbin/fsck      0755 0 0
file    /bin/fsck.ext4  /sbin/fsck.ext4 0755 0 0
slink   /bin/fsck.btrfs /bin/true       0755 0 0

file    /lib64/systemd/systemd-cgroups-agent   /usr/lib64/systemd/systemd-cgroups-agent    0755 0 0
file    /lib64/systemd/systemd-fsck            /usr/lib64/systemd/systemd-fsck             0755 0 0
file    /lib64/systemd/systemd-journald        /usr/lib64/systemd/systemd-journald         0755 0 0
file    /lib64/systemd/systemd-modules-load    /usr/lib64/systemd/systemd-modules-load     0755 0 0
file    /lib64/systemd/systemd-reply-password  /usr/lib64/systemd/systemd-reply-password   0755 0 0
file    /lib64/systemd/systemd-shutdown        /usr/lib64/systemd/systemd-shutdown         0755 0 0
file    /lib64/systemd/systemd-sysctl          /usr/lib64/systemd/systemd-sysctl           0755 0 0
file    /lib64/systemd/systemd-udevd           /usr/lib64/systemd/systemd-udevd            0755 0 0  /bin/udevd
file    /lib64/systemd/systemd-vconsole-setup  /usr/lib64/systemd/systemd-vconsole-setup   0755 0 0


file	/lib64/ld-linux-x86-64.so.2	/lib64/ld-linux-x86-64.so.2	0755 0 0
file	/lib64/libattr.so.1	/lib64/libattr.so.1	0755 0 0
file	/lib64/libblkid.so.1	/lib64/libblkid.so.1	0755 0 0
file	/lib64/libcap.so.2	/lib64/libcap.so.2	0755 0 0
file	/lib64/libcom_err.so.2	/lib64/libcom_err.so.2	0755 0 0
file	/lib64/libc.so.6	/lib64/libc.so.6	0755 0 0
file	/lib64/libdl.so.2	/lib64/libdl.so.2	0755 0 0
file	/lib64/libe2p.so.2	/lib64/libe2p.so.2	0755 0 0
file	/lib64/libext2fs.so.2	/lib64/libext2fs.so.2	0755 0 0
file	/lib64/libkmod.so.2	/lib64/libkmod.so.2	0755 0 0
file	/lib64/liblzo2.so.2	/lib64/liblzo2.so.2	0755 0 0
file	/lib64/libmount.so.1	/lib64/libmount.so.1	0755 0 0
file	/lib64/libpam.so.0	/lib64/libpam.so.0	0755 0 0
file	/lib64/libpthread.so.0	/lib64/libpthread.so.0	0755 0 0
file	/lib64/librt.so.1	/lib64/librt.so.1	0755 0 0
file	/lib64/libuuid.so.1	/lib64/libuuid.so.1	0755 0 0
file	/lib64/libz.so.1	/lib64/libz.so.1	0755 0 0
file	/lib64/libseccomp.so.2	/usr/lib64/libseccomp.so.2	0755 0 0


and here is my init file

#!/bin/busybox sh

rescue_shell() {
    echo "$@"
    echo "Something went wrong. Dropping you to a shell."
    busybox --install -s
    exec /bin/sh
}

uuidlabel_root() {
    for cmd in $(cat /proc/cmdline) ; do
        case $cmd in
        root=*)
            type=$(echo $cmd | cut -d= -f2)
            echo "Mounting rootfs"
            if [ $type == "LABEL" ] || [ $type == "UUID" ] ; then
                uuid=$(echo $cmd | cut -d= -f3)
                mount -o ro $(findfs "$type"="$uuid") /mnt/root
            else
                mount -o ro $(echo $cmd | cut -d= -f2) /mnt/root
            fi
            echo "INITRAMFS root mount:"
            mount
            ;;
        esac
    done
}

check_filesystem() {
    # most of code coming from /etc/init.d/fsck

    local fsck_opts= check_extra= RC_UNAME=$(uname -s)

    # FIXME : get_bootparam forcefsck
    if [ -e /forcefsck ]; then
        fsck_opts="$fsck_opts -f"
        check_extra="(check forced)"
    fi

    echo "Checking local filesystem $check_extra : $1"

    if [ "$RC_UNAME" = Linux ]; then
        fsck_opts="$fsck_opts -C0 -T"
    fi

    trap : INT QUIT

    # using our own fsck, not the builtin one from busybox
    /bin/fsck ${fsck_args--p} $fsck_opts $1

    case $? in
        0)      return 0;;
        1)      echo "Filesystem repaired"; return 0;;
        2|3)    if [ "$RC_UNAME" = Linux ]; then
                        echo "Filesystem repaired, but reboot needed"
                        reboot -f
                else
                        rescue_shell "Filesystem still have errors; manual fsck required"
                fi;;
        4)      if [ "$RC_UNAME" = Linux ]; then
                        rescue_shell "Fileystem errors left uncorrected, aborting"
                else
                        echo "Filesystem repaired, but reboot needed"
                        reboot
                fi;;
        8)      echo "Operational error"; return 0;;
        12)     echo "fsck interrupted";;
        *)      echo "Filesystem couldn't be fixed";;
    esac
    rescue_shell
}

# temporarily mount proc and sys
mount -t proc none /proc
mount -t sysfs none /sys

echo /bin/mdev > /proc/sys/kernel/hotplug
mdev -s

# only do this if you've built devtmpfs support into your kernel
# mount -t devtmpfs none /dev  HJ: done by the kernel itself

# disable kernel messages from popping onto the screen
echo 0 > /proc/sys/kernel/printk

# clear the screen
# clear


# ====================== start doing stuff

# mounting rootfs on /mnt/root
uuidlabel_root || rescue_shell "Error with uuidlabel_root"

btrfs device scan

# space separated list of mountpoints that ...
mountpoints="/usr"

# ... we want to find in /etc/fstab ...
# ln -s /mnt/root/etc/fstab /etc/fstab

# ... to check filesystems and mount our devices.
for m in $mountpoints ; do
    check_filesystem $m

    echo "Mounting $m"
    # mount the device and ...
    mount $m || rescue_shell "Error while mounting $m"

    # ... move the tree to its final location
    mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m"
done

echo "All done. Switching to real root."

# ====================== end doing stuff

mount -o remount,rw /mnt/root
cp /proc/mounts /mnt/root/mtab

# clean up. The init process will remount proc sys and dev later
umount /proc
umount /sys
# umount /dev   # fails, since it's automounted by the kernel

# switch to the real root and execute init
exec switch_root /mnt/root /sbin/init "$@"

===============================================================

emerge --info sys-apps/busybox
Portage 2.2.14_rc1 (python 3.3.5-final-0, default/linux/amd64/13.0/desktop, gcc-4.9.1, glibc-2.19-r1, 3.17.1-gentoo-r1 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.17.1-gentoo-r1-x86_64-AMD_Phenom-tm-_II_X4_955_Processor-with-gentoo-2.2
KiB Mem:     7906912 total,   4477876 free
KiB Swap:    1048572 total,   1048572 free
Timestamp of tree: Mon, 20 Oct 2014 06:15:01 +0000
ld GNU ld (GNU Binutils) 2.24
ccache version 3.1.9 [disabled]
app-shells/bash:          4.3_p30
dev-java/java-config:     2.2.0
dev-lang/perl:            5.20.1-r1
dev-lang/python:          2.7.8, 3.3.5-r1, 3.4.2
dev-util/ccache:          3.1.9-r3
dev-util/cmake:           3.0.2
dev-util/pkgconfig:       0.28-r2
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.13.1
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6, 1.12.6, 1.13.4, 1.14.1
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.8.3, 4.9.1, 4.10.0_pre9999::local
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2-r1
sys-devel/make:           4.1
sys-kernel/linux-headers: 3.17 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo local sunrise
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-mtune=native -march=native -O2 -msse3 -pipe -fno-diagnostics-color"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb /var/lib/neatx/home"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-mtune=native -march=native -O2 -msse3 -pipe -fno-diagnostics-color"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo "
LANG="en_US.iso88591"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/portage/layman/sunrise"
SYNC="rsync://rsync.informatik.RWTH-Aachen.de/gentoo-portage"
USE="3dnow 3dnowext 3dnowprefetch X a52 aac acl acpi alsa amd64 avahi berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emacs emboss encode exif fam ffmpeg fftw firefox flac fortran fuse gdbm gfortran gif gimp glamor gnome gpm gtk gtk2 iconv ipv6 jpeg kde lapack lcms libnotify mad mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses nls nptl nptlonly ogg opengl openmp openrc pam pango pcre pdf png policykit ppds qt qt3support qt4 readline sdl session smp spell sqlite sqlite3 sse sse2 sse3 sse4a ssl startup-notification svg systemd tcl tcpd threads tiff tk truetype udev udisks unicode upower usb vorbis wxwidgets x264 xcb xml xulrunner xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="btrfs systemd" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3 python3_4" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="radeonhd radeon fglrx" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7 3.3 3.4"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

sys-apps/busybox-1.22.1 was built with the following:
USE="ipv6 pam static systemd -livecd -make-symlinks -math -mdev -savedconfig (-selinux) -sep-usr -syslog" ABI_X86="64"
CFLAGS="-mtune=native -march=native -O2 -msse3 -pipe -fno-diagnostics-color -fno-strict-aliasing"
CXXFLAGS="-mtune=native -march=native -O2 -msse3 -pipe -fno-diagnostics-color -fno-strict-aliasing"
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2014-10-20 13:16:34 UTC
(In reply to Helmut Jarausch from comment #2)
> > 3) Please explain (with error output) what goes wrong exactly.
> The kernel doesn't find / cannot execute commands like cat, mount,
> switch_root, ...

Doesn't find /? How is busybox to blame for that?

> and thus fails during the inital boot when using the initramfs

And what error output would that be?
Comment 4 Alex Xu (Hello71) 2014-10-23 01:28:28 UTC
(In reply to Jeroen Roovers from comment #3)
> (In reply to Helmut Jarausch from comment #2)
> > > 3) Please explain (with error output) what goes wrong exactly.
> > The kernel doesn't find / cannot execute commands like cat, mount,
> > switch_root, ...
> 
> Doesn't find /? How is busybox to blame for that?

it's bad english. should read "doesn't find/cannot execute"

> > and thus fails during the inital boot when using the initramfs
> 
> And what error output would that be?

cannot fix without error messages.

psychic debugging: http://www.busybox.net/FAQ.html#standalone_shell
Comment 5 Neil Bothwick 2014-10-24 12:43:10 UTC
I'm seeing the same behaviour. Busybox is not longer running applets by name alone, so a line in init like

mount -t proc none /proc

now fails with a command not found error. It appears that busybox is checking $PATH but not its own applets. I don't think it is the standalone shell feature because I have never used that. As I understand it, that feature only prevents busybox from checking /bin etc. before dropping back to its own applets. With /bin containing nothing but busybox, it always dropped went straight to its own applets anyway, not it doesn't unless they are called as

busybox mount -t proc none /proc
Comment 6 Andreas Klauer 2015-01-22 13:23:39 UTC
This happens because sys-apps/busybox-1.22.1-r1 ebuild for some (unknown?) reason changed `allyesconfig` to `defconfig`, which removes some applets and the "use busybox applet without symlink" feature.

It is also the root cause of this bug report: https://bugs.gentoo.org/show_bug.cgi?id=536988