Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

How to determine which was the boot device ?

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
4 posts • Page 1 of 1
Author
Message
pietinger
Administrator
Administrator
Posts: 6640
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

How to determine which was the boot device ?

  • Quote

Post by pietinger » Sun Oct 25, 2020 11:33 pm

Is there a way to find out if the kernel was bootet from my ssd or from an usb stick (if both kernels are identical) ?

Background: I have a signed monolithic stub kernel which will be loaded via secure boot. Because I wanted to test something dangerous with my running kernel, I did a copy of my kernel to a stick before. I did all regular (fat32, mark as esp, ...) except one typo: The name of the kernel was "bootx46.efi" on the stick and not as needed "bootx64.efi" ... so, my UEFI didnt find anything to boot on this stick ... and booted my regular kernel from ssd (as next in boot list). My rescue stick was completly useless ...

Lucky me, nothing happened AND I did a little change to the built-in boot parameter before (and compiled) and after some hours I recognised there was the "old" command line in dmesg (from the ssd kernel), telling me I bootet from ssd and not from the stick (yes, UEFI was so fast I did not noticed it).

I did a diff between both message-logs and find nothing to determine from where I bootet. Maybe somewhere in /sys or /proc ?

Thanks in advance,
Peter
Top
Hu
Administrator
Administrator
Posts: 24403
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Mon Oct 26, 2020 12:23 am

In the general case, your kernel does not know from where it was booted. It finds itself running, in memory, with a command line that directs it how to proceed. It may have been put there by firmware, by another Linux kernel (kexec), by a bootloader, etc. Some bootloaders will pass extra data to the kernel, via the command line, which might let you determine where the kernel image was found.
Top
figueroa
Advocate
Advocate
User avatar
Posts: 3032
Joined: Sun Aug 14, 2005 8:15 pm
Location: Edge of marsh USA
Contact:
Contact figueroa
Website

  • Quote

Post by figueroa » Mon Oct 26, 2020 2:34 am

Code: Select all

$ dmesg | head -3
[    0.000000] microcode: microcode updated early to revision 0x2f, date = 2019-02-17
[    0.000000] Linux version 4.9.240-gentoo (root@bethel) (gcc version 9.3.0 (Gentoo 9.3.0-r1 p3) ) #1 SMP Mon Oct 19 13:01:46 EDT 2020
[    0.000000] Command line: BOOT_IMAGE=/boot/kernel-4.9.240-gentoo root=/dev/sda1 ro
Maybe not definitive, but it's a pretty good hint.
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi -wayland
Top
pietinger
Administrator
Administrator
Posts: 6640
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Mon Oct 26, 2020 12:55 pm

figueroa wrote:

Code: Select all

$ dmesg | head -3
[    0.000000] microcode: microcode updated early to revision 0x2f, date = 2019-02-17
[    0.000000] Linux version 4.9.240-gentoo (root@bethel) (gcc version 9.3.0 (Gentoo 9.3.0-r1 p3) ) #1 SMP Mon Oct 19 13:01:46 EDT 2020
[    0.000000] Command line: BOOT_IMAGE=/boot/kernel-4.9.240-gentoo root=/dev/sda1 ro
Maybe not definitive, but it's a pretty good hint.
Yes, thank you, but this is empty when you boot a stub kernel without a boot manager.

I have later in the message log a second entry, like this:

Code: Select all

Oct 26 13:42:07 localhost kernel: [    0.026571] Kernel command line: root=PARTUUID=99beb5b2-b529-40fb-b0bc-3250a5237491 ro loglevel=8 lsm.debug
Yes with different parms I was able to recognize that it was bootet from ssd (bevause I hadnt "lsm.debug")

Thanks to you and Hu for your help.
Top
Post Reply

4 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic