You are not logged in.

#1 2012-07-26 16:50:43

andrekp
Member
Registered: 2012-06-07
Posts: 112

Tip for using Grub2 in another operating system:

Disclaimer: This may not be the Arch Way and may not be a respectable solution to everyone.  However, since I think it is entirely conceivable that a new Arch user will also being using other Linux distros like Ubuntu, and will be using the Grub2 install in those other systems to boot Arch, I feel it is USEFUL to impart this information for those who might find it so.

IF you happen to run Arch as part of a multi-boot system with, say Ubuntu and Windows,
    AND you happen to use Grub2 as installed by Ubuntu (or some other Linux system),
    AND Grub2 manages your boot menu automatically (i.e. running update-grub in, for example, Ubuntu initiates some     process to probe your complete system for other operating systems and automatically creates a menu entry for them – a very typical setup).

THEN
    you may find this tip helpful.


Grub2 in automatic mode (as I've described it above) uses a program called os-prober to do the actual looking for other operating systems.

It should be known that it doesn't do this in any really technical way, it simply does a superficial probing for the existence of certain files found on other operating systems, and if found, creates a menu entry for that system.  It is easily fooled in some of the tests and may not always work.  The tests can be found in a directory (depending on your specific installation):  /usr/lib/os-probes/mounted/

As it happens, the test that is used to look for an Arch installation, 90linux-distro, is a bit easy to fool into finding nothing (as I found).  The better test is 40lsb.  However, the 40lsb test requires the existence of a particular file with some text in it that is not part of a default Arch install. 

If you want to run Grub2 from another Linux system and give it a better chance to more easily and consistently find Arch automatically, using the 40lsb test, then do the following in your Arch system:

1). create a text file in Arch: /etc/lsb-release
2). Put the following in it:

DISTRIB_ID=Arch
DISTRIB_RELEASE=1
DISTRIB_CODENAME=arch
DISTRIB_DESCRIPTION="Arch Linux”

3). Save that file.

Note that the details of what you use in each field are probably not really that important.

Now when you run update-grub from Ubuntu, a better test will be used for Arch and there will be a much better chance that it will be found by os-prober automatically.  I found this to be helpful in my setup and it affects Arch in no significant way.  YMMV.

(Note: I am not sure if os-prober will even work if you have an Arch setup with a separate boot partition, but I haven't looked into it.)

Offline

#2 2012-07-26 18:12:50

andrekp
Member
Registered: 2012-06-07
Posts: 112

Re: Tip for using Grub2 in another operating system:

You should also be aware that if you have trouble getting os-prober, as run by update-grub, to recognize your other operating systems, you can also try mounting them before running update-grub.  That helps os-prober find some operating systems as well.

If you want to leave everything on automatic for convenience, however, your best bet is to try the above and see if that solves your problem.

You are also certainly welcome to do it like an Archer and disable that pesky os-prober in the other Linux and manually create all your menu entries.

Offline

#3 2012-07-26 18:16:37

shulamy
Member
From: israel
Registered: 2010-09-11
Posts: 456

Re: Tip for using Grub2 in another operating system:

i don't think you have to do anything.

the update-grub should do evrything for you.

i think that's what happened to me with fedora.

ezik

Offline

#4 2012-07-26 18:56:42

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Tip for using Grub2 in another operating system:

andrekp,

you are right, if /etc/lsb-release doesn't exist, some GRUBs have sometimes difficulties detecting archlinux.

/etc/lsb-release doen't exist in Arch by default, but you can install it from community:

pacman -S lsb-release

I must say that my experience with all this is not brilliant. GRUB legacy just worked.
With Grub2, in my laptop with 6 different distributions, I have spent way to much time fiddling with it.

And if some love to get immersed in these problems, others just want to use their computer for other things than setting/tweaking/tuning the system all day long.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#5 2012-07-26 19:35:07

andrekp
Member
Registered: 2012-06-07
Posts: 112

Re: Tip for using Grub2 in another operating system:

Mektub,

I agree that Grub2 can be too finicky at times, but it has its supposed advantages and to my mind, why do more manually than is necessary, so its possible automation is a plus.  To some, the tweaking of O/S componants might be the goal and be-all of computing, but I rather more prefer it invisibly do its job with mnimal intervention.  os-prober, for all the complaints, does its job reasonably well, with occassional proding.  Grub2 not finding Arch partitions DOES seem to be an issue that affects a number of people.  I don't really know why.

I was unaware that you could actually just install the file with pacman.  Interesting.  Though I note that it installs more than just the simply text file I noted above.  It likely also includes a bin that would be used if you run os-prober on Arch itself - which is not really to my point.  (My point being those who maintain their Grub2 outside of Arch.)  Might not hurt to just install it that way, however.

Finally, I have to wonder why it is that os-prober uses such seemingly convoluted methods for its probing.  One would THINK that the easy test for whether a partition has Linux on it would be too look for some variation of /boot/vmlinuz, rather than look for some periphery files that may not even be in the same partition.  I have to imagine that this obvious method was tried and found wanting in some way.  We'd have to ask the author for that information...

Offline

#6 2012-07-26 19:42:27

andrekp
Member
Registered: 2012-06-07
Posts: 112

Re: Tip for using Grub2 in another operating system:

shulamy wrote:

i don't think you have to do anything.

the update-grub should do evrything for you.

i think that's what happened to me with fedora.

ezik

Normally, you'd be correct.  Running update-grub in, for example, Ubuntu should find your Arch partition automatically.  Unfortunately, the test that os-prober uses to find Arch is a bit touchy and sometimes, for whatever reason, it doesn't work. 

You can give it a bit of a kick and make it work by mounting the Arch partition in Ubuntu first, but then it's no longer automatic.  I have found that adding the file I suggest to Arch helps os-prober find Arch from another Linux system without having to mount it first - restoring update-grub to automatic operation.  It works for me, anyway.

If anyone has further insight as to why this works, or as to why it's a bad idea, it'd be welcome.  I think I'm the only one who has suggested this solution to the problem - at least that Ive seen in googling it.  The usual solution is just to give up and edit the menu manually like the good old days.

Offline

#7 2012-07-26 21:09:17

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: Tip for using Grub2 in another operating system:

I think os-prober search for "bootloader-files". Once I used rsync to make a copy of one system (I think it was Arch) to another partition. I only changed fstab, and let the grub-files be as they were. Then I run update-grub in *buntu, and it added a new entry for the copy of Arch, but that booted up the original Arch. I changed menu.lst for the copy, and I think it was added correctly to the bootmenu when I ran update-grub in *buntu again. If I don't remember wrong...

Offline

#8 2012-12-28 15:10:20

scjet
Banned
Registered: 2011-07-23
Posts: 172

Re: Tip for using Grub2 in another operating system:

@andrekp:

Thankyou,

Ya, this seems to be (still) happening across all the *bumtu-12.10's as well. ?

Anyway, your "...1). create a text file in Arch: /etc/lsb-release..." did the trick for the *bumtu grub2.
I booted back into Arch, but now ONLY the Arch grub2 menu is the preferred master booter for them all.
- as it should be.
smile

Last edited by scjet (2012-12-28 15:13:55)


The "BSD" things in life are "Free", and "Open", and so is "Arch"

Offline

#9 2012-12-28 16:09:38

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,802

Re: Tip for using Grub2 in another operating system:

scjet:  A bit old, but on topic.  Just don't expect an response on a 5 month old thread.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB