You are not logged in.

#1 2013-08-12 15:44:34

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 70

[SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

I have installed Arch on a Logical Volume after an Ubuntu installation which created the Logical Volume Group and more important the bootloader

sda                   8:0    0 298,1G  0 disk 
├─sda1                8:1    0   243M  0 part 
├─sda2                8:2    0     1K  0 part 
└─sda5                8:5    0 297,9G  0 part 
  ├─ubuntu-root     254:0    0   170G  0 lvm  
  ├─ubuntu-swap_1   254:1    0   3,9G  0 lvm  [SWAP]
  └─ubuntu-lvolarch 254:2    0   124G  0 lvm  /
sr0                  11:0    1  1024M  0 rom 

The bootloader - GRUB2 - is on sda1. I now want to configure GRUB2 a little bit further, but from Arch. As the bootloader was installed and until now managed by an installation of GRUB2 in Ubuntu I was worrid if may just install GRUB2 in Arch and work on /etc/default/grub, /etc/grub.d and /etc/default/grub in Arch, do the grub-mkconfig in Arch and it will work or if I am stucked to work on the GRUB2 configuration from Ubuntu, because it was originally installed from Ubuntu. What do I have to take care about when I want to continue to work on mz GRUB2 installation from Arch?

Last edited by cutuchiqueno (2013-09-07 06:41:33)

Offline

#2 2013-08-13 02:17:00

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,134

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

Are you booting in bios or efi mode?

Generally, you need to decide which OS is going to manage grub and you need to use that OS to install grub to disk, configure it etc.

It will almost certainly be easier to manage grub from ubuntu unless ubuntu will let you not have a boot loader installed at all. Arch will quite happily let you do this but I imagine ubuntu might be different.

You shouldn't run e.g. grub-install or grub-mkconfig from Arch if you are using ubuntu's grub. It might be fine but it probably won't be.

For example, if you generate a new grub.cfg from Arch, you will possibly have a different version of grub installed to disk than you have configured. And, yes, it will obviously use Arch's config files. Moreover, everything will then get overwritten next time you update grub in ubuntu.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#3 2013-08-13 02:40:17

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

If you don't like the idea of having to reboot to update grub, and you rely on the grub-mkconfig scripts, then you can always just mount the ubuntu filesystem and chroot into it.

Offline

#4 2013-08-13 02:45:43

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,134

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

Hmm... Is that how ubuntu maintains its grub, though? At least some distros wrap grub-mkconfig in something else. (E.g. Fedora does this though it doesn't work properly on my machine so I do grub2-mkconfig there but that's not really the "right" way and if it worked properly, it would get overwritten all the time.)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2013-08-13 02:52:29

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

Yeah, most dohave a wrapper command.  But that doesn't mean that you can't still use the regular grub2-mkconfig command (I think the wrapper is "update-grub" in ubuntu).  I'm not sure what more the wrapper provides, or if it is just really an easier command for their userbase to remember.

Offline

#6 2013-08-13 03:14:23

henk
Member
From: Weert, Netherlands
Registered: 2013-01-01
Posts: 334

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

The easiest way to do this is in my point of view is to add Arch to Ubuntu's Grub. That way each time Ubuntu gets a kernel update you don't have to
do a grub-mkconfig in Arch to put the path to the new kernel in Grub. Ubuntu will do this automatically.
To be about 100% sure Arch will be detected by Ubuntu-grub I recommend installing lsb-release in Arch.

Offline

#7 2013-08-13 05:47:04

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

henk probably brings up a good point.  The Arch kernel never changes names.  We don't keep old ones around, so what is in /boot actually gets replaced.  With other distributions (I know ubuntu for sure) a new kernel is put in place, but the old one remains.  So it would indeed probably be easier to have ubuntu take care of itself while simply ensureing that the same consistent Arch entry is included by their scripts.

Offline

#8 2013-08-13 20:29:07

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,134

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

WonderWoofy wrote:

Yeah, most dohave a wrapper command.  But that doesn't mean that you can't still use the regular grub2-mkconfig command (I think the wrapper is "update-grub" in ubuntu).  I'm not sure what more the wrapper provides, or if it is just really an easier command for their userbase to remember.

It's more that doing it with grub2-mkconfig etc. doesn't change the defaults in all of the right places and so it will get overwritten when grub or the kernel is updated because the distro will automatically overwrite. It does depend on the details and how you get grub2-mkconfig to do what you want, though, I admit. If you can just tweak the standard config files for grub, it should be fine. (e.g. /etc/default/grub.) I'm not so sure how the wrappers handle e.g. /etc/grub.d/*. Fedora relies on other files under /etc which are not part of grub's standard config files. I don't know about Ubuntu so it might work fine. But there are complications there which I think it is easier to avoid!


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#9 2013-08-13 23:45:03

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

This is the entire "update-grub" from a Debian install:

#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg "$@"

This uses any file in /etc/grub.d that is marked executable (30_os-prober, 40_custom, etc).

And yes, henk makes a good point -- when I have Arch booting on a machine that also has a Debian (or Ubuntu) install, the easiest thing to do is to let Debian handle Grub, make a 40_custom entry for Arch, and disable 30_os-prober. The Arch entry never needs to change.

Offline

#10 2013-08-14 10:12:36

spurious_access
Member
Registered: 2013-02-23
Posts: 15

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

WonderWoofy wrote:

henk probably brings up a good point.  The Arch kernel never changes names.  We don't keep old ones around, so what is in /boot actually gets replaced.  With other distributions (I know ubuntu for sure) a new kernel is put in place, but the old one remains.  So it would indeed probably be easier to have ubuntu take care of itself while simply ensureing that the same consistent Arch entry is included by their scripts.

It's true that the Ubuntu kernel name changes on every update, but at least on my Ubuntu system it keeps current symlinks to the appropriate files as "vmlinuz" and "initrd.img" in /. It should be pretty easy to add a custom section in the grub config in arch to always point to these symlinks instead of the actual kernel, bypassing the need to update grub every time you do an update in Ubuntu. I've had all kinds of problems getting grub to see Arch correctly under Ubuntu, even with lsb-release, so I'd probably try to use grub under Arch if at all possible just to save some time.


ghostwheel | Custom | Arch with linux-ck-nehalem |  x86_64 | BIOS | grub2 | systemd | BTRFS | Intel Core i7 920 @ 3.2 GHz | 18GB RAM | 80gb Intel 320 SSD (boot) | 1.5TB 7200 RPM Seagate HDD (storage)

hactar | Google CR-48 | Arch with linux-ck-atom | x86_64 | EFI | grub2 | systemd | ext4  | Intel Atom | 2GB RAM | 64 gb Kingston SSD | Atheros Wireless

Offline

#11 2013-08-14 15:06:41

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

@spurious_access, I think you missed a crucial part of what was recommended above.  Ubuntu creates a symlink for the current version, yes.  But it also gives you access to all the old kernel version in the grub menu.  So although the "current" selection should stay relatively the same, there will be continually added kernel versions that will need to be added.  With Arch, it is sometimes not detected very well by other distributions, but above, it was recommended above to simply remove executability of the script that scans for others (os_prober?).  Then use the 40_custom.conf to make a manual entry for Arch.  Since it stays pretty consistent, there should be no reason to need to scan for other operating systems.

Of course, if you have even more distributions, then it might justify the need for os_prober to work as it should... I just don't use grub2, and I have real control over my bootloader!

Offline

#12 2013-08-17 06:44:01

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 70

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

In fact I do it from Ubuntu now. The reason why I asked was, that I wanted configure Grub a little bit further (layout, theme) and spending so much time, it would have been nice to do it in Arch and not in Ubuntu. The second reason probably is more important. Perspectively I would like to erase the whole Ubuntu installation, so Arch will have to take over managing the Boot Manager and so the question was related to the more basic questio if I than have to make a vanilla install of Grub from Arch replacing the Ubuntu one or if I can somehow "switch responsibility" to Arch

spurious_access wrote:

I've had all kinds of problems getting grub to see Arch correctly under Ubuntu, even with lsb-release, so I'd probably try to use grub under Arch if at all possible just to save some time.

I solved the issues I had by mounting the Arch logical volume. grub2-mkconfig always found the installation of Arch whe it was mounted

Offline

#13 2013-08-17 07:56:33

henk
Member
From: Weert, Netherlands
Registered: 2013-01-01
Posts: 334

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

cutuchiqueno wrote:

so the question was related to the more basic questio if I than have to make a vanilla install of Grub from Arch replacing the Ubuntu one or if I can somehow "switch responsibility" to Arch

If you erase Ubuntu your grub configuration will be erased as well. What is in the MBR will loose its directions. So, yes, if you want Arch to manage the boot you will have to install and configure Grub in Arch.

Offline

#14 2013-08-20 19:38:32

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

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

The EASIEST thing to do is to just leave Grub2 in Ubuntu, where it is now, and let Ubuntu deal with updating it automatically when it needs to.

Since the Arch entries never need to change (Ubuntu's update-grub will just make the same entries for Arch each time it runs, UNLIKE the Ubuntu entries), I would do what I have done:

1). Run update-grub from Ubuntu once.  Make sure that Arch entries were created in the grub menu file found in /boot/grub/grub.cfg.  If Arch entries were not made automatically, mount the Arch / partition in ubuntu and run update-grub again.  (or do the lsb-release thing, but if you only need to do this once...)

2). Copy the Arch menu entries from grub.cfg as appropriate into /etc/grub.d/40_custom.

3). Disable the execute on /etc/grub.d/[os-prober, memtest, whatever else seems appropriate).

4). Run update-grub again.  It should now freshly create entries for Ubuntu kernels (and will do so automatically whenever the kernel is updated by Ubuntu), but will just grab the working Arch (or Windows, or whatever) entries from the 40_custom file as created previously.

This works nice, is simple, and there is no real need to update the grub entries for any O/S that doesn't update the name of the kernel (i.e. Arch, Windows, etc.)

It is a much simpler solution (assuming you want to keep Ubuntu) than moving control of Grub to Arch, since doing THAT requires that you run update-grub in Arch every time Ubuntu updates - a needless complication since Arch never needs it to run for itself.

Offline

#15 2013-08-20 19:49:32

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

andrekp, thank you for the detailed explanation. Henk and I already told the OP about the advantages of having Ubuntu manage grub using 40_custom (and disabling 30_os-prober), but he wants to eventually remove Ubuntu entirely, so he needs to have Arch manage grub. He omitted this information from his first post, but clarified later.

Last edited by 2ManyDogs (2013-08-20 19:50:22)

Offline

#16 2013-09-07 06:09:49

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 70

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

Yes, your are right. Sorry, for net telling before. I actually want to remove Ubuntu at some point. So I will have to reinstall GRUB2 from within Arch, so that the Ubuntu GRUB2 install is overwritten, is that right?

Is there something to take care of first or is a clean reinstall of GRUB2 just enough?

Offline

#17 2013-09-07 06:28:46

rufus
Banned
From: san francisco
Registered: 2013-04-20
Posts: 153

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

Yes it will be. If youre gonna use Arch only you may want to explore syslinux....I dunno I think GRUB is fussy and a pain.
but yes check out the wiki just install a boot loader from Arch and nuke ooboontoo from there


end ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     'the machine is not the end to the means., we are. In history, in board rooms and politic the greatest  decision and effort
        evolves from passion, lust for life, and a common sense of humanity. Never forget what you are and why'.         -me

Offline

#18 2013-09-07 06:40:38

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 70

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

Thx. I will have a look at syslinux or just reinstall GRUB2

Offline

#19 2013-09-07 06:41:45

progandy
Member
Registered: 2012-05-17
Posts: 5,201

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

If you have /boot on its own partition, it should be relatively easy to switch ownership of grub. I've never done it before but I guess it should work this way:
- boot arch
- delete ubuntu partition(s) but keep /boot
- clean /boot (ubuntu kernels, ...)
- install grub package in arch (no need to execute grub-install)
- configure /etc/default/grub, /etc/grub.d/*
- do grub-mkconfig -o ... (since grub2 is grub2 regardless of the distribution it was installed from, this config should simply work)
- if there is ever a new version of grub and you want to use it, remove /boot/grub, execute grub-install and do grub-mkconfig -o ...)

PS: I ditched grub not long ago in favor of syslinux. No need to carry all that bloat if there is only one OS with one kernel to boot. grub was great as long as I had to boot into windows 7, too (call ntldr directly instead of that stupid chainloading)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#20 2013-09-07 19:35:56

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,134

Re: [SOLVED] Can I work from Arch on GRUB2 installed by Ubuntu?

That will work provided the versions of grub2 are the same or not too different but unless you know that, you should reinstall grub to disk as well. This is good practice even when grub is just updated in Arch - never mind switching from whatever version Ubuntu uses.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB