5

I'm running kubuntu 16.04. I messed up UEFI (long ago), so it boots without it, but my Windows 10 partition won't boot. I don't care about that at the moment.

root is 30GB on sda4 home is 50GB on sda5.

All that works fine.

I copied root to root2 and home to home2 using rsync. I want to use these new partitions to experiment with upgrading kubuntu while leaving my main system intact.

Later, I want to make another copy of root and home just for backup (in other partitions I have set aside) and I will want that to be bootable as well.

root2 is 30GB on sda6 and home2 is 50GB on sda7.

I modified /etc/fstab on root2 to reflect the new partition LABELs.

When I try to boot using root2 (from my grub menu), I get into an ash shell from busybox and have to reboot to get out of it, so I did something wrong in grub or Linux and it looks like it can't find where or what to boot.

It displays some sort of traceback, but I don't understand it and I don't see it complaining about anything.

I asked almost the same question a few years ago, but never figured it out.

It was suggested in that question that I needed to chroot into the new root partition and run update-grub because I don't have a separate boot partition. I gave that a quick try and found that I don't know how to do that successfully.

What steps should I take to resolve this?


Details:

Root entry in grub (displayed by grub-customizer)

(This is the part that works as is.)

recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt4'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4  a184c235-bbb7-4e0b-86ab-ab8f5d4a2941
else
  search --no-floppy --fs-uuid --set=root a184c235-bbb7-4e0b-86ab-ab8f5d4a2941
fi
        linux   /boot/vmlinuz-4.4.0-112-generic root=UUID=a184c235-bbb7-4e0b-86ab-ab8f5d4a2941 ro  quiet splash $vt_handoff
initrd  /boot/initrd.img-4.4.0-112-generic

/etc/fstab

bigbird@sananda:/etc$ cat fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda4 during installation
##UUID=a184c235-bbb7-4e0b-86ab-ab8f5d4a2941 /               ext4    errors=remount-ro 0       1
# /home was on /dev/sda5 during installation
##UUID=c81a6925-0631-484c-88d5-245e2e042652 /home           ext4    defaults        0       2
# swap was on /dev/sda10 during installation
##UUID=3ef9528c-1927-40fd-8729-33506d440101 none            swap    sw              0       0
## automount dataspace - JJP
##UUID=eb1774a1-2a44-4f03-8562-26b6339170f0 /media/dataspace  ext4    auto,rw,suid,exec,async,atime 0 1

LABEL=root /               ext4    errors=remount-ro 0       1
# /home was on /dev/sda5 during installation
LABEL=home /home           ext4    defaults        0       2
# swap was on /dev/sda10 during installation
UUID=3ef9528c-1927-40fd-8729-33506d440101 none            swap    sw              0       0
## automount dataspace - JJP
LABEL=dataspace /media/dataspace  ext4    auto,rw,suid,exec,async,atime 0 1

New stuff:

(I did a kernel update in root after I copied it to root2. That's why the versions here are slightly older. Once it boots, I'll fix that.)

insmod part_gpt
insmod ext2
set root='hd0,gpt6'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  caf3cb64-a51a-4298-bf34-5f97fa3b1308
else
  search --no-floppy --fs-uuid --set=root caf3cb64-a51a-4298-bf34-5f97fa3b1308
fi
linux /boot/vmlinuz-4.4.0-104-generic root=UUID=caf3cb64-a51a-4298-bf34-5f97fa3b1308 ro quiet splash $vt_handoff
initrd /boot/initrd.img-4.4.0-104-generic

/etc/fstab (on sda6)

bigbird@sananda:/media/work/etc$ cat fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / on /dev/sda6
##UUID=caf3cb64-a51a-4298-bf34-5f97fa3b1308 /               ext4    errors=remount-ro 0       1
# /home on /dev/sda7
##UUID=a75b6be1-5336-4eaf-92db-da1393b3d412 /home           ext4    defaults        0       2
# swap was on /dev/sda10 during installation
##UUID=3ef9528c-1927-40fd-8729-33506d440101 none            swap    sw              0       0
## automount dataspace - JJP
##UUID=eb1774a1-2a44-4f03-8562-26b6339170f0 /media/dataspace  ext4    auto,rw,suid,exec,async,atime 0 1

LABEL=root2 /               ext4    errors=remount-ro 0       1
# /home on /dev/sda7
LABEL=home2 /home           ext4    defaults        0       2
# swap was on /dev/sda10 during installation
UUID=3ef9528c-1927-40fd-8729-33506d440101 none            swap    sw              0       0
## automount dataspace - JJP
LABEL=dataspace /media/dataspace  ext4    auto,rw,suid,exec,async,atime 0 1
bigbird@sananda:/media/work/etc$

bigbird@sananda:~/pq$ ls -l /dev/disk/by-label
total 0
lrwxrwxrwx 1 root root 11 Jan 11 21:43 dataspace -> ../../sda12
lrwxrwxrwx 1 root root 10 Jan 11 21:43 ESP -> ../../sda1
lrwxrwxrwx 1 root root 10 Jan 11 21:43 home -> ../../sda5
lrwxrwxrwx 1 root root 10 Jan 11 21:43 home2 -> ../../sda7
lrwxrwxrwx 1 root root 10 Jan 11 21:43 home_bak -> ../../sda9
lrwxrwxrwx 1 root root 10 Jan 11 21:43 root -> ../../sda4
lrwxrwxrwx 1 root root 10 Jan 11 21:43 root2 -> ../../sda6
lrwxrwxrwx 1 root root 10 Jan 11 21:43 root_bak -> ../../sda8
lrwxrwxrwx 1 root root 11 Jan 11 21:43 winbak -> ../../sda11
lrwxrwxrwx 1 root root 10 Jan 11 21:43 Windows10 -> ../../sda3
bigbird@sananda:~/pq$

bigbird@sananda:~/pq$ ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 11 Jan 11 21:23 3ef9528c-1927-40fd-8729-33506d440101 -> ../../sda10
lrwxrwxrwx 1 root root 10 Jan 11 21:23 4630B96A30B9619B -> ../../sda3
lrwxrwxrwx 1 root root 10 Jan 11 21:23 52B7-E591 -> ../../sda1
lrwxrwxrwx 1 root root 11 Jan 11 21:23 7E8C3007301FA4AD -> ../../sda11
lrwxrwxrwx 1 root root 10 Jan 11 21:23 8f034ecf-5d98-4753-80d1-8099cf3bb641 -> ../../sda9
lrwxrwxrwx 1 root root 10 Jan 11 21:23 a184c235-bbb7-4e0b-86ab-ab8f5d4a2941 -> ../../sda4
lrwxrwxrwx 1 root root 10 Jan 11 21:23 a75b6be1-5336-4eaf-92db-da1393b3d412 -> ../../sda7
lrwxrwxrwx 1 root root 10 Jan 11 21:23 c81a6925-0631-484c-88d5-245e2e042652 -> ../../sda5
lrwxrwxrwx 1 root root 10 Jan 11 21:23 caf3cb64-a51a-4298-bf34-5f97fa3b1308 -> ../../sda6
lrwxrwxrwx 1 root root 10 Jan 11 21:23 cce6b9f2-1dcc-4a53-b15b-73c595c2f6f5 -> ../../sda8
lrwxrwxrwx 1 root root 11 Jan 11 21:23 eb1774a1-2a44-4f03-8562-26b6339170f0 -> ../../sda12

2 Answers 2

6
+100

Modify /boot/grub/grub.cfg

You can modify the boot configuration file /boot/grub/grub.cfg manually (without getting into chroot). I have done it and I know that it works.

Modfify the file to match the references to the partitions (the UUIDs of the root partition) corresponding to what you did with /etc/fstab. I am not sure that you can use labels, so I suggest that you list the UUIDs with

sudo blkid

and use the values that you find for the second version of root partition.

Get a second drive of at least the same size

You may find it easier to get a second drive of at least the same size and clone from original drive to this second drive. 'Clone the whole drive'. Then you need not modify anything, but you should not boot the computer from any of these drives, when they are both connected.

Download a Clonezilla iso file, create a live drive (USB pendrive or DVD disk), boot from it and clone.

Afterwards you can use the second drive in an external box for backup purposes (using whatever backup method/tool that you want).

20
  • Great answer! That's what I love about Stack Overflow: giving an answer to exactly the asker's question, then offering advice for how to do the same thing better. (Especially the part about using the disk for backups later on) Feb 24, 2018 at 23:38
  • +1 for the KISS approach "Get a second drive of at least the same size"
    – Elder Geek
    Feb 25, 2018 at 17:03
  • Unfortunately, I have a notebook and booting from an external drive that might get physically disconnected during operation is not an attractiiipve proposition. I keep hearing good things about clonezilla, but the last time I tried it (a long time ago), it didn't seem that easy to use.
    – Joe
    Feb 26, 2018 at 7:13
  • So, essentially, you're saying that my approach didn't miss anything, just something in one of the steps I took is wrong. I used grub-customizer to do exactly what you recommend, but it didn't work for some reason. That's why I included so much grub detail. I started out with just UUIDs and no LABELS. I still ended up in initramfs/ash with nowhere to go.
    – Joe
    Feb 26, 2018 at 7:21
  • You can but need not boot from an external drive (except during the cloning operation, but that is only an alternative method). Is it possible for you to unplug the internal drive (in order to replace it with a cloned copy)? I have been using Clonezilla during several years, and I find it quite useful, but I understand from your answer, that you prefer to stay within the internal drive. I think it will work to modify /boot/grub/grub.cfg unless something has been damaged along the road.
    – sudodus
    Feb 26, 2018 at 7:29
2

Rather than copying OS install it

I would install Kubuntu to sda6 rather than copying sda4 to sda6 and patching things here and there. The advantage is grub will automatically setup the triple boot for you.

After OS installation copy the package list and reinstall packages. There are a few Q&A's describing how to automate the process:

After automatic installation of packages then copy sda5 (/home) over top of sda7 (/home). If you did this before package installation some data / configurations files could be overwritten.

As far as UEFI being broken you could post that as a separate question.

2
  • A clean install takes me over two weeks of clock time to put everything back the way I want it (if I can remember what I did). The whole point of this question is to avoid having to do that. I appreciate your links. I rolled my own package restore script the last time I did a new clean install on my previous notebook.
    – Joe
    Feb 28, 2018 at 2:59
  • I like your "two weeks of clock time" unit of measure. An interesting contrast to "man hours". I have a hard time remember what I did to so I have a spreadsheet that goes out and catalogs everything along with running commands through shell interface. Helpful counter-balance to my bad memory. Feb 28, 2018 at 3:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .