I tried again and still no menu. It seems to be taking longer to boot so maybe that suggests something?
Announcement
Collapse
No announcement yet.
REVISITING - More BTRFS fun Multibooting to subvolumes - FIXING GRUB
Collapse
This topic is closed.
X
X
-
Just to remind users and devs that Ubuntu and its flavors have a long way to go to be as usr friendly as they should be.
http://www.kubuntu.org/getkubuntu
- Top
- Bottom
-
I wonder if the menu is tying to display, but the monitor isn't being setup correctly such that the data never displays. If this is the the case then that would explain why it is taking longer to boot. Maybe it times out and defaults to lubuntu 17.04.Just to remind users and devs that Ubuntu and its flavors have a long way to go to be as usr friendly as they should be.
http://www.kubuntu.org/getkubuntu
- Top
- Bottom
Comment
-
Verify that the 40_custom file in /etc/grub.d is executable. If it isn’t, make it so and re-run update-grub.Windows no longer obstructs my view.
Using Kubuntu Linux since March 23, 2007.
"It is a capital mistake to theorize before one has data." - Sherlock Holmes
- Top
- Bottom
Comment
-
Originally posted by Snowhog View PostVerify that the 40_custom file in /etc/grub.d is executable. If it isn’t, make it so and re-run update-grub.Just to remind users and devs that Ubuntu and its flavors have a long way to go to be as usr friendly as they should be.
http://www.kubuntu.org/getkubuntu
- Top
- Bottom
Comment
-
Originally posted by oshunluvr View PostSolution 3:
Make a bootable grub partition (another multi-disk solution):This is my method but it's not the easiest to initially set up. I have more than one drive on my system, so I created and mounted a 128MB EXT2 partition on one of them (actually two of them so I have a boot-able backup drive). I copied /boot/grub from one install to this partition. Then ran grub-install with the --root-directory option pointing at the grub partition. Whenever I install a distro, I tell it to boot from sdc, but my boot drive is sda (sdb as backup) so my grub is never messed with.
Now regardless of deleting installs, I can always boot. I manually edit the grub.cfg on this bootable partition and add and subtract installs as I do them - using the same menuentry as you would in 40_custom. Here's the tail (the part after the header info) of my grub.cfg from that partition:
Code:[FONT=monospace][COLOR=#000000]### BEGIN Custom menu ### [/COLOR] menuentry 'KDE Neon' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@KDEneon/boot/grub/grub.cfg } menuentry 'KDE Neon - new' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root fcc94981-05e4-4846-92e7-87bf9885178d configfile /@KDEneon_new/boot/grub/grub.cfg } menuentry 'Kubuntu 16.04' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Kubuntu_16_04/boot/grub/grub.cfg } menuentry 'Ubuntu 16.04' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Ubuntu_16_04/boot/grub/grub.cfg } menuentry 'Manjaro free' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Manjaro_free/boot/grub/grub.cfg } menuentry 'Manjaro nonfree' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Manjaro_nonfree/boot/grub/grub.cfg } menuentry 'Memory test (memtest86+)' { insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462 knetbsd /boot/memtest86+.elf } menuentry 'Memory test (memtest86+, serial console 115200)' { insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462 linux16 /boot/memtest86+.bin console=ttyS0,115200n8 } menuentry 'KDEneon ISO' { set isofile="/neon-useredition-20170608-2351-amd64.iso" loopback loop (hd0,2)$isofile linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject initrd (loop)/casper/initrd.lz } ### END Custom menu### [/FONT]
[#]btrfs[/#] [#]grub[/#] [#]multiboot[/#]
In my case, the partitions are as follows:
/dev/sda1 SYSTEM
/dev/sda2 Windows10
/dev/sda5 btrfs
/dev/sda6 swap
Partitions sda1 / sda2 are primary partitions, and sda5 / sda6 are logical paritions.
I want that booting partition is not modified after kernel upgrade of every single Linux installation in subvolumes.
Therefore I need to add another partition for bootable grub.
However I have the following questions:
1. Is it correct that the bootable grub partition is not mounted in any Linux installation?
2. What do you mean with "Whenever I install a distro, I tell it to boot from sdc, but my boot drive is sda [...]"? Is sdc your BTRFS partition/disk?
3. What should I tell the installer to boot from as I have only one disk?
THX
- Top
- Bottom
Comment
-
Hey, glad you're interested in this. It works great for me. grub uses about 9MB of a file system to hold it's files so you don't need much room. I made my grub boot partitions 512MB just so I could have enough room for background images or extra fonts. In your case, I assume you have no free space available on your drive.
Is your first partition labeled SYSTEM is a Windows partition?
Are you using grub to boot now or the Windows boot loader? - I assume you're using GRUB.
Is Linux (Kubuntu) installed to sda5 - the btrfs partition?
The first thing you need to do is to free up a little space for the grub partition. Since you still have one primary partition available, I suggest you shrink the Windows 10 partition 128-512MB using a Windows tool and reboot into Windows a couple times to insure it works. Then use the free space to make a new primary partition to hold the grub boot files.
To answer your questions:
1. Is it correct that the bootable grub partition is not mounted in any Linux installation?
Not by default. I have it in my fstab with the "noauto" option so I can more easily mount it when I need to edit grub.cfg
2. What do you mean with "Whenever I install a distro, I tell it to boot from sdc, but my boot drive is sda [...]"? Is sdc your BTRFS partition/disk?
No, sdc is another disk (currently 4 on my system) that I do't normally boot from.
3. What should I tell the installer to boot from as I have only one disk?
In order to get all the working files and a using grub.cfg for each distro you have installed, you need to let the installer "install" grub but you don't want it over-riding your dedicated grub install. To solve this, I just tell the installer to use sdc as the boot disk, even though I never boot from it. That way grub runs it's full install and creates all it files but doesn't disturb the grub I actually boot from. In a single disk system, you can usually tell the installer to install grub to a partition instead of the disk. This has the same effect.
Some installers will allow you to install without installing grub at all, but then a grub.cfg isn't created os you have to manually create the grub.cfg entry, which can be a bit tricky compared to just using the grub.cfg automatically created by each install within itself.
In the event you run into an installer that requires you to install grub to sda, you would have to manually restore your preferred grub boot by re-installing grub with the --boot-directory option pointed at your mounted grub partition. However, this is also the method you would use to upgrade grub to a newer version is one becomes available - simply mount the grub partition, run grub-install with the -boot-directory option and grub is ungraded.
The amount of manual editing of grub.cfg you will have to do will depend on how you work and how much you change your setup. In my case, I rename my btrfs subvolumes to the name of the installation distro so I can keep track of which is which. This is what my btrfs file system looks like at the root level:
Code:[FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ ll /subvol/[/COLOR] total 4 drwxr-xr-x 1 root root 600 Nov 16 03:00 [COLOR=#5454FF][B].[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 252 Nov 9 14:53 [COLOR=#5454FF][B]..[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 252 Nov 9 14:53 [COLOR=#5454FF][B]@KDEneon[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 252 Nov 14 02:00 [COLOR=#5454FF][B]@KDEneon_171114[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 252 Nov 15 02:00 [COLOR=#5454FF][B]@KDEneon_171115[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 252 Nov 16 02:00 [COLOR=#5454FF][B]@KDEneon_171116[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 48 Sep 6 16:46 [COLOR=#5454FF][B]@KDEneon_home[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 48 Nov 14 03:00 [COLOR=#5454FF][B]@KDEneon_home_171114[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 48 Nov 15 03:00 [COLOR=#5454FF][B]@KDEneon_home_171115[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 48 Nov 16 03:00 [COLOR=#5454FF][B]@KDEneon_home_171116[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 196 Jun 13 16:49 [COLOR=#5454FF][B]@KDEneon_new[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 12 Jun 13 16:41 [COLOR=#5454FF][B]@KDEneon_new_home[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 286 Nov 8 14:59 [COLOR=#5454FF][B]@KDEneon_save[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 262 Dec 13 2016 [COLOR=#5454FF][B]@Kubuntu_16_04[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 32 Dec 22 2016 [COLOR=#5454FF][B]@Kubuntu_16_04_home[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 282 Jun 27 09:31 [COLOR=#5454FF][B]@Manjaro_free[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 12 Jun 11 08:11 [COLOR=#5454FF][B]@Manjaro_free_home[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 216 Nov 9 14:06 [COLOR=#5454FF][B]@Manjaro_nonfree[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 12 Jun 10 11:49 [COLOR=#5454FF][B]@Manjaro_nonfree_home[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 234 Jun 13 17:21 [COLOR=#5454FF][B]@Ubuntu_16_04[/B][/COLOR][COLOR=#000000]/[/COLOR] drwxr-xr-x 1 root root 12 Jun 13 16:14 [COLOR=#5454FF][B]@Ubuntu_16_04_home[/B][/COLOR][COLOR=#000000]/[/COLOR] [/FONT]
Code:[FONT=monospace][COLOR=#000000]### END /etc/grub.d/05_debian_theme ###[/COLOR] ### BEGIN Custom menu ### menuentry 'KDE Neon' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@KDEneon/boot/grub/grub.cfg } menuentry 'KDE Neon - new' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@KDEneon_previous/boot/grub/grub.cfg } menuentry 'Kubuntu 16.04' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Kubuntu_16_04/boot/grub/grub.cfg } menuentry 'Ubuntu 16.04' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Ubuntu_16_04/boot/grub/grub.cfg } menuentry 'Manjaro free' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Manjaro_free/boot/grub/grub.cfg } menuentry 'Manjaro nonfree' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Manjaro_nonfree/boot/grub/grub.cfg } menuentry 'Memory test (memtest86+)' { insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462 knetbsd /boot/memtest86+.elf } menuentry 'Memory test (memtest86+, serial console 115200)' { insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462 linux16 /boot/memtest86+.bin console=ttyS0,115200n8 } menuentry 'KDEneon ISO' { set isofile="/neon-useredition-20170608-2351-amd64.iso" loopback loop (hd0,2)$isofile linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject initrd (loop)/casper/initrd.lz } ### END Custom menu### [/FONT]
Last edited by oshunluvr; Nov 16, 2017, 12:16 PM.
- Top
- Bottom
Comment
-
THX for your detailed reply. However this raised more uncertaincies to me.
Let's step back and start from beginning. Typically I boot a Live CD, e.g. SystemRescueCD, and chroot into my main Linux Distro Sparky; this offers all options for system maintenance.
This is my current partition table:
Code:Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 sectorsUnits: 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: dos Disk identifier: 0x1b5712ca Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 2459647 2457600 1.2G 7 HPFS/NTFS/exFAT /dev/sda2 2459648 181531830 179072183 85.4G 7 HPFS/NTFS/exFAT /dev/sda3 181532670 234440703 52908034 25.2G 5 Extended /dev/sda5 181534720 225574911 44040192 21G 83 Linux /dev/sda6 225576960 225822719 245760 120M 83 Linux /dev/sda7 225824768 234440703 8615936 4.1G 82 Linux swap / Solaris
/dev/sda1 SYSTEM
/dev/sda2 Windows10
/dev/sda5 BTRFS (with 2 distros / 4 subvolumes)
/dev/sda6 Grub
/dev/sda7 Swap
To begin with the setup of Grub partition.
Which directory structure must be created on this partition? /boot/grub?
Or only /grub?
Or only the files/directories
Code:total 2.4Mdrwxr-xr-x 5 root root 1.0K Nov 16 20:51 . drwxr-xr-x 3 root root 1.0K Nov 16 20:14 .. -rw-r--r-- 1 root root 142 May 27 2013 device.map drwxr-xr-x 2 root root 1.0K Mar 14 2014 fonts -rw-r--r-- 1 root root 4.4K Nov 16 20:49 grub.cfg -rw-r--r-- 1 root root 1.0K May 27 2013 grubenv drwxr-xr-x 2 root root 6.0K Nov 16 00:49 i386-pc drwxr-xr-x 2 root root 1.0K Nov 16 00:49 locale -rw-r--r-- 1 root root 2.3M Jul 13 19:29 unicode.pf2
All section, e.g.
Code:### BEGIN /etc/grub.d/00_header ### (...) ### BEGIN /etc/grub.d/05_debian_theme ### (...) ### BEGIN /etc/grub.d/41_custom ###if [ -f ${config_directory}/custom.cfg ]; then source ${config_directory}/custom.cfg elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then source $prefix/custom.cfg; fi ### END /etc/grub.d/41_custom ###
Code:### BEGIN Custom menu ###menuentry 'Windows 10 (auf /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-E00486200485FA34' { insmod part_msdos insmod ntfs set root='hd0,msdos1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 E00486200485FA34 else search --no-floppy --fs-uuid --set=root E00486200485FA34 fi parttool ${root} hidden- drivemap -s (hd0) ${root} chainloader +1 } fi parttool ${root} hidden- chainloader +1 } menuentry 'Sparky Linux' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root cfb23b5f-d806-422f-aa10-b010a990cec3 configfile /@sparky/boot/grub/grub.cfg } menuentry 'Kali Linux' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root cfb23b5f-d806-422f-aa10-b010a990cec3 configfile /@kali/boot/grub/grub.cfg } ### END Custom menu###
How should I do this?
Code:grub-install --boot-directory /dev/sda6
Code:mount /dev/sda6 /mnt grub-install --boot-directory /mnt
- Top
- Bottom
Comment
-
Which directory structure must be created on this partition? /boot/grub?
So in your case, format /dev/sda6 (i recommend ext2) and mount it (I use /mnt/grub). Copy won't make the target folders for you so:
Code:sudo mkfs.ext2 /dev/sda6 sudo mount /dev/sda6 /mnt/grub sudo mkdir /mnt/grub/boot sudo mkdir /mnt/grub/boot/grub sudo cp -R /boot/grub/* /mnt/grub/boot/grub/
The next question is what content must be maintained in grub.cfg?
Code:[FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~/Documents[/B][/COLOR][COLOR=#000000]$ cat /mnt/grub/boot/grub/grub.cfg[/COLOR] # # Custom grub config # set default='KDE Neon' if [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" else menuentry_id_option="" fi export menuentry_id_option if [ "${prev_saved_entry}" ]; then set saved_entry="${prev_saved_entry}" save_env saved_entry set prev_saved_entry= save_env prev_saved_entry set boot_once=true fi function savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi } function recordfail { set recordfail=0 } function load_video { if [ x$feature_all_video_module = xy ]; then insmod all_video else insmod efi_gop insmod efi_uga insmod ieee1275_fb insmod vbe insmod vga insmod video_bochs insmod video_cirrus fi } insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462 font="/boot/grub/fonts/unicode.pf2" if loadfont $font ; then set gfxmode=3840x1600 load_video insmod gfxterm set locale_dir=$prefix/locale set lang=en_US insmod gettext fi terminal_output gfxterm if [ "${recordfail}" = 1 ] ; then set timeout=30 else if [ x$feature_timeout_style = xy ] ; then set timeout_style=menu set timeout=3 # Fallback normal timeout code in case the timeout_style feature is # unavailable. else set timeout=3 fi fi ### BEGIN /etc/grub.d/05_debian_theme ### set menu_color_normal=white/black set menu_color_highlight=black/light-gray #set_background_image /@KDEneon/usr/share/wallpapers/neonbykde2.jpg"; insmod jpeg if background_image background1.jpg; then true else set menu_color_normal=white/black set menu_color_highlight=black/light-gray fi ### END /etc/grub.d/05_debian_theme ### ### BEGIN Custom menu ### menuentry 'KDE Neon' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@KDEneon/boot/grub/grub.cfg } menuentry 'KDE Neon - new' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@KDEneon_previous/boot/grub/grub.cfg } menuentry 'Kubuntu 16.04' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Kubuntu_16_04/boot/grub/grub.cfg } menuentry 'Ubuntu 16.04' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Ubuntu_16_04/boot/grub/grub.cfg } menuentry 'Manjaro free' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Manjaro_free/boot/grub/grub.cfg } menuentry 'Manjaro nonfree' { insmod part_gpt insmod btrfs search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 configfile /@Manjaro_nonfree/boot/grub/grub.cfg } menuentry 'Memory test (memtest86+)' { insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462 knetbsd /boot/memtest86+.elf } menuentry 'Memory test (memtest86+, serial console 115200)' { insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462 linux16 /boot/memtest86+.bin console=ttyS0,115200n8 } menuentry 'KDEneon ISO' { set isofile="/neon-useredition-20170608-2351-amd64.iso" loopback loop (hd0,2)$isofile linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject initrd (loop)/casper/initrd.lz } ### END Custom menu###[/FONT]
Then I install Grub with the --boot-directory option to the Grub partition.
How should I do this?
Code:
grub-install --boot-directory /dev/sda6
Or must I mount the Grub partition first and then run grub-install?
Code:sudo grub-install --boot-directory=/mnt/grub/boot /dev/sda
***NOTE*** ALWAYS a good idea to have a bootable USB stick at hand when messing with grub - just in case!Last edited by oshunluvr; Nov 16, 2017, 04:46 PM.
- Top
- Bottom
Comment
-
Also, notice the first line in my grub.cfg the default boot is:
set default='KDE Neon'
You'll want to put the name of your menu item you want to default to or the number in the list.
***ALSO*** You'll need to copy the Windows stanzas from your current grub.cfg and make sure they're in your custom grub.cfg. I forgot about that since I don't use windows.
- Top
- Bottom
Comment
-
I have a better computer now, so I guess I can quit trying to figure this out. I'll just assume it didn't work because the laptop was so old the normal procedures wouldn't work. I'll just use the hyperviser on this better computer. That should be more successful than messing with just a software solution.Just to remind users and devs that Ubuntu and its flavors have a long way to go to be as usr friendly as they should be.
http://www.kubuntu.org/getkubuntu
- Top
- Bottom
Comment
Comment