0

I am trying to install grub from my functioning Debian-12 system to another disk in my PC.

Problem: I have two disks, disk1 and disk2. Disk1 with working Debian 12 (As mentioned.) and the other Disk2, on this one there is a Windows 10 and cloned partition of my Debian from Disk1.

As can be seen below, my attempt at installing grub was semi-successful. But I am having troubles with configuration of grub, to recognize the two partition on disk2, even if I boot from disk2 grub still boots from the partition on disk1

What I've done so far is that I've repartitioned disk2 - deleted windows bootloader partition, shifted windows partition to the right, created EFI partition for the grub, via clonezila I've copied my Debian ext4 partition from disk1 to disk2, created linux-swap partition. Here is the output of lsblk command:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sr0          11:0    1  1024M  0 rom  
nvme0n1     259:0    0 238.5G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
├─nvme0n1p2 259:2    0   237G  0 part /
└─nvme0n1p3 259:3    0   977M  0 part [SWAP]
nvme1n1     259:4    0 931.5G  0 disk 
├─nvme1n1p1 259:5    0   512M  0 part 
├─nvme1n1p2 259:6    0 232.8G  0 part 
├─nvme1n1p3 259:7    0 660.9G  0 part 
└─nvme1n1p4 259:8    0  37.2G  0 part

Here is the partition scheme of disk2 via fdisk -l /dev/disk2:

Disk /dev/nvme1n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: ADATA LEGEND 800                        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: BB47134C-B71E-4797-844A-799AF566DEF2

Device Start End Sectors Size Type /dev/nvme1n1p1 2048 1050623 1048576 512M EFI System /dev/nvme1n1p2 1054720 489336831 488282112 232.8G Microsoft basic data /dev/nvme1n1p3 489347072 1875390463 1386043392 660.9G Linux filesystem /dev/nvme1n1p4 1875400704 1953515519 78114816 37.2G Linux swap

Here is the tree /mnt/ output of the EFI partition (Mounted to /mnt)

/mnt/
├── boot
│   ├── efi
│   │   └── grub
│   └── grub
└── EFI
    └── GRUB
        ├── BOOTX64.CSV
        ├── fbx64.efi
        ├── grub.cfg
        ├── grubx64.efi
        ├── mmx64.efi
        └── shimx64.efi

7 directories, 6 files

So I guess that my grub install was semi-successful, but for some weird reason I am having troubles with configuring grub so that it recognizes the two above partitions. I would add grub.cfg file but at this point I am kinda lost, since as you can see the /boot/grub/ folder is kinda empty.

Please could anyone tell me what am I doing wrong and help me with figuring this out?

Giacomo1968
  • 58,727

1 Answers1

0

The first thing you need to do is reinstall GRUB. There's a very good description of how to do that here -> How to reinstall GRUB2 EFI? Or if you want an alternate try -> https://www.fosslinux.com/115040/a-complete-guide-to-installing-grub-bootloader-on-linux.htm But most things about reinstalling or modifying your boot sequence are covered

Now very important! Create a Debian 12 Live image on a USB using your favorite image writer, Rufus or balenaEtcher are used a lot if you don't have one. Now boot it up and login to it user=user password=live. At this point you can either put a sudo in front of all your commands or do a sudo -i Although you could use any live system at this level there may be somethings that are easier in Debian 12. You can open a teminal and providing you have a network you can install anything you don't have. Just remember to direct things to the the disk your trying to fix because your root is on the USB. Now do a LSBLK to see all your devices, and get to work.

cpu
  • 11