Announcement

Collapse
No announcement yet.

Unable to Boot from GRUB After Moving OS to New SSD?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [GRUB] Unable to Boot from GRUB After Moving OS to New SSD?

    So I recently switched to a new SSD using btrfs snapshots, but I haven't been able to boot from grub.

    I have the @ and @home subvolumes on the SSD and set their ro values to false. Grub is still expecting the old hard drive boot partitions though. It comes up with an error (Something like I can't find hd0, 2) which would be /dev/sda2. I know that this is outdated because the new SSD is /dev/sdc.

    Here is my layout:
    /dev/sdc1 EFI Partition (Installed using ubiquity)
    /dev/sdc2 @ and @home (From External HDD)

    Boot-Repair (Program) didn't seem to work, I'm also having some issues with a tutorial like (https://howtoubuntu.org/how-to-repai...ubuntu-live-cd), notably that it doesn't seem to work. I've obviously replaced the /mnt in the tutorial with /mnt/@ where appropriate.

    Here is my progress on that
    Code:
    kubuntu@kubuntu:/$ lsblk
    NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    loop0    7:0    0   1.7G  1 loop /rofs
    sda      8:0    0 931.5G  0 disk 
    └─sda1   8:1    0 931.5G  0 part 
    sdb      8:16   0  22.4G  0 disk 
    sdc      8:32   0 465.8G  0 disk 
    ├─sdc1   8:33   0   512M  0 part 
    └─sdc2   8:34   0 465.3G  0 part /mnt
    sdd      8:48   0 111.8G  0 disk 
    └─sdd1   8:49   0 111.8G  0 part 
    sde      8:64   1   7.5G  0 disk 
    └─sde1   8:65   1   7.5G  0 part 
    sdf      8:80   1  14.9G  0 disk /cdrom
    ├─sdf1   8:81   1   1.8G  0 part 
    └─sdf2   8:82   1   2.4M  0 part 
    sr0     11:0    1  1024M  0 rom 
    
    kubuntu@kubuntu:/$ sudo mount /dev/sdc2 /mnt
    kubuntu@kubuntu:/$ sudo mount --bind /dev /mnt/@/dev/                                                                                                                              
    kubuntu@kubuntu:/$ sudo mount --bind /sys /mnt/@/sys/
    kubuntu@kubuntu:/$ sudo mount --bind /proc /mnt/@/proc/                                                                                                                            
    kubuntu@kubuntu:/$ sudo mount --bind /dev/pts /mnt/@/dev/pts
    kubuntu@kubuntu:/$ sudo mount /dev/sdc1 /mnt/@/boot/efi/
    kubuntu@kubuntu:/$ sudo chroot /mnt/@
    root@kubuntu:/# grub-install /dev/sdc
    Installing for x86_64-efi platform.
    grub-install: error: cannot find a device for /boot/grub (is /dev mounted?).
    root@kubuntu:/# update-grub
    /usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
    I'm not sure what to do from here. Any help would be appreciated

    EDIT 0:
    Here is my fstab & the sudo blkid if that's useful

    Blkid:
    Code:
    /dev/sda1: LABEL="Convergent Refuge" UUID="bae62e15-46d2-4aa4-84de-5f8bdd93c3e2" UUID_SUB="55c809a3-a971-4736-94ef-a11e7f1a6172" TYPE="btrfs" PARTLABEL="Convergent Refuge" PARTUUID="9c3a4912-6cd5-4155-a78f-6356f1acb874"
    /dev/sdc1: LABEL="L_ARK_EFI" UUID="423F-051C" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="78554a15-d0ad-4253-870d-2e13f9d5c1d8"
    /dev/sdc2: UUID="bbeef1b6-b012-4354-bba4-98e1ef547cc4" UUID_SUB="99297613-051d-4c18-9080-eebd079bcb09" TYPE="btrfs" PARTLABEL="Lesser Ark" PARTUUID="611080a8-55e8-4523-9128-bb5cc31c7750"
    /dev/sdd1: LABEL="ELYSIUM" UUID="0f834b1e-78a4-4b8b-9528-3b6c3f5ae37b" UUID_SUB="a84c1c8f-8484-404d-b420-777c6b1f0da9" TYPE="btrfs" PARTLABEL="ELYSIUM" PARTUUID="9cc2500a-68ea-4a2e-ba3d-17464271170d"
    /dev/sde1: LABEL="CLONEZILLA" UUID="4549-BFFB" TYPE="vfat" PARTLABEL="CloneZilla" PARTUUID="ccad6f55-65bb-4cc0-8003-df98ae9edb62"
    /dev/loop0: TYPE="squashfs"
    /dev/sdb: PTUUID="5f43f34d-52f6-4eeb-acd7-8dcc866c752d" PTTYPE="gpt"
    /dev/sdf1: UUID="2019-02-10-00-41-52-00" LABEL="Kubuntu 18.04.2 LTS amd64" TYPE="iso9660" PTUUID="003f6940" PTTYPE="dos" PARTUUID="003f6940-01"
    /dev/sdf2: SEC_TYPE="msdos" UUID="5655-3E5A" TYPE="vfat" PARTUUID="003f6940-02"
    Fstab:
    Code:
    #Lesser Ark
    UUID=bbeef1b6-b012-4354-bba4-98e1ef547cc4    /            btrfs    defaults,noatime,compress=lzo,ssd,subvol=@        0    1
    #UUID=423F-051C                               /boot/efi    vfat     umask=0077               0    1
    UUID=bbeef1b6-b012-4354-bba4-98e1ef547cc4    /home        btrfs    defaults,noatime,compress=zstd,ssd,subvol=@home    0    2
    #UUID=45f9fe6b-ae81-47c7-bbd7-f9ca4ac66060    none         swap     sw                       0    0
    UUID=423F-051C    /boot/efi    vfat    defaults,ssd,noatime,compress=lzo    0    1
    
    #ELYSIUM
    UUID=0f834b1e-78a4-4b8b-9528-3b6c3f5ae37b /media/sarah/ELYSIUM btrfs defaults,noauto,space_cache,compress=zstd,autodefrag,subvol=EternalFields    0    0
    
    #SENTINEL
    UUID=38e88d7b-d527-4784-8060-cfa456c27b13 /media/sarah/SENTINEL btrfs defaults,noauto,space_cache,compress=zstd 0 0
    
    #Convergent Refuge
    UUID=bae62e15-46d2-4aa4-84de-5f8bdd93c3e2 /media/sarah/ConvergentRefuge btrfs defaults,noatime,space_cache,compress=zstd 0 0
    Last edited by PhysicistSarah; Mar 16, 2019, 02:43 PM.

    #2
    The UUID is different I suspect. Look at grub.cfg and check the UUIDs against your boot partition(s).

    What I do when I move an OS for booting is manually edit grub.cfg and change the UUID of the boot OS, then boot to it, then run update-grub to let grub fix all the others automatically.

    Please Read Me

    Comment


      #3
      Also, using grub-install with those mounts like that you would have to explicitly tell it where /boot/grub is with the --boot-directory= option.

      Please Read Me

      Comment


        #4
        Originally posted by oshunluvr View Post
        The UUID is different I suspect. Look at grub.cfg and check the UUIDs against your boot partition(s).

        What I do when I move an OS for booting is manually edit grub.cfg and change the UUID of the boot OS, then boot to it, then run update-grub to let grub fix all the others automatically.
        I used gedit's find and replace tool to replace all instances of the old UUID with the new one for /dev/sdc2. I'm going to reboot off of the liveUSB and see what happens.

        EDIT 0:

        The system booted into emergency mode. I might have an invalid fstab. Here are the logs (Just the tail end):
        Code:
        Mar 16 17:11:49 ConvergentRefuge systemd[1]: cryptsetup.target: Job cryptsetup.target/start failed with result 'dependency'.
        Mar 16 17:11:49 ConvergentRefuge systemd[1]: Startup finished in 10.754s (firmware) + 2.488s (loader) + 38.277s (kernel) + 1min 31.391s (userspace) = 2min 22.911s.
        -- Subject: System start-up is now complete
        -- Defined-By: systemd
        -- Support: http://www.ubuntu.com/support
        -- 
        -- All system services necessary queued for starting at boot have been
        -- started. Note that this does not mean that the machine is now idle as services
        -- might still be busy with completing start-up.
        -- 
        -- Kernel start-up required 38277546 microseconds.
        -- 
        -- Initial RAM disk start-up required INITRD_USEC microseconds.
        -- 
        -- Userspace start-up required 91391547 microseconds.
        Mar 16 17:11:49 ConvergentRefuge systemd[1]: systemd-cryptsetup@cryptswap1.service: Job systemd-cryptsetup@cryptswap1.service/start failed with result 'dependency'.
        Mar 16 17:11:49 ConvergentRefuge systemd[1]: dev-disk-by\x2duuid-b8fef08f\x2dc8a9\x2d49f9\x2d9cc7\x2dabbd362e4967.device: Job dev-disk-by\x2duuid-b8fef08f\x2dc8a9\x2d49f9\x2d9cc7\x2dabbd362e4967.device/start failed with result 'timeout'.
        Last edited by PhysicistSarah; Mar 16, 2019, 03:22 PM.

        Comment


          #5
          Was any partition on the OS before you moved it to the new SSD, encrypted?
          Using Kubuntu Linux since March 23, 2007
          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

          Comment


            #6
            (The last time I looked at boot repair it had not been updated for EFI.)

            With btrfs I'm not sure that chroot stuff applies. The chroot is not needed any more as it addresses a weakness in grub-install that is now fixed with --xxx-directory options.

            First one needs to have the EFI and grub boot directories mounted somewhere. The standard places are /boot/efi and /boot/grub but if you're booted from a Live USB, or another install, the running /boot won't be right. Maybe
            Code:
            sudo mkdir /mnt/efi /mnt/boot
            sudo mount /dev/sdc1 /mnt/efi
            sudo mount /dev/sdc2 /mnt/boot -o subvol=@
            Then, grub-install can be told what to do:
            Code:
            sudo grub-install --boot-directory=/mnt/boot/boot --efi-directory=/mnt/efi
            The UEFI has to be told to boot to the SSD, but you've already done that I think. The mount points in /mnt are only temporary, grub-install works out what grub will think the "boot/grub" is on and writes it in to the EFI/ubuntu/grubx64.efi image.

            It can be help understanding to run sudo efibootmgr -v to see what the UEFI has been told what to do, but its idea of device names is yet another scheme. grub-install should set the entry properly.
            Regards, John Little

            Comment


              #7
              Originally posted by Snowhog View Post
              Was any partition on the OS before you moved it to the new SSD, encrypted?
              There were 2 partitions on the SSD.
              /dev/sdc1 This is the EFI partition I made before the install. It was created by Ubiquity
              /dev/sda2 Contains @ and @home, originated from external SSD snapshots.

              There is no LVM or encryption of any kind. That I set up.

              Comment


                #8
                I used the commands, but it gave a few errors:

                Code:
                kubuntu@kubuntu:~$ ls /mnt
                kubuntu@kubuntu:~$ sudo mkdir /mnt/efi /mnt/boot
                kubuntu@kubuntu:~$ sudo mount /dev/sdc1 /mnt/efi
                kubuntu@kubuntu:~$ sudo mount /dev/sdc2 /mnt/boot -o subvol=@
                kubuntu@kubuntu:~$ sudo grub-install --boot-directory=/mnt/boot/boot --efi-directory=/mnt/efi
                Installing for i386-pc platform.
                grub-install: error: install device isn't specified.
                After giving it /dev/sdc:
                Code:
                kubuntu@kubuntu:~$ sudo grub-install --boot-directory=/mnt/boot/boot --efi-directory=/mnt/efi /dev/sdc
                Installing for i386-pc platform.
                grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
                grub-install: error: filesystem `btrfs' doesn't support blocklists.

                Comment


                  #9
                  Originally posted by PhysicistSarah View Post
                  Installing for i386-pc platform.
                  ...no BIOS Boot Partition...
                  That's not right, it's attempting a BIOS install, not a UEFI one.

                  Is the computer booted in BIOS mode? If booting from USB, some motherboards present two devices, one for a UEFI boot and another for a BIOS boot. I don't know if a UEFI install is possible from a BIOS boot.
                  Regards, John Little

                  Comment


                    #10
                    I don't know if a UEFI install is possible from a BIOS boot.
                    I don't believe it is possible. If you want a UEFI installation (of an OS), you must boot in UEFI mode.
                    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                    Comment


                      #11
                      I'm not entirely sure what this means. I have secure boot disabled if this is what is being discussed.

                      I don't know of any BIOS mode or UEFI mode.

                      When the prompt commes up after shutdown I just press ESC and go to boot from devices and choose the live USB.

                      Comment


                        #12
                        Aparrantly, the wrong grub package was being used.

                        I ran
                        Code:
                        sudo apt-get install --reinstall grub-efi
                        and ran
                        Code:
                        kubuntu@kubuntu:/mnt$ sudo grub-install --boot-directory=/mnt/sdc2/@ --efi-directory=/mnt/sdc2/@/boot/efi/
                        Installing for x86_64-efi platform.
                        Installation finished. No error reported.
                        And it successfully ran the command.

                        Comment


                          #13
                          Alright, progress!

                          I messed around with fstab and the system booted! I was able to log in and everything is fine... mostly. I ran sudo update-grub, but grub still doesn't boot the OS properly. I have to manually set root then prefix and use normal to get to a menu where I can boot from.

                          Any suggestions as to what I did wrong in fstab or how to remedy the grub situation?

                          Comment


                            #14
                            Originally posted by PhysicistSarah View Post
                            sudo grub-install --boot-directory=/mnt/sdc2/@ --efi-directory=/mnt/sdc2/@/boot/efi/
                            I don't understand the mounts you've got there, I'm guessing /dev/sdc2 is mounted on /mnt/sdc2, without using a subvol, and then /dev/sdc1 on /mnt/sdc2/@/boot/efi. Cool that it can be done that way, it's a bit simpler than my method.

                            However, I'd expect --boot-directory=/mnt/sdc2/boot
                            Regards, John Little

                            Comment


                              #15
                              That's a good point. I'll try that.

                              EDIT 0: I replicated the setup, and got this:
                              Code:
                              sarah@ConvergentRefuge:/mnt/sdc2/@$ sudo grub-install --boot-directory=/mnt/sdc2/@ --efi-directory=/mnt/sdc2/@/boot
                              Installing for x86_64-efi platform.
                              grub-install: error: /mnt/sdc2/@/boot doesn't look like an EFI partition.
                              
                              sarah@ConvergentRefuge:/mnt/sdc2/@$ sudo grub-install --boot-directory=/mnt/sdc2/@ --efi-directory=/mnt/sdc2/@/boot/efi
                              Installing for x86_64-efi platform.
                              Installation finished. No error reported.
                              Last edited by PhysicistSarah; Mar 17, 2019, 11:08 AM.

                              Comment

                              Working...
                              X