Re: The GRUB2 Bootloader – Installation and Configuration

2024-05-04 Thread Sérgio Basto
On Sat, 2024-05-04 at 07:53 +0200, Peter Boy wrote:
> 
> 
> > Am 04.05.2024 um 05:41 schrieb Sérgio Basto :
> > 
> > Hi, 
> > About this documentation [0], finally talks about rescue a
> > bootloader
> > with live images ... (but I will wrote about that in another time)
> 
> That doc is quite old, last review 2012-05-11! As a member of the
> docs board it tried to get it updated by an expert Fedorian,
> unfortunately without success. Grub changes only slowly and
> carefully. Basically, the text is still OK in my opinion, but some
> things are missing. 
> 
> 
> > I run in trouble on cloning a disk from an old computer and
> > starting
> > booting on a new computer , security get the thing more
> > complicated, I
> > had to disable secure boot and selinux not sure , but I advice boot
> > with kernel parameter selinux=0
> 
> To set selinux=0 is a bad idea. All the issues you describe have
> nothing to do with selinux.
> 
> > my old computer was bios legacy and the new have UEFI and here
> > starts
> > the challenge .
> 

also this documentation can be wrong 
https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/kernel-module-driver-configuration/Working_with_the_GRUB_2_Boot_Loader/#sec-grub2-reinstall_on_UEFI-Based_Machines


> That’s really a challenge. You don’t describe what you did in detail.

I did some notes, some years ago on https://www.serjux.com/clone/ and I
will update it after write this email .

First I installed Fedora 39 on new computer with an usb stick with
Network Install iso , is only useful to make the partitions ...
After I just copied the disks from old computer to the new computer
over the network, something like this [1] to an /mnt/new directory, in
old computer previously I logged out all sessions and run as root init
3.
After with same "Network Install iso", I boot again in new computer but
in rescue mode and I delete root and boot of the previous installation
and move data (of old computer) from /mnt/new folder to / and /boot 

The next is just change on /etc/fstab the new location of / and /boot
[2], ATM we also need edit /etc/kernel/cmdline [3] with the same new
location of root partition.

and reboot again several times in rescue mode, until restore the GRUB2
Bootloader  ,

Notes for boot into rescue mode :

As I mention I disable secured boot on bios and think I needed to boot
"Network Install iso" with selinux=0 in grub command line [4].  
 
if /etc/fstab doesn't have the correct paths, we may not have LVM
active, so to activate it we need run : `lvm vgchange -a y`

disable bell: `rmmod pcspkr`
change keyboard layout: `loadkeys pt`

chroot /mnt/sysimage/ or chroot /mnt/sysroot (it will be printed by
rescue system) 
 
dnf reinstall shim-* grub2-efi-* grub2-common (where I think is
important boot with selinux=0 or else you may got spurious messages
[4])

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

grubby --info=ALL


[1]
mkdir /mnt/new
cd /mnt/new/
ssh root@192.168.1.102 "dump -0 -f - / " | cat - | restore -r -f -
ssh root@192.168.1.102 "dump -0 -f - /boot " | cat - | restore -r -f - 

[2]
/dev/mapper/fedora_legion-root / ext4defaults1 1
UUID=a5d616ff-f93c-4887-9b8f-7895628ff787 /boot  ext4defaults 
1 2

[3]
root=/dev/mapper/fedora_legion-root ro audit=0 selinux=0

[4]
https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/kernel-module-driver-configuration/Working_with_the_GRUB_2_Boot_Loader/#sec-Terminal_Menu_Editing_During_Boot

edit menu during the boot to add selinux=0 
 
> But the first think is that you can’t clone the disk. Your old BIOS
> boot system probably uses an MBR partition scheme. Your new computer
> with UEFI, on the other hand, requires a GPT partitioning scheme. 
> 
> You will have to make a lot of manual adjustments to transfer the
> system. 
> You can convert your disk to GPT [a]. I never did this and I’m
> wondering how successful it works. 
> 
> 
> I never did this, but I guess the best option is to keep your new
> computer on UEFI, do a complete new installation, but use ANACONDA
> from the live image to replace btrfs by a LVM system reproducing your
> old LVM partitions as close as possible and use grub2 (maybe you have
> to use the everything net install medium). When the system boots,
> clone your LVM partitions (each partition separately, not the
> complete disk). Most importantly you should preserver the respective
> partition numbers. And find out what else to adjust (e.g. the uuids).
> That will we a lot of work, I guess. 
> 
> 
> 
> 
> 
> [a]
> https://serverfault.com/questions/963178/how-do-i-convert-my-linux-disk-from-mbr-to-gpt-with-uefi/963179#963179
> --
> Peter Boy
> https://fedoraproject.org/wiki/User:Pboy
> p...@fedoraproject.org
> 
> Timezone: CET (UTC+1) / CEST (UTC+2)
> 
> Fedora Server Edition Working Group member
> Fedora Docs team contributor and board member
> Java developer and enthusiast
> 
> 
> 
> --
> ___
>

Re: The GRUB2 Bootloader – Installation and Configuration

2024-05-03 Thread Peter Boy


> Am 04.05.2024 um 05:41 schrieb Sérgio Basto :
> 
> Hi, 
> About this documentation [0], finally talks about rescue a bootloader
> with live images ... (but I will wrote about that in another time)

That doc is quite old, last review 2012-05-11! As a member of the docs board it 
tried to get it updated by an expert Fedorian, unfortunately without success. 
Grub changes only slowly and carefully. Basically, the text is still OK in my 
opinion, but some things are missing. 


> I run in trouble on cloning a disk from an old computer and starting
> booting on a new computer , security get the thing more complicated, I
> had to disable secure boot and selinux not sure , but I advice boot
> with kernel parameter selinux=0

To set selinux=0 is a bad idea. All the issues you describe have nothing to do 
with selinux.

> my old computer was bios legacy and the new have UEFI and here starts
> the challenge .

That’s really a challenge. You don’t describe what you did in detail. But the 
first think is that you can’t clone the disk. Your old BIOS boot system 
probably uses an MBR partition scheme. Your new computer with UEFI, on the 
other hand, requires a GPT partitioning scheme. 

You will have to make a lot of manual adjustments to transfer the system. 
You can convert your disk to GPT [a]. I never did this and I’m wondering how 
successful it works. 


I never did this, but I guess the best option is to keep your new computer on 
UEFI, do a complete new installation, but use ANACONDA from the live image to 
replace btrfs by a LVM system reproducing your old LVM partitions as close as 
possible and use grub2 (maybe you have to use the everything net install 
medium). When the system boots, clone your LVM partitions (each partition 
separately, not the complete disk). Most importantly you should preserver the 
respective partition numbers. And find out what else to adjust (e.g. the 
uuids). That will we a lot of work, I guess. 





[a] 
https://serverfault.com/questions/963178/how-do-i-convert-my-linux-disk-from-mbr-to-gpt-with-uefi/963179#963179
--
Peter Boy
https://fedoraproject.org/wiki/User:Pboy
p...@fedoraproject.org

Timezone: CET (UTC+1) / CEST (UTC+2)

Fedora Server Edition Working Group member
Fedora Docs team contributor and board member
Java developer and enthusiast



--
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


The GRUB2 Bootloader – Installation and Configuration

2024-05-03 Thread Sérgio Basto
Hi, 
About this documentation [0], finally talks about rescue a bootloader
with live images ... (but I will wrote about that in another time) 

I run in trouble on cloning a disk from an old computer and starting
booting on a new computer , security get the thing more complicated, I
had to disable secure boot and selinux not sure , but I advice boot
with kernel parameter selinux=0

my old computer was bios legacy and the new have UEFI and here starts
the challenge .

I think just after do the lvm steps (my disks have lvm partitons) [1] I
start to boot correctly and the problem (I think) was that I need to
run one time 
'grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg' . I think is wrong 
use grub2-mkconfig -o /boot/grub2/grub.cfg , like it is wrote on grub2
on a uefi system [2], should we fix it ? and the advice of boot with
selinux=0 ? 

Best regards,

[0]
https://docs.fedoraproject.org/en-US/quick-docs/grub2-bootloader/

[1]
https://docs.fedoraproject.org/en-US/quick-docs/grub2-bootloader/#_lvm_steps
 
[2]https://docs.fedoraproject.org/en-US/quick-docs/grub2-bootloader/#_installing_grub2_on_a_uefi_system
-- 
Sérgio M. B.
--
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue