Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #266854

Re: install Kernel and GRUB in chroot.

From Tim Woodall <debianuser@woodall.me.uk>
Newsgroups linux.debian.user
Subject Re: install Kernel and GRUB in chroot.
Date 2024-02-01 20:20 +0100
Message-ID <I2KLo-78k6-3@gated-at.bofh.it> (permalink)
References <I2JPj-77Kv-9@gated-at.bofh.it> <I2Ks1-77YK-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 2 Feb 2024, Dmitry wrote:

> Hi Tim. The community is so kind.
>
> So.
>
>> I'm not exactly sure what you're doing.
>
> Understand how GRUB works, to boot myself.
>
> 1. Trying to install Debian on the Flash.
> 2. Use it by the Debootstrap.
> 3. Now I want to boot using that Flash.
>
> Looks like a caught the thread.
>
> 1. ESP is a partition that stores GRUB Binary. /boot/EFI/Name/grub64.eif
> 2. ==>BAM<== some how that binary knows the system partition.


because grub64.efi understands the disk layout and looks for it. You can
build your own

I'm not giving any guarantees - look at the date on this file:

$ ls -al test-uefi
-rw-r--r-- 1 tim tim 341 Dec 31  2018 test-uefi

$ cat test-uefi
grub-mkimage -o bootx64.efi -p /EFI/BOOT -O x86_64-efi \
  fat iso9660 part_gpt part_msdos \
  normal boot echo linux configfile loopback chain \
  efifwsetup efi_gop efi_uga \
  ls search search_label search_fs_uuid search_fs_file \
  gfxterm gfxterm_background gfxterm_menu test all_video loadenv \
  exfat ext2 lvm mdraid09 mdraid1x diskfilter

but that probably builds (or once worked) a .efi application that will
successfully boot a system by searching for grub.cfg. I don't remember
the details...

I also have this - take with a pinch of salt - I wrote this learning
about this system as you are trying to now...


$ ls -al uefi-notes
-rw-r--r-- 1 tim tim 2375 Dec  1  2018 uefi-notes

1 FDISK

g - create a new empty GPT partition table

p - create a primary partition
+128M (size)

t - change type
1 - EFI system

p - create primary partition
fill rest of disk

vgcreate vg-uefi-boot /dev/sdb2

lvcreate -L 128M -n boot vg-uefi-boot

lvcreate -l 100%FREE -n root vg-uefi-boot

mke2fs -j /dev/mapper/vg--uefi--boot-boot

mke2fs -j /dev/mapper/vg--uefi--boot-root

mkdosfs /dev/sdb1

mount /dev/vg-uefi-boot/root /mnt/image/

debootstrap --variant=minbase stretch /mnt/image ftp://einstein/debian/

mount -o bind /proc /mnt/image/proc
mount -o bind /dev /mnt/image/dev
mount -o bind /sys /mnt/image/sys

chroot /mnt/image <<EOF

echo boot.home.woodall.me.uk >/etc/hostname

cat <<EOFX >/etc/fstab
# /etc/fstab: static file system information.
#
# <file system>  <mount point>  <type>  <options>          <dump>  <pass>
/dev/vg-uefi-boot/root       /              ext3    errors=remount-ro  1       1
/dev/vg-uefi-boot/boot       /boot          ext3    defaults           1       2
UUID=D1EA-35CC               /boot/efi auto defaults,noatime,nofail 0 0
EOFX

mount /boot
mkdir /boot/efi
mount /boot/efi

#Don't install recommends
cat <<EOFX >/etc/apt/apt.conf.d/99-no-recommends
APT
{
   Install-Recommends "false";
}
EOFX

#Setup apt sources
cat <<EOFX >/etc/apt/sources.list
deb ftp://einstein/debian stretch main non-free
deb ftp://einstein/debian-security stretch/updates main non-free
deb ftp://einstein/local stretch main
EOFX

echo link_in_boot = Yes >/etc/kernel-img.conf

apt-get update
apt-get -y upgrade

apt-get -y install sysvinit-core
apt-get -y install openssh-server
apt-get -y install ifupdown
apt-get -y install grub-efi-amd64
apt-get -y install mdadm
apt-get -y install lvm2
apt-get -y install linux-image-amd64

grub-install

mkdir /boot/efi/EFI/BOOT
cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/BOOT/bootx64.efi

update-grub

(update root password)

umount /boot/efi
umount /boot

EOF

umount /mnt/image/proc
umount /mnt/image/dev
umount /mnt/image/sys
umount /mnt/image/

vgchange -aln vg-uefi-boot

(Installed firmware-realtek)

mount /dev/vg-uefi-boot/root /mnt/image/
mount -o bind /proc /mnt/image/proc
mount -o bind /dev /mnt/image/dev
mount -o bind /sys /mnt/image/sys
chroot /mnt/image
mount -a

umount -a
exit

umount /mnt/image/proc
umount /mnt/image/dev
umount /mnt/image/sys
umount /mnt/image/
vgchange -aln vg-uefi-boot

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-01 16:20 +0100
  Re: install Kernel and GRUB in chroot. Marco Moock <mm@dorfdsl.de> - 2024-02-01 17:00 +0100
    Re: install Kernel and GRUB in chroot. Max Nikulin <manikulin@gmail.com> - 2024-02-01 17:30 +0100
      Re: install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-01 19:50 +0100
    Re: install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-01 18:30 +0100
      Re: install Kernel and GRUB in chroot. Marco Moock <mm@dorfdsl.de> - 2024-02-01 19:50 +0100
        Re: install Kernel and GRUB in chroot. Marco Moock <mm@dorfdsl.de> - 2024-02-02 15:20 +0100
        Re: install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-02 15:20 +0100
          Re: install Kernel and GRUB in chroot. Max Nikulin <manikulin@gmail.com> - 2024-02-02 15:30 +0100
            Re: install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-02 19:30 +0100
              Re: install Kernel and GRUB in chroot. <tomas@tuxteam.de> - 2024-02-02 20:00 +0100
            Re: install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-02 19:40 +0100
              Re: install Kernel and GRUB in chroot. "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-02 21:00 +0100
                Re: install Kernel and GRUB in chroot. Max Nikulin <manikulin@gmail.com> - 2024-02-03 05:00 +0100
        Re: install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-02 15:30 +0100
          Re: install Kernel and GRUB in chroot. David Wright <deblis@lionunicorn.co.uk> - 2024-02-02 17:50 +0100
          Re: install Kernel and GRUB in chroot. Franco Martelli <martellif67@gmail.com> - 2024-02-02 21:20 +0100
  Re: install Kernel and GRUB in chroot. Tim Woodall <debianuser@woodall.me.uk> - 2024-02-01 19:20 +0100
    Re: install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-01 20:00 +0100
      Re: install Kernel and GRUB in chroot. Marco Moock <mm@dorfdsl.de> - 2024-02-01 20:10 +0100
        Re: install Kernel and GRUB in chroot. Tim Woodall <debianuser@woodall.me.uk> - 2024-02-01 20:30 +0100
          Re: install Kernel and GRUB in chroot. Marco Moock <mm@dorfdsl.de> - 2024-02-01 20:40 +0100
            Re: install Kernel and GRUB in chroot. Tim Woodall <debianuser@woodall.me.uk> - 2024-02-02 20:20 +0100
              Re: install Kernel and GRUB in chroot. Max Nikulin <manikulin@gmail.com> - 2024-02-03 05:10 +0100
                Re: install Kernel and GRUB in chroot. Tim Woodall <debianuser@woodall.me.uk> - 2024-02-03 22:30 +0100
                Re: install Kernel and GRUB in chroot. Felix Miata <mrmazda@earthlink.net> - 2024-02-04 03:30 +0100
      Re: install Kernel and GRUB in chroot. Tim Woodall <debianuser@woodall.me.uk> - 2024-02-01 20:20 +0100
      Re: install Kernel and GRUB in chroot. Max Nikulin <manikulin@gmail.com> - 2024-02-02 03:40 +0100
        Re: install Kernel and GRUB in chroot. Marco Moock <mm@dorfdsl.de> - 2024-02-02 07:00 +0100
  Re: install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-03 16:50 +0100
    Re: install Kernel and GRUB in chroot. Max Nikulin <manikulin@gmail.com> - 2024-02-04 14:20 +0100
      Re: install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-05 08:20 +0100
      Re: install Kernel and GRUB in chroot. Dmitry <lbvf50.mobile@gmail.com> - 2024-02-05 12:00 +0100
        Re: install Kernel and GRUB in chroot. Ralph Aichinger <ra@h5.or.at> - 2024-02-05 12:20 +0100
        Re: install Kernel and GRUB in chroot. Max Nikulin <manikulin@gmail.com> - 2024-02-05 12:50 +0100

csiph-web