[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: GRUB -- Debian overrides? Or maybe I just don't understand it well...



On Thu 21 Dec 2023 at 21:38:46 (+0000), Mark Fletcher wrote:
> On Wed, 20 Dec 2023 at 06:01, David Wright <deblis@lionunicorn.co.uk> wrote:
> >
> > I can't see anywhere where the OP claims to have set up LFS for
> > booting itself, as opposed to being booted from a Debian Grub.
> > It only says "I have been able to get a grub.cfg including the
> > LFS system …", which seems to imply LFS has only been set up
> > as a "foreign" system by a Debian system.
> 
> Yes, that's exactly it. My very first attempt involved using Debian's
> /boot partition as the /boot partition for LFS as well, so installing
> LFS's kernel (6.4.12 IIRC) alongside Debian's, but I quickly learned
> the folly of that when I saw the mess update-grub made of that...

What sort of mess? I would have thought Grub would ignore excess
kernels dropped into /boot. I have a laptop here that has two
bookworm netinst ISOs (release candidates) and a kernel and initrd
(hd-media) for booting the ISOs, and they've been ignored through
at least two kernel upgrades:

     4096 Oct  9 22:49 /grub
       83 Aug 16 15:52  System.map-5.10.0-25-686
       83 Sep 28 23:25  System.map-5.10.0-26-686
   245147 Aug 16 15:52  config-5.10.0-25-686
   245200 Sep 28 23:25  config-5.10.0-26-686
  703594k Apr 24  2023  debian-bookworm-DI-rc1-i386-netinst.iso
  704643k Apr 28  2023  debian-bookworm-DI-rc2-i386-netinst.iso
   19920k Apr 27  2023  initrd.gz
   33580k Oct  7 12:36  initrd.img-5.10.0-25-686
   33588k Nov 27 18:46  initrd.img-5.10.0-26-686
  5548224 Apr  8  2023  vmlinuz
  4988160 Aug 16 15:52  vmlinuz-5.10.0-25-686
  4990880 Sep 28 23:25  vmlinuz-5.10.0-26-686

I've already posted my (slightly overlong) /etc/grub.d/07_custom;
I can boot the installer with:

  ### BEGIN /etc/grub.d/40_custom ###
  # This file provides an easy way to add custom menu entries.  Simply type the
  # menu entries you want to add after this comment.  Be careful not to change
  # the 'exec tail' line above.
  menuentry "Install Debian via HTTP" {
      search --no-floppy --label --set=root noah03
      linux   /boot/vmlinuz priority=low
      initrd  /boot/initrd.gz
  }
  #
  ### END /etc/grub.d/40_custom ###

> So I rebuilt my LFS (was happy to do so, this is a learning exercise)
> with its own /boot partition, which gets me closer to the solution I
> want which is one Grub, Debian's grub, with Debian as the first and
> default boot choice, but LFS available as an alternative. And the only
> remaining problem is the Debian GRUB's insistence on using /dev/sdX2
> (for the root partition is the second partition on the disk) in the
> "linux" command line parameter.

I've never run LFS; what does the menuentry in grub.cfg look like?

> > When os-prober runs on my system, a lot of stuff gets logged in
> > messages, syslog and user.log. The lines that contain the string
> > "result:" (without the quotes) are interesting. It's evident from
> > those that have six fields following result: have had their root=
> > field copied from the foreign system's grub.cfg. (In my case,
> > "foreign" means a Debian system of the previous release.)
> >
> > When os-prober writes several clauses into my new grub.cfg's
> > "### BEGIN /etc/grub.d/30_os-prober ###" section, the references
> > to the partition are constructed using UUIDs (not PARTUUIDs, because
> > there's an initrd). However, the kernel command line reads
> > "root=LABEL=toto04", so that string wasn't constructed by os-prober,
> > but copied from the foreign grub.cfg.
> >
> > That suggests to me the probability that whereas +Grub constructs+
> > the root= strings for the "### BEGIN /etc/grub.d/10_linux ###"
> > section, +os-prober copies+ the root= strings into the
> > "### BEGIN /etc/grub.d/30_os-prober ###" section instead.

So what does this command show, if anything:

  $ zgrep result: /var/log/messages*
  /var/log/messages:Dec 21 18:10:52 acer 90linux-distro: result: /dev/sda4:Debian GNU/Linux 12 (bookworm):Debian:linux
  /var/log/messages:Dec 21 18:10:57 acer 40grub2: result: /dev/sda4:/dev/sda4:Debian GNU/Linux:/boot/vmlinuz-6.1.0-13-686:/boot/initrd.img-6.1.0-13-686:root=UUID=ac1b3d4f-aa95-4e12-b6e6-fd455273a3b8 ro quiet
  /var/log/messages:Dec 21 18:10:57 acer 40grub2: result: /dev/sda4:/dev/sda4:Debian GNU/Linux, with Linux 6.1.0-13-686:/boot/vmlinuz-6.1.0-13-686:/boot/initrd.img-6.1.0-13-686:root=UUID=ac1b3d4f-aa95-4e12-b6e6-fd455273a3b8 ro quiet
  /var/log/messages:Dec 21 18:10:57 acer 40grub2: result: /dev/sda4:/dev/sda4:Debian GNU/Linux, with Linux 6.1.0-13-686 (recovery mode):/boot/vmlinuz-6.1.0-13-686:/boot/initrd.img-6.1.0-13-686:root=UUID=ac1b3d4f-aa95-4e12-b6e6-fd455273a3b8 ro single
  /var/log/messages:Dec 21 18:10:57 acer 40grub2: result: /dev/sda4:/dev/sda4:Debian GNU/Linux, with Linux 6.1.0-10-686:/boot/vmlinuz-6.1.0-10-686:/boot/initrd.img-6.1.0-10-686:root=UUID=ac1b3d4f-aa95-4e12-b6e6-fd455273a3b8 ro quiet
  /var/log/messages:Dec 21 18:10:58 acer 40grub2: result: /dev/sda4:/dev/sda4:Debian GNU/Linux, with Linux 6.1.0-10-686 (recovery mode):/boot/vmlinuz-6.1.0-10-686:/boot/initrd.img-6.1.0-10-686:root=UUID=ac1b3d4f-aa95-4e12-b6e6-fd455273a3b8 ro single

(you can use messages*, syslog* or user.log*)

> Interesting -- but there is no grub.cfg on the LFS system because grub
> has never been installed there. There is a /boot partition but no
> /boot/grub/grub.cfg <suddenly doubts self, and goes to check --
> indeed, there isn't>.
> So, nothing to copy from in this case.

That's why I was interested in the zgrep output: I've never had
a system with "foreign" systems that lack grub.cfg (except for
Windows, which is handled differently). I've always set up Grub
on any system I've installed.

Cheers,
David.


Reply to: