When run manually, GRUB2 leaves me in BusyBox

Kernels & Hardware, configuring network, installing services

When run manually, GRUB2 leaves me in BusyBox

Postby Ellen1910 » 2017-10-29 08:57

Linux ellen 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u5 (2017-09-19) x86_64 GNU/Linux

Here's where GRUB2 leaves me when run manually (set root=(hd0,msdos6); linux; initrd; boot) which is my primary linux installation:

Code: Select all
mount: can't find /root in /etc/fstab
Target filesystem doesn't have requested /sbin/init
Begin: Running /scripts/local-bottom .  .  .  done
Begin: Running /scripts/init-bottom .  .  . mount: mounting /dev on /root/dev failed
: No such file or directory
done
No init found. Try passing init=bootarg.

BusyBox
/bin/sh: can't access tty; job control turned off


[Note. there are, then, a few modprobes for usb related modules which I'm not including; no usb device is plugged in]

Here's the only script in /init-bottom GRUB presumably runs and complains about:

Code: Select all
#!/bin/sh -e

PREREQS=""

prereqs() { echo "$PREREQS"; }

case "$1" in
    prereqs)
    prereqs
    exit 0
    ;;
esac

# Stop udevd, we'll miss a few events while we run init, but we catch up
udevadm control --exit

# move the /dev tmpfs to the rootfs
mount -n -o move /dev ${rootmnt}/dev

# create a temporary symlink to the final /dev for other initramfs scripts
nuke /dev
ln -s ${rootmnt}/dev /dev


This isn't a real problem for me. Normal booting is fine (I use grub, not lilo). More a curiosity though I'd like to understand what the problem is and correct it.

Can anyone tell me what GRUB's hangup is?

Puzzles: Why does GRUB think /etc/fstab should contain "/root" -- it contains "/". If it's looking for udev files, it should be looking in /etc/init, not in /sbin/init.
Ellen1910
 
Posts: 52
Joined: 2006-09-30 13:49

Re: When run manually, GRUB2 leaves me in BusyBox

Postby Head_on_a_Stick » 2017-10-29 12:37

The error messages seem to suggest that you have not told the kernel where the root filesystem is.

I don't use the GRUB command line so I may be missing something but for a menu entry I would add a root=/dev/whatever parameter after the linux location.

EDIT: my current grub.cfg:

https://raw.githubusercontent.com/Head- ... r/grub.cfg
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 6669
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: When run manually, GRUB2 leaves me in BusyBox

Postby debiman » 2017-10-29 12:57

how do you run grub manually?
to my knowledge, it always runs automatically during early boot.
User avatar
debiman
 
Posts: 1528
Joined: 2013-03-12 07:18

Re: When run manually, GRUB2 leaves me in BusyBox

Postby Head_on_a_Stick » 2017-10-29 13:01

debiman wrote:how do you run grub manually?

GRUB menu screen wrote:Press c for a command line

;)
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 6669
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: When run manually, GRUB2 leaves me in BusyBox

Postby Ellen1910 » 2017-10-29 15:51

Here's an idea. GRUB reports it ran "scripts/local-bottom" without complaint. "Begin: Running /scripts/local-bottom . . . done" Here are the possibilities for where GRUB is looking.

Code: Select all
ellen@ellen:~$ locate local-bottom
/etc/initramfs-tools/scripts/local-bottom
/usr/share/initramfs-tools/scripts/local-bottom
/usr/share/initramfs-tools/scripts/local-bottom/ntfs_3g


If GRUB runs the only available script, this is it.

Code: Select all
#!/bin/sh

set -e

case "${1}" in
   prereqs)
      exit 0
      ;;
esac

if [ "${ROOTFSTYPE}" = ntfs ] || [ "${ROOTFSTYPE}" = ntfs-3g ] || \
   [ "${LOOPFSTYPE}" = ntfs ] || [ "${LOOPFSTYPE}" = ntfs-3g ]
then
   mkdir -p /run/sendsigs.omit.d
   pidof mount.ntfs >> /run/sendsigs.omit.d/ntfs-3g
   pidof mount.ntfs-3g >> /run/sendsigs.omit.d/ntfs-3g
fi

exit 0


I don't know what that all means, but the file system on the partition I'm booting (hd0,msdos6) is ext4. The file system on (hd0, msdos1) is ntfs. GRUB should never, if it does, get anywhere near that script. Yes?

BTW here are my keyboard entries:

grub>set root=(hd0,msdos6)
grub>linux /boot/vmlinuz-3.16.0-4-amd64
grub>initrd /boot/initrd.img-3.16.0-4-amd64
grub>boot
Ellen1910
 
Posts: 52
Joined: 2006-09-30 13:49

Re: When run manually, GRUB2 leaves me in BusyBox

Postby p.H » 2017-10-29 16:20

GRUB just loads the kernel and initramfs, and hands over the boot process to them. Job done.
GRUB does not leaves you in busybox.
GRUB does not run scripts.
GRUB does not complain about anything.
GRUB does not care about /etc/fstab.
The initramfs init script does, because you did not specify a root= parameter in the linux command line.
Look at /boot/grub/grub.cfg for what is expected.
p.H
 
Posts: 158
Joined: 2017-09-17 07:12

Re: When run manually, GRUB2 leaves me in BusyBox

Postby Ellen1910 » 2017-10-29 21:52

Okay. Adding "root=/dev/hdd6" to the linux line gets me to the login screen. Success.

And I guess it makes sense that the operating system doesn't understand GRUB's idiomatic terminology and needs to be instructed in its own language.

Are you saying the OS started its part of the boot process with no idea where it was going? Did it guess that it was on the first partition? That can't be. It was running linux scripts and must have gotten them from (hd0,6) so it knew something.

Very confusing.
Ellen1910
 
Posts: 52
Joined: 2006-09-30 13:49

Re: When run manually, GRUB2 leaves me in BusyBox

Postby p.H » 2017-10-30 07:48

Those messages are from the initramfs, which was loaded by GRUB's initrd command.
The initramfs contains an initial root filesystem loaded in memory. Its purpose is to mount the final root filesytem and hand over the boot process to its /sbin/init process.
Debian's initramfs uses the kernel command line root= parameter to identify the root filesystem. Other distributions may differ.
p.H
 
Posts: 158
Joined: 2017-09-17 07:12


Return to System configuration

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable