Access to shell during or after kernel panic?

Ian Smith smithi at nimnet.asn.au
Sun Nov 13 11:44:31 UTC 2016


In freebsd-questions Digest, Vol 649, Issue 7, Message: 4
On Fri, 11 Nov 2016 09:10:11 -0700 Mick mtn <mtnmickmt at gmail.com> wrote:
 > On Fri, Nov 11, 2016 at 1:18 AM, Polytropon <freebsd at edvax.de> wrote:
 > > On Fri, 11 Nov 2016 00:18:39 -0700, Mick mtn wrote:
 > > > FreeBSD 11R on macbook pro.
 > > > does not see dvd, yet the system was installed via
 > > > FreeBSD-11.0-RELEASE-amd64-dvd1.iso
 > > > ----------------------------------------------------------------
 > > > partial panic printout:
 > > > module visa failed to register: 17

That's 'vesa', right?  VESA is already in the GENERIC kernel, so adding 
vesa_load="YES" to /boot/loader.conf is, at best, superfluous.  That
shouldn't cause a panic though, so something/s else may be happening.

I have read the rest of this and the previous similar thread, and done a 
little research as Macbooks interest me, somewhat perversely .. my 
daughter uses one and I hope to get some of my Old Stuff onto hers.

Polytropon has been valiantly offering his wealth of experience, and has 
well pointed you to good reading on booting in the handbook, but getting 
FreeBSD going on a Macbook seems decidedly nontrivial.  I know less than 
Poly does, but sometimes a different tack leads to something useful ..

 > > > kbd0 at kbdmux0
 > > > Panic Module_register_init
 > > > CPUID=0
 > > > ...
 > > > ...
 > > > ...
 > > > #1 0 . . . kdb backtrace           at 0x67
 > > > #2 ...      vpanic                       at 0x182
 > > > #3          panic                         at 0x43
 > > > #4          module_register_init at 0x11c
 > > > #5          mi_startup                 at 0x118
 > > > #6          btext                          at 0x2c
 > > >
 > > > uptime 1s
 > > > -----------------------------------------------------------------

This is very early in booting the kernel, /usr/src/sys/kern/init_main.c 
with mi_startup() loading modules prior to starting init(8), near as I 
can tell on a quick browse.  Initially I thought this panic was still in 
loader(8), particularly as ctrl-alt-esc gets you back there, but I think 
loader has probably handed over to boot here, relying on it to succeed.

 > > > I can see the files in the rescue directory, but can not move to that
 > > > directory or issue commands like rescue/vi -v boot/loader.conf
 > >
 > > After a kernel panic, you usually cannot access the shell anymore,
 > > not locally, not remotely. But you can press Ctrl+Alt+Esc to enter
 > > the kernel debugger (which probably won't be much help at this
 > > point).
 > >
 > > I will try Ctrl+Alt+Esc
 > renders OK prompt, back to square one.

Well at least you can get back to loader(8).  There's a bit to read in 
there but I think doing so may help, especially as you said this system 
was actually working to some extent.

 > > > ANY HINTS on possible keyboard combinations to force boot from dvd?
 > > > Holding "C" on boot is not getting the result i expected.
 > >
 > > Is pressing C at boot a Mac-specific action?
 > >
 > YES, pressing C prior/during initial boot should direct the process to boot
 > from alternate media, typically looking at optical drive media. But can be
 > used to find USB devices as well if the mac boot partition has not been
 > destroyed.
 > 
 > In this case that partition has been destroyed.
 > The entire disk was repartitioned to boot FreeBSD only.

Yes, well this is a big problem, as Macbooks have not anything we would 
term a BIOS and are UEFI-only, I'm informed by One Who Knows (bcc'd).  
There must be some firmware, but I gather it's mostly the EFI partition.

Searching just for 'macbook' from https://www.freebsd.org/ produces 
quite a lot, the top one being https://wiki.freebsd.org/AppleMacbook 
which, while appearing somewhat out of date, indicates that a simple 
installation will destroy the Mac EFI partition, which is in essence 
equivalent to mis-flashing BIOS on a PC I guess; hopefully not a brick!

Seems that you may need to reinstall OS/X and then use Bootcamp? to make 
room to multi-boot FreeBSD, or at least ensure the Mac EFI partition is 
left ok.  Somewhat of a black art, requiring some non-standard (manual) 
partitioning and other tweaks.  I didn't dive too deep; you'll need to!

 > > When you can access the FreeBSD loader prompt, entering the
 > > command "boot -C" will usually try to boot from optical media.

Have you tried that from the loader OK prompt?  You can also 'set 
boot_cdrom' then boot [-s as suggested, remounting / rw then fixing 
/boot/loader.conf] .. if that's really the only problem. 

I'm not sure, but you may be able to use the loader commands unload, 
load kernel, and then be able to unset the problematic 'vesa_load' (or 
worse, visa_load :), since to quote para 3 of loader(8), on 9.3R here:

"After that, /boot/loader.rc is processed if available, and, failing 
that, /boot/boot.conf is read for historical reasons.  These files are 
processed through the include com- mand, which reads all of them into 
memory before processing them, making disk changes possible."
       ^^^^^^^^^^^^^^^^^^^^^^

 > > This is the same prompt where you can unload unwanted kernel
 > > modules, set a different kernel, or enter "boot -s" to continue
 > > into single user mode (where mounting / r/w and editing files
 > > using /rescue/vi would be possible).

Indeed, once you can get that far ..

Good Luck and Happy Researching,

cheers, Ian


More information about the freebsd-questions mailing list