LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-21-2017, 05:53 AM   #1
Grabby
Member
 
Registered: Feb 2016
Posts: 69

Rep: Reputation: Disabled
Grub2 does not detect (btrfs) partition after reinstall


I just installed Xubuntu alongside a (btrfs) Manjaro installation which used to be booted by Grub2.

Now for some reason Grub2 does not detect the Manjaro partition, so I can't boot from it.

Any solutions? (including using a different boot loader)

Last edited by Grabby; 10-22-2017 at 03:03 AM.
 
Old 10-21-2017, 06:18 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
You know grub can handle btrfs - check the grub.cfg on Manjaro for what you need to add to the cfg on Xubuntu.
 
1 members found this post helpful.
Old 10-21-2017, 05:00 PM   #3
Grabby
Member
 
Registered: Feb 2016
Posts: 69

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
You know grub can handle btrfs - check the grub.cfg on Manjaro for what you need to add to the cfg on Xubuntu.
I have found the grub.cfg file on the Manjaro partition, but extracting from it the relevant information and manually inserting it into the current grub.cfg is something I am unable to do, as my technical skills are limited. I have tried anyway, with the help of the Grub-Customizer, but it did not work (the entry is created, but it does not boot).
BTW, I also tried overwriting the current grub.cfg with the one taken from the Manjaro partition (replacing it as a whole), but strangely enough when I run update-grub2 what actually gets written on disk is not from the Manjaro grub.cfg (which I had copied into Xubuntu's /boot/grub directory) but from Xubuntu's own grub.cfg file -- despite the fact that it was just overwritten by the Manjaro one. That's odd! Moreover, the old Xubuntu grub.cfg gets restored (in place of the Manjaro one), seemingly out of nowhere...

Now I am in a hurry to restore the boot from the Manjaro partition and I don't mind giving up the newly installed Xubuntu partition altogether.

So, is there a way to get update-grub2 to read from the particular grub.cfg file which I want (i.e. the one I copied from the Manjaro partition) and ignore the currently installed grub config (which causes the interference)?

Could you please provide some easy-to-follow instructions on how to do it?

Last edited by Grabby; 10-21-2017 at 05:01 PM.
 
Old 10-21-2017, 05:58 PM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,343

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
Whenever you run update-grub it will overwrite any changes you made to /boot/grub.cfg. In manjaro /boot/grub/grub.cfg copy the section that is similar to this
Code:
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Manjaro Linux' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-996cfe51-bdf3-47c0-91cb-2be3f0fb4606' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 996cfe51-bdf3-47c0-91cb-2be3f0fb4606
else
search --no-floppy --fs-uuid --set=root 996cfe51-bdf3-47c0-91cb-2be3f0fb4606
fi
echo 'Loading Linux 4.4.5-1-MANJARO x64 ...'
linux /boot/vmlinuz-4.4-x86_64 root=UUID=996cfe51-bdf3-47c0-91cb-2be3f0fb4606 rw
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-4.4-x86_64.img
}
To /etc/grub.d/40_custom then run uppdate grub.
 
1 members found this post helpful.
Old 10-22-2017, 03:03 AM   #5
Grabby
Member
 
Registered: Feb 2016
Posts: 69

Original Poster
Rep: Reputation: Disabled
It worked! Problem solved. THANK YOU.
 
Old 10-22-2017, 07:55 AM   #6
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,343

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
One thing to note is when the kernel version changes for manjaro during a manjaro update you will need to edit the /etc/grub.d/40 and change the numbers and rerun update-grub. to keep from doing this and IMHO easier way is to make an entry in the 40_custom similar to this:
Code:
menuentry 'Manjaro Linux'{
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
configfile /boot/grub/grub.cfg
}
just change the set root numbers to reflect the partition your manjaro is on.
 
Old 10-24-2017, 06:08 PM   #7
Grabby
Member
 
Registered: Feb 2016
Posts: 69

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colorpurple21859 View Post
One thing to note is when the kernel version changes for manjaro during a manjaro update you will need to edit the /etc/grub.d/40 and change the numbers and rerun update-grub. to keep from doing this and IMHO easier way is to make an entry in the 40_custom similar to this:
Code:
menuentry 'Manjaro Linux'{
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
configfile /boot/grub/grub.cfg
}
just change the set root numbers to reflect the partition your manjaro is on.
I have just tried to do as you suggested, but I get an error message when running update-grub:
/etc/grub.d/40_custom: line 1: #!: command not found

The content of my /etc/grub.d/40_custom file is:

#! /bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

menuentry 'Manjaro Linux'{
insmod gzio
insmod part_gpt
insmod btrfs
set root='hd0,gpt6'
configfile /boot/grub/grub.cfg
}

Am I missing something?
Could you please tell me what to do?

Last edited by Grabby; 10-24-2017 at 06:21 PM.
 
Old 10-24-2017, 06:33 PM   #8
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,343

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
what is on line one of 40_custom?
 
Old 10-24-2017, 06:58 PM   #9
Grabby
Member
 
Registered: Feb 2016
Posts: 69

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colorpurple21859 View Post
what is on line one of 40_custom?
It's simply

#!/bin/sh

which was present by default in the file.
 
Old 10-24-2017, 07:38 PM   #10
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,343

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
Quote:
#! /bin/sh
if this isn't a mistype then should be #!/bin/sh without no spaces
 
Old 10-24-2017, 07:48 PM   #11
Grabby
Member
 
Registered: Feb 2016
Posts: 69

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colorpurple21859 View Post
if this isn't a mistype then should be #!/bin/sh without no spaces
It was originally without the space after #!, and it produced the error message

/etc/grub.d/40_custom: line 1: #!/bin/sh: No such file or directory

(I added the space while trying to solve the problem)

So I tried both with and without the space, and I get an error message in each case.

Last edited by Grabby; 10-24-2017 at 08:05 PM.
 
Old 10-24-2017, 08:34 PM   #12
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,343

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
There is something wrong with the first line. Did you use the same editor that you initially used to edit 40_custom?
 
1 members found this post helpful.
Old 10-24-2017, 08:55 PM   #13
Grabby
Member
 
Registered: Feb 2016
Posts: 69

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colorpurple21859 View Post
There is something wrong with the first line. Did you use the same editor that you initially used to edit 40_custom?
You just beat me to the punch. I was going to post the solution of the riddle. It was indeed a case of wrong encoding by the text editor. I saved the same text with a different text editor, and this time update-grub produced no error messages.
I still have to reboot, but I am confident that the problem is solved.
Thanks a lot indeed!
 
Old 10-24-2017, 09:13 PM   #14
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,343

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
Your welcome
 
Old 10-27-2017, 07:14 PM   #15
Grabby
Member
 
Registered: Feb 2016
Posts: 69

Original Poster
Rep: Reputation: Disabled
By the way, I can now confirm that the problem was about the wrong encoding of the text file. After rebooting, the grub menu shows the entry which I wanted. Problem solved.
 
  


Reply

Tags
btrfs, dual-boot, grub2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to install grub2 on the first section of a partition and then how to chainload to this grub2 bootloader? centguy Linux - Software 9 09-14-2017 10:03 AM
[SOLVED] Grub2 reinstall after Debian downgrade from Jessie to Wheezy chris.j Debian 1 01-04-2015 03:07 AM
[SOLVED] btrfs preventing installation of grub2 Sumerman Linux - Software 4 07-18-2014 03:37 PM
grub2 can't see my win 7 partition and yast2 bootloader can't reinstall grub2 jjrojaspy SUSE / openSUSE 5 07-07-2013 10:38 PM
How to reinstall Windows XP without cdrom reader using Grub2 + ISO Xeratul Linux - General 2 12-06-2010 05:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration