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


Groups > linux.debian.user > #266838 > unrolled thread

install Kernel and GRUB in chroot.

Started byDmitry <lbvf50.mobile@gmail.com>
First post2024-02-01 16:20 +0100
Last post2024-02-05 12:50 +0100
Articles 20 on this page of 35 — 10 participants

Back to article view | Back to linux.debian.user


Contents

  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

Page 1 of 2  [1] 2  Next page →


#266838 — install Kernel and GRUB in chroot.

FromDmitry <lbvf50.mobile@gmail.com>
Date2024-02-01 16:20 +0100
Subjectinstall Kernel and GRUB in chroot.
Message-ID<I2H17-760V-3@gated-at.bofh.it>
Greetings!

After:
1. Creating GPT table and GPT partition with fdisk.
2. Copy data with a debootstrap.
3. Chroot into newly creating system.

I need to prepare that system for booting.
1. Install Kernel.
2. Install GRUB and Configure.
3. Add changes to UEFI to start booting.

And at the point two (Install GRUB) I a little bit confused.

1. Need to create ESP, and put GRUB there.
2. Need to configure GRUB to select appropriate kernel and ramdisk.

Could you help me a little bit?

How to create a ESP partition and mount it to /boot?
If a ESP partition a simple Partition formatted to FAT32?
How GRUB would understand where to be install and where is the kernel?

And the last one. If I want to step back. And just use a USB stick with
predefined image, what kind of partition table I should create there MBR or GPT?

Thank you!

[toc] | [next] | [standalone]


#266841

FromMarco Moock <mm@dorfdsl.de>
Date2024-02-01 17:00 +0100
Message-ID<I2HDP-76ec-15@gated-at.bofh.it>
In reply to#266838
Am 01.02.2024 schrieb Dmitry <lbvf50.mobile@gmail.com>:

Why don't you use the normal setup?
It does many tasks for you.

> After:
> 1. Creating GPT table and GPT partition with fdisk.

Use gdisk for that.
You can create an EFI partition there.
Choose Type EFI (EF00), 100MB.
Format it with FAT32.

> And at the point two (Install GRUB) I a little bit confused.
> 
> 1. Need to create ESP

Do that before the install with gdisk.

> and put GRUB there.

That is done automatically if it is mounted at /boot/efi.

> 2. Need to configure GRUB to select appropriate kernel and ramdisk.

Do you need a special configuration here or is the default just fine?

> How to create a ESP partition and mount it to /boot?

That must be mounted to /boot/efi.

If you create a separate boot partition (do you really need it?), it
must be mounted at /boot.

> How GRUB would understand where to be install and where is the kernel?

It chooses by the path.
grub-install is the command, no device as parameter.

[toc] | [prev] | [next] | [standalone]


#266842

FromMax Nikulin <manikulin@gmail.com>
Date2024-02-01 17:30 +0100
Message-ID<I2I6S-76E8-9@gated-at.bofh.it>
In reply to#266841
On 01/02/2024 22:54, Marco Moock wrote:
> Am 01.02.2024 schrieb Dmitry:
> 
> Use gdisk for that.
> You can create an EFI partition there.
> Choose Type EFI (EF00), 100MB.
> Format it with FAT32.

550MiB is recommended in "Preparing your ESP"
http://www.rodsbooks.com/linux-uefi/#installing
see also
https://www.rodsbooks.com/gdisk/advice.html#esp_sizing
https://fedoraproject.org/wiki/Changes/BiggerESP

>> 2. Need to configure GRUB to select appropriate kernel and ramdisk.
> 
> Do you need a special configuration here or is the default just fine?

EFI/debian/grub.cfg on the EFI System Partition contains filesystem UUID 
where grub files reside.

After installing grub check that NVRAM has an appropriate entry

     efibootmgr -v

>> How GRUB would understand where to be install and where is the kernel?

It loads files from filesystem on the specified partition. Unlike for 
BIOS device blocks are not involved.

[toc] | [prev] | [next] | [standalone]


#266851

FromDmitry <lbvf50.mobile@gmail.com>
Date2024-02-01 19:50 +0100
Message-ID<I2Kim-77Vv-3@gated-at.bofh.it>
In reply to#266842
Huge thanks.
Your message starts the understanding.
And as well give a plenty of texts to read.

 > EFI/debian/grub.cfg on the EFI System Partition contains filesystem UUID 
where grub files reside.

All parts are simple But when compounding them together become messy.

In the Manjaro:
/boot/EFI/Majaro/grub64x.efi - binary to start by UEFI.
/boot/grub/grub.cfg - shell (?) script with configurations.
/boot/vimlinuz.* - the kernel.

And if call a `lsblk`.
Only a /boot/efi with a binary is a separate partiton.

Things become more clear.

[toc] | [prev] | [next] | [standalone]


#266847

FromDmitry <lbvf50.mobile@gmail.com>
Date2024-02-01 18:30 +0100
Message-ID<I2J2Y-77dS-27@gated-at.bofh.it>
In reply to#266841
 > Why don't you use the normal setup?

Spend a lot of time on research, it would be nice to finish.

I made experiments with a FlashDrive, and create GPT there,
if I want to use standard Debian Image how I should partition that
flash drive (MBR, GPT)?

 > Do you need a special configuration here or is the default just fine?

Need just working one. But I am confusing about how GRUB would get a
plenty of things related to filesystem, kernel location and so on.

 > If you create a separate boot partition (do you really need it?), it
must be mounted at /boot.

Here where the mess starts. How GRUB and Kernel would get information about
all this mounting points during the Boot.

[toc] | [prev] | [next] | [standalone]


#266850

FromMarco Moock <mm@dorfdsl.de>
Date2024-02-01 19:50 +0100
Message-ID<I2Kim-77Vv-5@gated-at.bofh.it>
In reply to#266847
Am 02.02.2024 um 00:09:56 Uhr schrieb Dmitry:

> I made experiments with a FlashDrive, and create GPT there,
> if I want to use standard Debian Image how I should partition that
> flash drive (MBR, GPT)?

Do you want to install the OS on it?
For the partition table, I recommend GPT.

Do you want an encrypted system?

>  > Do you need a special configuration here or is the default just
>  > fine?  
> 
> Need just working one. But I am confusing about how GRUB would get a
> plenty of things related to filesystem, kernel location and so on.

That is being done be the installer. If you don't need special
configuration, use the install process. It does everything for you.

-- 
Gruß
Marco

Spam und Werbung bitte an ichschickereklame@cartoonies.org

[toc] | [prev] | [next] | [standalone]


#266871

FromMarco Moock <mm@dorfdsl.de>
Date2024-02-02 15:20 +0100
Message-ID<I32yB-7nJs-3@gated-at.bofh.it>
In reply to#266850
Am 02.02.2024 schrieb Dmitry <lbvf50.mobile@gmail.com>:

> I want OS at the SSD.

Then the ESP should be on that SSD too.

[toc] | [prev] | [next] | [standalone]


#266872

FromDmitry <lbvf50.mobile@gmail.com>
Date2024-02-02 15:20 +0100
Message-ID<I32yB-7nJs-1@gated-at.bofh.it>
In reply to#266850
 > Do you want to install the OS on it?

Eventually no, I do not want OS on the Flash Stick.
The Flash Stick is only a testing place. I want OS at the SSD.

Now I am wondering how to prepare the Flash Stick to write LiveImage on it. 
Because I already created a GPT table on that Flash and use debootstrap.

Looks like need to create a new parition and copy LiveImage there.
Need additional research what to do with a FlashStick with several partitions 
to make a LiveCD from it.


 > Do you want an encrypted system?

No. I do not need this abstraction layer now.

[toc] | [prev] | [next] | [standalone]


#266875

FromMax Nikulin <manikulin@gmail.com>
Date2024-02-02 15:30 +0100
Message-ID<I32Ih-7nND-3@gated-at.bofh.it>
In reply to#266872
On 02/02/2024 21:06, Dmitry wrote:
> Need additional research what to do with a FlashStick with several 
> partitions to make a LiveCD from it.

Just copy files from LiveCD (it should have EFI/Boot/bootx64.efi) to the 
ESP partition on the USB stick.

[toc] | [prev] | [next] | [standalone]


#266882

FromDmitry <lbvf50.mobile@gmail.com>
Date2024-02-02 19:30 +0100
Message-ID<I36sx-7qdp-7@gated-at.bofh.it>
In reply to#266875
 > Just copy files from LiveCD (it should have EFI/Boot/bootx64.efi) to the 
ESP partition on the USB stick.

As I understand right now `dd` command applied to a device will copy all 
information including partitions table. Thus:

dd if=debian-xx.iso of=/dev/sdb bs=4M status=progress; sync

Would just create a copy of device, with FileSystem and PartitionsTable.

[toc] | [prev] | [next] | [standalone]


#266885

From<tomas@tuxteam.de>
Date2024-02-02 20:00 +0100
Message-ID<I36Vz-7qoh-13@gated-at.bofh.it>
In reply to#266882

[Multipart message — attachments visible in raw view] — view raw

On Sat, Feb 03, 2024 at 01:17:05AM +0700, Dmitry wrote:
> > Just copy files from LiveCD (it should have EFI/Boot/bootx64.efi) to the
> ESP partition on the USB stick.
> 
> As I understand right now `dd` command applied to a device will copy all
> information including partitions table. Thus:

Actually, cp (or even, horrors ;-) cat do the same. One advantage of dd is...

> dd if=debian-xx.iso of=/dev/sdb bs=4M status=progress; sync

...this "status=progress". The other is "oflag=sync": for bigger sticks
(and if you have tons of RAM) this last "sync" could take a long while,
without giving you feedback of what's happening.

And the third one (which it shares with cp but not with cat) is that
sudo won't work in "sudo cat foo.img > /dev/bar" (unless you already
are root, but that'd be cheating ;-)

Cheers
-- 
t

[toc] | [prev] | [next] | [standalone]


#266883

FromDmitry <lbvf50.mobile@gmail.com>
Date2024-02-02 19:40 +0100
Message-ID<I36Cd-7qgD-9@gated-at.bofh.it>
In reply to#266875
 > Just copy files from LiveCD (it should have EFI/Boot/bootx64.efi) to the 
ESP partition on the USB stick.

Yep. `dd` copy partitions table. Amazing.

```
dd will simply recreate the old partition scheme, as it is a bitwise copy & 
applies no 'intelligence' to the operation.
```
https://askubuntu.com/a/847533

[toc] | [prev] | [next] | [standalone]


#266888

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2024-02-02 21:00 +0100
Message-ID<I37RD-7qX5-3@gated-at.bofh.it>
In reply to#266883
Hi,

Dmitry wrote:
> Yep. `dd` copy partitions table. Amazing.

Not so amazing after you realize that a partition table is just data on
the storage medium and not some special property of the storage device.
dd copies data. If these data contain a partition table and get copied to
the right place on the storage medium, the partition table will be
recognized by EFI and Linux.


> applies no 'intelligence' to the operation.

This describes it very well. Sometimes dumb is good. Sometimes not.


Initially you stated in
  https://lists.debian.org/debian-user/2024/02/msg00008.html
>...> I need to prepare that system for booting.
>...> 1. Install Kernel.
>...> 2. Install GRUB and Configure.
>...> 3. Add changes to UEFI to start booting.

dd-ing a bootable Debian ISO will not do what you describe.
Assumed the ISO is prepared for booting from USB stick, you will get a
bootable Live or an installer system. At least ISOs for i386, amd64, and
arm64 should be prepared for that.

If it is not ready for booting from USB stick, it will be just a storage
with a mountable filesystem and Debian files in it.


Max Nikulin wrote:
> > Just copy files from LiveCD (it should have EFI/Boot/bootx64.efi)
> > to the ESP partition on the USB stick.

The /EFI/boot directory of a bootable Debian ISO usually does not contain
the full GRUB equipment for EFI. Important parts of an amd64 Live ISO are
in /boot/grub.
The programs in /EFI/boot are specialized on convincing Secure Boot and
on finding the ISO filesystem with /boot/grub in it. (Actually those are
copies of the EFI boot partition files. The boot partition is a FAT
filesystem image file inside the ISO named /boot/grub/efi.img .)


Tim Woodall wrote:
> > I'm not exactly sure what you're doing.

I join this statement. :))

Do you want a normal changeable Debian system installation or do you want
a Live system with its immutable core and maybe some partition where you
can store files ?
(Just curiosity of mine. Possibly i could not help much with chroot
questions anyway.)


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


#266912

FromMax Nikulin <manikulin@gmail.com>
Date2024-02-03 05:00 +0100
Message-ID<I3fm9-7vFi-9@gated-at.bofh.it>
In reply to#266888
On 03/02/2024 02:51, Thomas Schmitt wrote:
> Max Nikulin wrote:
>>> Just copy files from LiveCD (it should have EFI/Boot/bootx64.efi)
>>> to the ESP partition on the USB stick.
> The /EFI/boot directory of a bootable Debian ISO usually does not contain
> the full GRUB equipment for EFI. Important parts of an amd64 Live ISO are
> in /boot/grub.

Certainly. And grubx64.efi in EFI/Boot of a live media behaves a bit 
differently from one in EFI/debian of a regular install since in the 
former case it relies on boot/grub residing on the same partition.

My point was to copy *files* to the pre-partitioned drive, not a whole 
image to the whole block device. I had a hope that the topic starter is 
aware of the recommended way to create a bootable USB stick using dd (or 
cp, etc.).

I usually copy files to existing single FAT partition on USB drives 
having msdos partition table (as they are shipped). It requires 
additional actions to setup syslinux for the sake of legacy boot, but it 
leaves enough space to put some additional files while the boot drive is 
prepared or during live session (requires remounting as rw). UEFI boot 
relies on files and their specific layouts, not on specific block addresses.

[toc] | [prev] | [next] | [standalone]


#266873

FromDmitry <lbvf50.mobile@gmail.com>
Date2024-02-02 15:30 +0100
Message-ID<I32Ih-7nND-1@gated-at.bofh.it>
In reply to#266850
Going to read carefully.

https://www.debian.org/releases/buster/amd64/ch04s03.en.html

Interesting that Buster has more documentation than current release.

[toc] | [prev] | [next] | [standalone]


#266881

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2024-02-02 17:50 +0100
Message-ID<I34TM-7p9l-21@gated-at.bofh.it>
In reply to#266873
On Fri 02 Feb 2024 at 21:12:30 (+0700), Dmitry wrote:
> Going to read carefully.
> 
> https://www.debian.org/releases/buster/amd64/ch04s03.en.html
> 
> Interesting that Buster has more documentation than current release.

It appears the balance has now been spun off into a wiki page, at

  https://wiki.debian.org/DebianInstaller/CreateUSBMedia

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#266891

FromFranco Martelli <martellif67@gmail.com>
Date2024-02-02 21:20 +0100
Message-ID<I38aZ-7riC-3@gated-at.bofh.it>
In reply to#266873
On 02/02/24 at 15:12, Dmitry wrote:
> Going to read carefully.
> 
> https://www.debian.org/releases/buster/amd64/ch04s03.en.html
> 
> Interesting that Buster has more documentation than current release.
> 
> 

Nope, maybe you gave a quick read, the release notes of the current 
release ¹  are exhaustive. If you need to go deeper, a link ² to the 
wiki it's published in that page.

Kind regards,


¹ https://www.debian.org/releases/bookworm/amd64/ch04s03.en.html
² https://wiki.debian.org/DebianInstaller/CreateUSBMedia
-- 
Franco Martelli

[toc] | [prev] | [next] | [standalone]


#266849

FromTim Woodall <debianuser@woodall.me.uk>
Date2024-02-01 19:20 +0100
Message-ID<I2JPj-77Kv-9@gated-at.bofh.it>
In reply to#266838
On Thu, 1 Feb 2024, Dmitry wrote:

> Greetings!
>
> After:
> 1. Creating GPT table and GPT partition with fdisk.
> 2. Copy data with a debootstrap.
> 3. Chroot into newly creating system.
>
> I need to prepare that system for booting.
> 1. Install Kernel.
> 2. Install GRUB and Configure.
> 3. Add changes to UEFI to start booting.
>
> And at the point two (Install GRUB) I a little bit confused.
>
> 1. Need to create ESP, and put GRUB there.
> 2. Need to configure GRUB to select appropriate kernel and ramdisk.
>
I'm not exactly sure what you're doing. But the "trick" to doing most of
this in a chroot is to bind mount /dev, /proc, /sys and /run into the
chroot.

Then things like installing the kernel, building the initrd etc
(usually) just work.

"Add changes to UEFI to start booting" depends on the actual hardware
that will boot. If you're preparing images on one system to boot on
another then that bit you'll have to solve by booting the hardware.

I'd probably pick a live distro but it's theoretically[1] possible to
generate your own bootx64.efi that will then boot your system. Once it's
booted you can then use the normal tools to replace it with a more
easily maintained debian solution.

[1] Not just theoretical, I've actually done it once long ago.

[toc] | [prev] | [next] | [standalone]


#266852

FromDmitry <lbvf50.mobile@gmail.com>
Date2024-02-01 20:00 +0100
Message-ID<I2Ks1-77YK-1@gated-at.bofh.it>
In reply to#266849
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.
3. At the system partition there is a /boot/grub/grub.cfg
4. And at that /boot/grub/grub.cfg is UUID and etc. to start Booting.

But the question is on the step 2. /boot/EFI/Name/grub64.efi knows where
to start /boot/grub/grub.cfg that resides at the absolutely different partition.

Interesting.
But the question already asked. Now it possible to find the answer.

Thank you!

[toc] | [prev] | [next] | [standalone]


#266853

FromMarco Moock <mm@dorfdsl.de>
Date2024-02-01 20:10 +0100
Message-ID<I2KBH-78h5-1@gated-at.bofh.it>
In reply to#266852
Am 02.02.2024 um 01:46:06 Uhr schrieb Dmitry:

> 2. ==>BAM<== some how that binary knows the system partition.

That information is on the EFI partition, where the GRUB bootloader
binary also resides.

root@ryz:/boot/efi/EFI# cat /boot/efi/EFI/debian/grub.cfg
search.fs_uuid 5b8b669d-xyz root hd0,gpt2 #boot partition
set prefix=($root)'/grub'
configfile $prefix/grub.cfg
root@ryz:/boot/efi/EFI#

If that information is loaded, the kernel can be loaded from the boot
partition.


-- 
Gruß
Marco

Spam und Werbung bitte an ichschickereklame@cartoonies.org

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.debian.user


csiph-web