6

I've got a PC with certainly a hardware problem, the installed Ubuntu doesn't boot, neither does Live CDs. (Although Ubuntu is correctly installed).

(the 'normal' boot freezes after some filesystem checks / networking startup)

However, GRUB2 seems to be ok, but I can't find any way to start a simple root shell, bash for instance. What can I tell GRUB 1.97-b4 to start such a shell ?

(I guess some

linux /boot/...
initrd /boot/...

)

thanks for your help and point of views

3
  • depending on your distro adding 1 or init 1 to the end of the kernel boot line should drop you to a single user mode root shell Commented Nov 27, 2010 at 11:33
  • @aking1012 init 1 might/seems to be too much, I see some apparmor, fsck, ... that could not be loaded (although I don't know yet for sure that the init 1 is taken into consideration)
    – Kevin
    Commented Nov 27, 2010 at 12:07
  • @aking1012 I don't know how relevant it is regarding your comment, but my ubuntu uses UpStart
    – Kevin
    Commented Nov 27, 2010 at 12:56

2 Answers 2

12

Try editing your regular boot entry in grub (e shortcut and appending init=/bin/sh to end of the line beginning with linux .... After you will boot it (Ctrl-x), you will get a root shell immediately.

3
  • 2
    @Kevin: Once you have that shell, try /bin/bash to have a nicer interactive shell. You may need to run mount -t proc proc /proc and mount -t sysfs sysfs /sys for various system utilities to work. Commented Nov 27, 2010 at 13:50
  • 1
    On my machine (Ubuntu 18.04 Grub 2.02-2ubuntu8.13), it did not work appending appending init to the recovery mode option, but it did work on the normal (non-recovery) option. Commented Dec 6, 2019 at 1:39
  • When I try this I cannot interact with the shell. It seemingly takes no input. Maybe I am missing some configuration with qemu? Commented Sep 23, 2023 at 21:24
1

I didn't understand why Ubuntu does't boot. So, if u wanna get a shell, which also means that u MUST have a kernel loaded, u need to find the kernel.

For the right installation of ubuntu, but unable to boot, use

linux /boot/vmlinuz... the kernel installed by Ubuntu installer.
initrd /boot/initrd.img...

If something wrong with the installation, u can boot from ISO file. using:

loopback loop /path/to/ISOfile
linux (loop)/casper/vmlinuz boot=casper [iso-scan/filename=/path/to/ISOfile]
initrd (loop)/casper/initrd

Thats all i know.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .