Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Trouble restoring from a stage 4
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
imieinazwisko
n00b
n00b


Joined: 13 Feb 2020
Posts: 20

PostPosted: Sun Feb 23, 2020 5:02 am    Post subject: [Solved] Trouble restoring from a stage 4 Reply with quote

I'm trying to migrate my install to a larger SSD using a stage 4. Using mkstage4 I created the stage 4 tarball. I partitioned my disks in the same manner I have them partitioned on my current system. The only thing different is that they are labeled sdb1, sdb2 since sda is my current disk. Once the stage 4 was created I mounted the new / disk and extracted the tarball

Code:
tar xvjpf archive_name.tar.bz2 --xattrs-include='*.*' --numeric-owner


Following extraction I chroot:

Code:
chroot /mnt/gentoo /bin/bash
source /etc/profile


Once I am in the new system I edit my fstab to reflect the UUIDs of the partitions. The next step seems to be to mount the EFI partition and install GRUB2 but this is where I run into problems.

Code:
# mount /dev/sdb1 /boot
mount: /boot: mount failed: Operation not permitted


Since I can't mount it, naturally installing GRUB2 doesn't work either:

Code:
# grub-install --target=x86_64-efi --efi-directory=/boot
Installing for x86_64-efi platform.
grub-install: error: cannot find a device for /boot (is /dev mounted?).


Where am I going wrong?


Last edited by imieinazwisko on Sat Apr 18, 2020 8:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 45383
Location: 56N 3W

PostPosted: Sun Feb 23, 2020 11:55 am    Post subject: Reply with quote

imieinazwisko,

Do the mount /boot from outside the chroot.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
imieinazwisko
n00b
n00b


Joined: 13 Feb 2020
Posts: 20

PostPosted: Sun Feb 23, 2020 3:37 pm    Post subject: Reply with quote

NeddySeagoon wrote:
imieinazwisko,

Do the mount /boot from outside the chroot.


Thank you. That resolved things to get through the initial setup. I am no facing a new issue though on boot. I am getting a kernel panic. I know from reading that it's common when restoring from a stage 4 if there was a splash screen but I have none. It appears form the kernel panic that *something* is still pointing to the old drive for boot but I don't know what. Here's a small (what I think is relevant) snippet from the boot sequence.

Code:
VFS: Cannot open root device "sdb2" or unknown block (0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:
0800      234431064 sda
   driver sd
    0001            204800         sda1
    0802            234225223   sda2
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)


I see the sda1 and sda2 in there which leads me to believe something is still looking for the old drive. I have double and triple checked the fstab and it does have the correct UUIDs for the new drive.


EDIT: I was playing around with some things and...turns out I am actually booted into the new system but I am thoroughly confused. If I unplug the old drive and boot from the new drive the kernel panic, as stated above, occurs. If the old drive is plugged in and I boot from the new drive then I boot into the new system just fine. It seems there is some kind of reliance on the old drive but I don't know what. I would like to break the reliance so I can wipe the old drive.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15294

PostPosted: Sun Feb 23, 2020 5:09 pm    Post subject: Reply with quote

/etc/fstab is only relevant once you mount root, and that is not happening yet. The kernel panics before that point. Per the kernel's output, it has been told to mount root from /dev/sdb2, probably because the bootloader passed root=/dev/sdb2 on the kernel command line. You need to boot a working environment, edit the bootloader configuration file, and change that to read root=/dev/sda2. Since you are using grub2, I cannot provide specific instructions on how to do that.
Back to top
View user's profile Send private message
imieinazwisko
n00b
n00b


Joined: 13 Feb 2020
Posts: 20

PostPosted: Sun Feb 23, 2020 5:29 pm    Post subject: Reply with quote

Hu wrote:
/etc/fstab is only relevant once you mount root, and that is not happening yet. The kernel panics before that point. Per the kernel's output, it has been told to mount root from /dev/sdb2, probably because the bootloader passed root=/dev/sdb2 on the kernel command line. You need to boot a working environment, edit the bootloader configuration file, and change that to read root=/dev/sda2. Since you are using grub2, I cannot provide specific instructions on how to do that.


I think my edit probably made things a bit confusing. /dev/sdb2 is my new SSD and is where the kernel should be mounting root from and where it is in fact mounting it from. The kernel panic happens when I remove the old SSD, /dev/sda from the computer which does not make sense to me. You are right, my bootloader does correctly pass root=/dev/sdb2 to the kernel and my grub.cfg has no mention of /dev/sda anywhere so there doesn't seem to be any problem but there is some lingering mention of /dev/sda somewhere in the boot process which prevents me form removing the old drive.
Back to top
View user's profile Send private message
C1REX
l33t
l33t


Joined: 02 Jan 2004
Posts: 774
Location: Poland/UK

PostPosted: Sun Feb 23, 2020 5:53 pm    Post subject: Reply with quote

It seems some distros make that mount problem from chroot environment.

I just had the same on ubuntu and no problem from kde neon.
_________________
CLICK HERE to help move gentoo up on distrowatch.

If you like Gentoo you can thank devs here - https://www.gentoo.org/donate/
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 45383
Location: 56N 3W

PostPosted: Sun Feb 23, 2020 5:58 pm    Post subject: Reply with quote

imieinazwisko,

Code:
VFS: Cannot open root device "sdb2" or unknown block (0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:
0800      234431064 sda
   driver sd
    0001            204800         sda1
    0802            234225223   sda2


Your kernel cannot see sdb at all.
The list of block devices above is a complete list of all the block devices available to the boot process,
Further, the unknown block (0,0) suggests that a hardware driver in missing from the kernel.

This suggests that your new SSD is attached to a different controller to the old one so its not seen.
Is your new drive NVMe and the old one SATA?

Sight of the output of
Code:
lspci -nnk
will be useful.

If you want to add/remove block devices, use root=PARTUUID= on the kernel line in grub.cfg
The kernel will search all the PARTUUIDs to find the right one, independent of it being sda, sdb ... whatever.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
imieinazwisko
n00b
n00b


Joined: 13 Feb 2020
Posts: 20

PostPosted: Sun Feb 23, 2020 6:31 pm    Post subject: Reply with quote

NeddySeagoon wrote:
imieinazwisko,

Code:
VFS: Cannot open root device "sdb2" or unknown block (0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:
0800      234431064 sda
   driver sd
    0001            204800         sda1
    0802            234225223   sda2


Your kernel cannot see sdb at all.
The list of block devices above is a complete list of all the block devices available to the boot process,
Further, the unknown block (0,0) suggests that a hardware driver in missing from the kernel.

This suggests that your new SSD is attached to a different controller to the old one so its not seen.
Is your new drive NVMe and the old one SATA?

Sight of the output of
Code:
lspci -nnk
will be useful.

If you want to add/remove block devices, use root=PARTUUID= on the kernel line in grub.cfg
The kernel will search all the PARTUUIDs to find the right one, independent of it being sda, sdb ... whatever.


Both drives are SATA. The new one is connected to a different port on the mobo but swapping those around doesn't change anything. The kernel can see sdb as long as sda is plugged in but when I unplug sda then the kernel can't see sdb.

Below is the output of lspci -nnk. I am going to change /dev/sdb in my grub.cfg to the UUID and see if that makes a difference. I didn't think to make that change.

Code:
# lspci -nnk
00:00.0 Host bridge [0600]: Intel Corporation 4th Gen Core Processor DRAM Controller [8086:0c00] (rev 06)
   Subsystem: Gigabyte Technology Co., Ltd 4th Gen Core Processor DRAM Controller [1458:5000]
   Kernel driver in use: hsw_uncore
00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller [8086:0c01] (rev 06)
   Kernel driver in use: pcieport
00:02.0 VGA compatible controller [0300]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller [8086:0412] (rev 06)
   Subsystem: Gigabyte Technology Co., Ltd Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller [1458:d000]
   Kernel driver in use: i915
00:03.0 Audio device [0403]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller [8086:0c0c] (rev 06)
   Subsystem: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller [8086:2010]
   Kernel driver in use: snd_hda_intel
00:14.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI [8086:8c31] (rev 05)
   Subsystem: Gigabyte Technology Co., Ltd 8 Series/C220 Series Chipset Family USB xHCI [1458:5007]
   Kernel driver in use: xhci_hcd
00:16.0 Communication controller [0780]: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 [8086:8c3a] (rev 04)
   Subsystem: Gigabyte Technology Co., Ltd 8 Series/C220 Series Chipset Family MEI Controller [1458:1c3a]
00:1a.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 [8086:8c2d] (rev 05)
   Subsystem: Gigabyte Technology Co., Ltd 8 Series/C220 Series Chipset Family USB EHCI [1458:5006]
   Kernel driver in use: ehci-pci
00:1b.0 Audio device [0403]: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller [8086:8c20] (rev 05)
   Subsystem: Gigabyte Technology Co., Ltd 8 Series/C220 Series Chipset High Definition Audio Controller [1458:a002]
   Kernel driver in use: snd_hda_intel
00:1c.0 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 [8086:8c10] (rev d5)
   Kernel driver in use: pcieport
00:1c.2 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 [8086:8c14] (rev d5)
   Kernel driver in use: pcieport
00:1d.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 [8086:8c26] (rev 05)
   Subsystem: Gigabyte Technology Co., Ltd 8 Series/C220 Series Chipset Family USB EHCI [1458:5006]
   Kernel driver in use: ehci-pci
00:1f.0 ISA bridge [0601]: Intel Corporation B85 Express LPC Controller [8086:8c50] (rev 05)
   Subsystem: Gigabyte Technology Co., Ltd B85 Express LPC Controller [1458:5001]
00:1f.2 SATA controller [0106]: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] [8086:8c02] (rev 05)
   Subsystem: Gigabyte Technology Co., Ltd 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] [1458:b005]
   Kernel driver in use: ahci
00:1f.3 SMBus [0c05]: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller [8086:8c22] (rev 05)
   Subsystem: Gigabyte Technology Co., Ltd 8 Series/C220 Series Chipset Family SMBus Controller [1458:5001]
   Kernel driver in use: i801_smbus
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] [10de:1380] (rev a2)
   Subsystem: Micro-Star International Co., Ltd. [MSI] GM107 [GeForce GTX 750 Ti] [1462:3102]
   Kernel driver in use: nvidia
   Kernel modules: nvidia_drm, nvidia
01:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:0fbc] (rev a1)
   Subsystem: Micro-Star International Co., Ltd. [MSI] Device [1462:3102]
   Kernel driver in use: snd_hda_intel
03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 0c)
   Subsystem: Gigabyte Technology Co., Ltd Onboard Ethernet [1458:e000]
   Kernel driver in use: r8169
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 45383
Location: 56N 3W

PostPosted: Sun Feb 23, 2020 6:45 pm    Post subject: Reply with quote

imieinazwisko,

HDD /dev entries are allocated in the order that drives are detected, not according to the port they are connected to.
This means that if your remove /dev/sda, then what was /dev/sdb is now /dev/sda so root=/dev/sdb2 fails as sdb no longer exists.

Indeed you only have
Code:
00:1f.2 SATA controller [0106]: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] [8086:8c02] (rev 05)
   Subsystem: Gigabyte Technology Co., Ltd 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] [1458:b005]
   Kernel driver in use: ahci
the one controller.

Write your kernel command line using PARTUUID and /etc/fstab using the filesystem UUID asd you can move things around as much as you like.
The PARTUUID is a property of a partition. The kernel understands that.
UUID is a property of the filesystem. Understand that requires the mount command.
Code:
blkid
will tell you what you want to know,
Code:
$ blkid
...
/dev/sdd6: UUID="9657e667-5b60-f6a3-0391-65e6dcf662fa" TYPE="linux_raid_member" PARTUUID="0553caf4-06"
/dev/sde1: UUID="c400b18c-0210-4338-a0fd-f437ecbaaf99" BLOCK_SIZE="1024" TYPE="ext4" PARTLABEL="ext4" PARTUUID="150e6ef1-7ba8-409c-9c3f-dbdecdc9f18b"
...

Note that PARTUUID= on MSDos partition tables are faked. The kernel still understands them.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
imieinazwisko
n00b
n00b


Joined: 13 Feb 2020
Posts: 20

PostPosted: Sun Feb 23, 2020 10:55 pm    Post subject: Reply with quote

NeddySeagoon wrote:
imieinazwisko,

HDD /dev entries are allocated in the order that drives are detected, not according to the port they are connected to.
This means that if your remove /dev/sda, then what was /dev/sdb is now /dev/sda so root=/dev/sdb2 fails as sdb no longer exists.


I've been using laptops with one drive too long...I can't believe I forgot that. Thanks for recognizing it and pointing it out!

NeddySeagoon wrote:
Write your kernel command line using PARTUUID and /etc/fstab using the filesystem UUID asd you can move things around as much as you like.
The PARTUUID is a property of a partition. The kernel understands that.
UUID is a property of the filesystem. Understand that requires the mount command.


My fstab has always had the UUID listed for that very reason. The grub.cfg has not though. Per the handbook the grub.cfg is automatically generated via:
Code:
grub-mkconfig -o /boot/grub/grub.cfg

And the auto generation uses the /dev/sda notation. I can open up the grub.cfg and manually change all the /dev/sda1 and /dev/sda2 to their PARTUUID but do you know what the syntax is? For example this line from my grub.cfg:
Code:
linux   /vmlinuz-4.19.97-gentoo root=/dev/sda2 ro


Do I just replace
Code:
root=/dev/sda2 ro
with
Code:
root=PARTUUID ro
or is there some sort of specifier I need to add in there to tell grub that this is a PARTUUID?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15294

PostPosted: Mon Feb 24, 2020 1:29 am    Post subject: Reply with quote

I believe you want root=PARTUUID=PARTUUID. Copy the bold part literally. Rewrite the italic part to the UUID of your partition. When the kernel sees a device name that starts with the literal text PARTUUID=, that advises it to switch to UUID matching instead of treating the input as an actual device path. Similar rules apply for PARTLABEL, among other methods.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7405

PostPosted: Mon Feb 24, 2020 4:18 am    Post subject: Reply with quote

imieinazwisko wrote:
The kernel panic happens when I remove the old SSD, /dev/sda from the computer which does not make sense to me.

It makes totally sense, as soon as "old SSD" is removed, there's no sda, and your new SSD become the new sda
Back to top
View user's profile Send private message
imieinazwisko
n00b
n00b


Joined: 13 Feb 2020
Posts: 20

PostPosted: Wed Feb 26, 2020 2:30 am    Post subject: Reply with quote

Thanks everyone for your help. I think we can mark this thread as resolved!
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