Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] disk (following gentoo handbook) will not boot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
dpaddy
Apprentice
Apprentice


Joined: 25 Jun 2008
Posts: 176

PostPosted: Mon Mar 17, 2025 1:02 am    Post subject: [SOLVED] disk (following gentoo handbook) will not boot Reply with quote

I have two systems: old and new. I have two disks: old and new. Both disks boot right fine on the old system. Only the old disk will boot on the new system. My plan (unless I receive wiser advice) is to make another disk -- call it a good disk (good because it should boot on the new system) -- that will be like the old disk but has contents which are essentially the same as the new disk (I have sweated blood getting the new disk to boot into a functioning gentoo environment on the old system and will go insane if I have to replicate that work all over again).
I am currently booted on the new system with the old disk
Code:
 $ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   5.5T  0 disk
├─sda1   8:1    0     2G  0 part
├─sda2   8:2    0    64G  0 part
└─sda3   8:3    0   5.4T  0 part
sdb      8:16   0 931.5G  0 disk
├─sdb1   8:17   0     8M  0 part
├─sdb2   8:18   0  1018M  0 part
├─sdb3   8:19   0    32G  0 part [SWAP]
└─sdb4   8:20   0 898.5G  0 part /
The old disk is sdb and the new disk is sda. I presume that the old gentoo system is essentially on sdb4 and the new gentoo system is essentially on sda3.
fdisk reports
Code:
Disk /dev/sda: 5.47 TiB, 6001175126016 bytes, 11721045168 sectors
Disk model: ST6000NM019B-2TG
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 19DF9733-89BD-4F0D-AF35-4D12206D2703

Device         Start         End     Sectors  Size Type
/dev/sda1       2048     4196351     4194304    2G EFI System
/dev/sda2    4196352   138414079   134217728   64G Linux swap
/dev/sda3  138414080 11721043967 11582629888  5.4T Linux root (x86-64)
and
Code:
Disk /dev/sdb: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD1005FBYZ-0
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: AF2E0A39-C07A-48AD-B126-4B6C73CE2F1D

Device        Start        End    Sectors   Size Type
/dev/sdb1      2048      18431      16384     8M BIOS boot
/dev/sdb2     18432    2103295    2084864  1018M EFI System
/dev/sdb3   2103296   69212159   67108864    32G Linux filesystem
/dev/sdb4  69212160 1953523119 1884310960 898.5G Linux filesystem
So I suppose I need to format the good disk -- call it sdc -- to have partitions like sdb. Partition sdc3 will be swap just like sdb3 and sdc4 will be / just like sdb4. I am uncertain of the precise mechanics to format sdc, and how to "initialize" sdc1 and sdc2 so that booting the good disk works like booting the old disk. Moreover, I don't know exactly how to copy sda3 to sdc4 in a manner such that everything magically works without blood sweat and tears.
fstab (remember I've booted with sdb on the new sysrtem) is
Code:
UUID="5562-2CBD"                            /boot        vfat  noauto,noatime 1 2
UUID="a5c0888d-d3b5-4896-9222-74357a093da8" none         swap  sw             0 0
UUID="76be16bb-33e0-4e4e-b42c-063cc7dca9bd" /            ext4  noatime        0 1
UUID="5f4ced57-9b19-400d-abfe-bd4548ff67fb" /mnt/tmp     ext4  noauto,user    0 0
UUID="e7f8bc6f-91e7-44e5-bac8-a3fd2a43bd1c" /mnt/raid    ext4  noauto,user    0 0
LABEL=scratch                               /mnt/scratch ext4  noauto,user    0 0
/dev/cdrom                                  /mnt/cdrom   auto  noauto,user    0 0
/dev/sde1                                   /mnt/usb     vfat  noauto,user    0 0

Everything on /mnt/... is not going to be part of the new system. I don't perfectly understand what
Code:
UUID="5562-2CBD"                            /boot        vfat  noauto,noatime 1 2
is about because I thought /boot was somehow involved in the boot process but
Code:
 # mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
none on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=8225695,mode=755)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb4 on / type ext4 (rw,noatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)
openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib/rc/sh/cgroup-release-agent.sh,name=openrc)
none on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cpuset on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cpu on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)
cpuacct on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)
freezer on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=6588576k,mode=700,uid=1000,gid=1000)
and
Code:
 # ls -al /boot
total 8
drwxr-xr-x  2 root root 4096 Jun 24  2020 .
drwxr-xr-x 20 root root 4096 Mar  8 08:48 ..
-rw-r--r--  1 root root    0 Jun 24  2020 .keep
which tells me (or so I think) that /boot is empty which seems strange given that sdb boots. Perhaps something about sdb1 and sdb2 provides an initramfs. In any case I want to have the contents of /boot actually living on sdc4 rather than it residing elsewhere requiring mounting something to mount point /boot.
It needs to be appreciated that I am a master at totally fucking things up, I don't have a proper understanding of genttoo, and I need painfully explicit and complete details if I am to have any chance of fixing things.
Is there a gentoo ninja who will hand-hold me through this? I'ld sincerely appreciate it.

EDIT: After getting much needed sleep it occurred to me that the above is likely a fever dream -- an absolutely insane idea. I need to focus on getting the new disk to boot in the new system. I replaced the battery on the new system's motherboard, reloaded uefi defaults in the bios, and tried to boot the new disk. Now I get
Quote:
GRUB loading.
Welcome to GRUB!
error: unknown file system.
Entering rescue mode...
grub rescue >
At this point I will try to understand https://forums.gentoo.org/viewtopic-t-1161648-highlight-grub+error+unknown+system.html and will update this post with whatever issues/progress I make.

Last edited by dpaddy on Mon Mar 17, 2025 2:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
dpaddy
Apprentice
Apprentice


Joined: 25 Jun 2008
Posts: 176

PostPosted: Mon Mar 17, 2025 2:31 pm    Post subject: Reply with quote

I tried to reinstall grub following the handbook
Code:
livecd ~ # mkdir --parents /mnt/gentoo
livecd ~ # mount /dev/sda3 /mnt/gentoo
livecd ~ # mkdir --parents /mnt/gentoo/efi
livecd ~ # cd /mnt/gentoo
livecd /mnt/gentoo # mount --types proc /proc /mnt/gentoo/proc
livecd /mnt/gentoo # mount --rbind /sys /mnt/gentoo/sys
livecd /mnt/gentoo # mount --make-rslave /mnt/gentoo/sys
livecd /mnt/gentoo # mount --rbind /dev /mnt/gentoo/dev
livecd /mnt/gentoo # mount --make-rslave /mnt/gentoo/dev
livecd /mnt/gentoo # mount --bind /run /mnt/gentoo/run
livecd /mnt/gentoo # mount --make-slave /mnt/gentoo/run
livecd /mnt/gentoo # chroot /mnt/gentoo /bin/bash
livecd / # source /etc/profile
livecd / # export PS1="(chroot) ${PS1}"
(chroot) livecd / # mount /dev/sda1 /efi
(chroot) livecd / # cat /etc/portage/package.use/installkernel
sys-kernel/installkernel dracut grub
(chroot) livecd / # lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0   679M  1 loop
sda      8:0    0   5.5T  0 disk
├─sda1   8:1    0     2G  0 part /efi
├─sda2   8:2    0    64G  0 part [SWAP]
└─sda3   8:3    0   5.4T  0 part /
sdb      8:16   0 931.5G  0 disk
├─sdb1   8:17   0     8M  0 part
├─sdb2   8:18   0  1018M  0 part
├─sdb3   8:19   0    32G  0 part
└─sdb4   8:20   0 898.5G  0 part
sdc      8:32   1   3.7G  0 disk
├─sdc1   8:33   1   250K  0 part
├─sdc2   8:34   1   2.8M  0 part
├─sdc3   8:35   1 776.8M  0 part
└─sdc4   8:36   1   300K  0 part
(chroot) livecd / # blkid
/dev/sdc3: BLOCK_SIZE="2048" LABEL="Gentoo-amd64-20250309" TYPE="hfsplus" PARTLABEL="HFSPLUS" PARTUUID="ea97a0db-3884-430a-8935-ef74c9855b19"
/dev/sdb4: UUID="76be16bb-33e0-4e4e-b42c-063cc7dca9bd" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="rootfs" PARTUUID="da2d0284-7b90-48c8-898b-2dae328f7b1f"
/dev/sdb2: UUID="5562-2CBD" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="boot" PARTUUID="545a06c5-3154-4328-b267-808d36cb8540"
/dev/sdb3: UUID="a5c0888d-d3b5-4896-9222-74357a093da8" TYPE="swap" PARTLABEL="swap" PARTUUID="426c0ada-439e-46f9-b68b-f905934ade32"
/dev/sdb1: PARTLABEL="grub" PARTUUID="e45c8972-7179-4e6c-bb28-6e2266963ac0"
/dev/loop0: BLOCK_SIZE="131072" TYPE="squashfs"
/dev/sdc2: SEC_TYPE="msdos" UUID="30ED-476B" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI boot partition" PARTUUID="ea97a0db-3884-430a-8934-ef74c9855b19"
/dev/sdc1: PARTLABEL="Gap0" PARTUUID="ea97a0db-3884-430a-8937-ef74c9855b19"
/dev/sdc4: PARTLABEL="Gap1" PARTUUID="ea97a0db-3884-430a-8932-ef74c9855b19"
/dev/sda2: UUID="e3960c50-67dc-44cb-b718-0f16a2d1edb0" TYPE="swap" PARTUUID="fa9bc050-84bd-472d-951a-db1d637681cc"
/dev/sda3: UUID="4ecf4ba4-ea4a-408a-9a02-6974e1e78498" BLOCK_SIZE="4096" TYPE="xfs" PARTUUID="93c124f2-769a-405e-97df-84fff4674735"
/dev/sda1: UUID="45A7-64AA" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="b3caa0e9-1073-4486-846d-95f8de7b7115"
(chroot) livecd / # cat /etc/fstab

UUID="45A7-64AA"                            /efi         vfat  umask=0077             0 2
UUID="e3960c50-67dc-44cb-b718-0f16a2d1edb0" none         swap  sw                     0 0
UUID="4ecf4ba4-ea4a-408a-9a02-6974e1e78498" /            xfs   defaults,noatime       0 1
/dev/cdrom                                  /mnt/cdrom   auto  noauto,noatime,user    0 0
(chroot) livecd / # cat /etc/portage/make.conf
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
COMMON_FLAGS="-march=native -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
RUSTFLAGS="${RUSTFLAGS} -C target-cpu=native" 

CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3"
MAKEOPTS='-j16'

GRUB_PLATFORMS="efi-64"

# NOTE: This stage was built with the bindist USE flag enabled

USE="X elogind"
VIDEO_CARDS="nouveau"
# INPUT_DEVICES="libinput"

ACCEPT_LICENSE="-* @FREE @BINARY-REDISTRIBUTABLE"

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C.utf8
(chroot) livecd / # emerge -vp sys-boot/grub

These are the packages that would be merged, in order:

Calculating dependencies... done!
Dependency resolution took 1.73 s (backtrack: 0/20).

[ebuild   R    ] sys-boot/grub-2.12-r5:2/2.12-r5::gentoo  USE="device-mapper fonts nls themes -doc -efiemu -libzfs -mount -sdl -secureboot (-test) -truetype -verify-sig" GRUB_PLATFORMS="efi-64 -coreboot -efi-32 -emu -ieee1275 (-loongson) -multiboot -pc -qemu (-qemu-mips) -uboot -xen -xen-32 -xen-pvh" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

 * IMPORTANT: 19 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
I emerged grub (again) with success. Perhaps the use flags should be different but I could not find what they should be in the handbook.
Code:
(chroot) livecd / # grub-install --efi-directory=/efi
grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist. Please specify --target or --directory.
(chroot) livecd / #  grub-install --target=x86_64-efi --efi-directory=/efi
Installing for x86_64-efi platform.
EFI variables are not supported on this system.
EFI variables are not supported on this system.
grub-install: error: efibootmgr failed to register the boot entry: No such file or directory.
I will reboot and check that CSM mode is disabled in the BIOS. Perhaps that will allow grub-install... I'll post the results.

EDIT: After disabling CSM, booting the Minimal installation CD from usb and then chroot, now grub-install works as described in the handbook and my new disk boots in the new system :D

I have serious problems with emacs not working (except when using -nw) but that is for a different post.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum