this post was submitted on 18 Aug 2023
14 points (100.0% liked)

Arch Linux

7763 readers
7 users here now

The beloved lightweight distro

founded 4 years ago
MODERATORS
 

hy im trying to install arch as the third os on my windows / ubuntu machine and i cant figure it out how to set the grub bootloader i have already read the friendly manual but probably also due to my non native English origins i coudnt find an answer to my question witch is during the arch install should i reinstall grub with grub-install ? i would prefer to keep the old (ubuntu) one also because its already customized but unfortunately i cant...if i dont install it i dont have the directory /boot/grub in witch i should place the grub.conf file so should i just create this directory ? i have tried with os-prober correctly activated to generate a new grub.conf but it doesnt pick up the arch install .., what are the files i must have to make grub recognize those partitions as a new os to witch assign a new boot entry ..

top 32 comments
sorted by: hot top controversial new old
[–] silent_water@hexbear.net 5 points 1 year ago (1 children)

you should be able to reuse the /boot partition from arch, I'm pretty sure. you can just update the grub configuration ubuntu set up to add arch to it that way.

[–] DNOS@reddthat.com 3 points 1 year ago (2 children)

Sorry I'm trying to install arch after Ubuntu what did u mean by reusing the boot partition from arch you mean try to update grub from the arch install while in Chroot?

[–] silent_water@hexbear.net 3 points 1 year ago* (last edited 1 year ago) (1 children)

no like you can skip the entire grub-install part and just mount your ubuntu /boot partition as your boot partition in arch and go through the normal install process. then at the end, you just update the grub.cfg to include the arch install.

edit: if you don't have a separate ubuntu /boot partition, you're going to need to reinstall it with a separate boot partition, or configure the bootloader in arch and do grub-install but stick in the ubuntu boot block into grub.cfg. the issue is that you're still going to need to update the configuration on the ubuntu side so it uses the arch /boot partition and installs kernels there.

[–] DNOS@reddthat.com 1 points 1 year ago (1 children)

Thanks a lot man I would love to tell you I understand everything but unfortunately the only part that I got was the first and I don't have a separate boot partition :( so what do you mean by stick in the ubuntu boot block into grub config I have to reinstall grub from arch then I update it making a new .Cfg and then remaining in the arch install I should find and add the other two boot entries ? Should I delete grub before installing it again ? Im asking because I think I have already tried to install it and i believe I was still using the ubuntu one ... What about updating grub on the Ubuntu side how am I going to boot into it ? Thanks a lot man I don't want to waste your time u gave me some nice homeworks I will be back in a few days ...

[–] silent_water@hexbear.net 1 points 1 year ago (1 children)

no worries! you want a separate boot partition on your hard disk to make this all easier. if you don't have one already, I would make one, then go back through the arch install. at the end, there should be instructions on how to update the grub.cfg for arch. you'll need to do the exact same thing for Ubuntu. the only hard part is that Ubuntu is set up right now to not mount a /boot partition so when you install updates, the updated boot images won't get installed in the right place. so you need to boot into Ubuntu first and change /etc/fstab so it mounts the boot partition to /boot. then you need to run:

sudo update-bootloader --refresh

then you can go back and do the arch install with the same /boot partition and run grub-install. there's detailed instructions on how to change the boot partition here and the ArchWiki should have the rest.

[–] DNOS@reddthat.com 2 points 1 year ago (1 children)

Thank you so much it's like a couple of weeks I'm going back and forth on this topic and this is the biggest step I have done ... I will surely let you know if I successfully end up bricking my PC :)

Btw I'm sorry for any previous gender errors I have just noticed the correct pronouns 😅

[–] silent_water@hexbear.net 2 points 1 year ago (1 children)
[–] DNOS@reddthat.com 2 points 1 year ago (1 children)

Hey do you know if it's normal then after mounting the /boot partition, adding this ... UUID=1f32... /boot ext4 defaults 0 2 ... to the fatab and updating grub with grub-update or white grub mkconfig.io.... I can't no longer boot into Ubuntu ?it puts me in some kind of recovery mode Should I proceed anyway with the arch install ? Does the problem come from the fact I haven't already reinstalled grub ? PS I have tried the --refresh flag but apparently it doesn't exist ...

[–] silent_water@hexbear.net 3 points 1 year ago (1 children)

yeah, you need to run grub-install now, so do it from the arch install environment. you'll be able to boot into Ubuntu once that's done (assuming grub.cfg is properly configured for Ubuntu)

[–] DNOS@reddthat.com 1 points 1 year ago* (last edited 1 year ago) (1 children)

Thanks sis I have done that unfortunately I'm back to the start when booting up I have the customized grub witch makes me think I'm using ubuntus grub and since I have added the line to the fstab I'm booted straight into emergency mode I have typed as suggested journalctl -xb to see the complete logs but there's like 2840 something lines I have scrolled and nothing gives me a hint of what's happening I believe I already had an integrity problem loading x.509 certificate -65 I have taken some pictures of warnings and errors let me know if it would be helpful to you ...

I have used this guide for the rest but I have checked and it matches with the arch wiky https://www.learnlinux.tv/arch-linux-full-installation-guide/ I have chosen to encrypt my LVM partitions and I have modified the files accordingly ...(I hope ) Apparently something is wrong before the description part because I don't see any prompt asking me for the password ... Hope you could help me

Btw since it was working I haven't touched the grub.conf in Ubuntu I have previously added the encryption lines on it because i was confused about what grub.conf file will end up needing to decrypt, and I was scared of not being able to boot back... it doesn't seem to give any problem back then so I won't blame this on it but I will defenetly revert it back to default and give it another go ...

Update mounting the /boot partition manually while in recovery allows me to boot into Ubuntu still no sign of the arch install thow (yes I have the os-prober flag ser up ) with ubuntu I can see also windows but not arch and from arch I can see neither ubuntu and windows I have also tried to modify the line in the fatab as follows with no results ... Should I somehow activate or validate the new fstab ?

UUID=1f32... /boot ext4 errors=remount-ro 0 1

[–] silent_water@hexbear.net 1 points 1 year ago (1 children)

bit tired to respond tonight - I'll get back to you in the morning

[–] DNOS@reddthat.com 2 points 1 year ago

No problem it's really late here too

[–] intelati@programming.dev 1 points 1 year ago

I went the GUI route with EndeavorOS. I had to set (flag?) the existing bootloader to /boot/efi I believe. Then I was able to install normally from there.

(Was coming from Manjaro)

[–] mectx02@lemmy.world 3 points 1 year ago (1 children)

If you're running under UEFI, GRUB typically installs a bootx64.efi file in the EFI partition (typically under its own little GRUB folder), so that when your computer boots up, the BIOS/UEFI can point to that file and start GRUB, which will then look at its configuration file to find all the preconfigured bootable operating systems that it knows about. BIOS is a little bit different, but the premise is the same - a small executable is placed somewhere that the BIOS can find and execute to launch your OS' bootloader.

All os-prober does is look at operating systems that are already mounted and adds them to the configuration file. If a system isn't mounted, then os-prober (and by extension, GRUB, since the grub.cfg file is where all the OS options are placed) won't know about it.

Assuming that you have your fstab file for Archlinux configured correctly (where your EFI partition is mounted under a reasonable directory, such as /boot/efi), you can boot into Ubuntu, mount your Archlinux partion under Ubuntu temporarily, and run sudo grub-mkconfig -o /boot/grub/grub.cfg under Ubuntu to generate the necessary boot option for Archlinux.

You can install the GRUB package under Archlinux, but there's no need to install the bootx64.efi file (from sudo grub-install) a second time since that file already exists. It would mostly be used for keeping your grub.cfg up to date. The theming can probably be copied over from Ubuntu's configuration (but I'm not sure of where it is off the top of my head).

[–] DNOS@reddthat.com 1 points 1 year ago (1 children)

Thanks I always thought ther was a grub for each os and they will recognize each other ... Following an other user advices I have added a separate /boot partition to Ubuntu but eventhow I have added the line in the fatab on boot it doesn't mount properly so I have to manually mount it from the recovery mode... if I select to mount it on boot from the GUI (gnome-disks) it adds a couple of lines in the file /run/systems/generator/boot.mount but nothing changes ...can u confirm me that this file is not consulted on boot so its not relevant ? So should I mount the /boot/EFI (already mounted) ,/ , /home and /boot (already mounted) on Ubuntu before updating grub ? Doesn't this tell to mount the arch os when I boot ubuntu ? .... I have just realized could the problem be in the fact that during the arch install I have followed a tutorial which have told me to create a /boot /EFI directory on witch I should mount the EFI partition while in Ubuntu the EFI partition is mounted in /boot/efi that could defenetly be it ... how should I proceed to fix it remove the EFI directory with all the stuff there's in it and mount it on /boot/efi? Don't wanna mess it up removing stuff is always dangerous... Let me know thanks a lot man I feel like we are getting closer

[–] DNOS@reddthat.com 1 points 1 year ago (1 children)

Thanks I have found arch with grub but I still can't see it in the boot entries 😂 seems somebody is joking with me ... Anyway as usual I boot grub comes out without arch so I select Ubuntu he boots me in recovery mode I mount the /boot partition and boot into Ubuntu ...

[–] mectx02@lemmy.world 1 points 1 year ago (1 children)

If you're having to mount drives in Ubuntu's recovery mode, something is really f*cked up. If you can remember the default state, I would try and revert back to that first before making any changes. (Hopefully you don't have to reinstall anything)

I'm not familiar with gnome-disks, so I can't say anything about its own file relationships and how that works with GRUB.

From past experience, most Linux distributions will place your EFI partition (looks like it's at /dev/nvme0n1p1 in your example) at /boot/efi. /boot partitions generally aren't really needed for a home linux environment afaik, but I'm sure someone with more experience will be happy to come along and give an example of when you might need one. However, in order for Linux to boot up successfully, it does need to know where all of its internal components are (typically the kernel and an initramfs, if you have one - I think Ubuntu ships with one by default).

If you're looking to just have the EFI partition mounted correctly, you can unmount it temporarily (as root, so exercise caution) and then make changes with the directory structure before remounting it. Your fstab file should match up with where you want it mounted.

[–] DNOS@reddthat.com 1 points 1 year ago* (last edited 1 year ago) (1 children)

Hey thanks man I have followed your advice and reverted back the Ubuntu fstab ... I the added the separate boot partition in a better way and now I can finally boot back into Ubuntu without the recovery mode ...

I noticed that in most tutorials they will generate the fstab before mounting the /boot/efi partition I checked my ubuntu fstab wich also has the /boot/efi entry so I mounted it before generating the fstab but still nothing changes (yeah I also fixed the mount point to /boot/efi)

I feel like im going nowhere since eventhow I find a way to make os prober recognize arch and the other way around I still can't see the entry in the boot screen which remains the same(probably the original ubuntu one with my aesthetics customization) is it possible that I have somehow generated a copy of some file maybe the grub.conf which remains unmodified ? I'm glad it didn't get worse but I will be happy to see some positive changes ... Thanks for your help

[–] mectx02@lemmy.world 2 points 1 year ago (1 children)

I had a closer look at your picture and I noticed that GRUB is throwing an error about an unrecognized partition type.

What file system did you choose to install Arch on? You might not have the correct file system drivers for os-prober to see it.

[–] DNOS@reddthat.com 1 points 1 year ago (1 children)

Hy thanks for still being here yeh I have noticed them too but I skipped them since there was the same error for Ubuntu and it works fine ... My EFI system is mounted on a fat 32 partition my ubuntu root is mounted on an ext4 partitions as my separate boot partition witch is also Ext4 my arch install is instead mounted on an LVM partition witch I have formatted with Ext4 both for the home and the root ... the LVM partition is on nvm0n1p9

Btw sorry if I keep sending pictures of the screen instead of screenshots just a lazy boy😅

[–] mectx02@lemmy.world 1 points 1 year ago (1 children)

Btw sorry if I keep sending pictures of the screen instead of screenshots just a lazy boy😅

Work smarter, not harder :)

Those file formats are fairly typical for most Linux installations, so that rules out GRUB drivers.

Your most recent screenshot shows evidence of an encrypted volume for your Arch install. I would have a read on the archlinux wiki and give that a shot first. In addition, while you're in Ubuntu, they have update-grub that will auto-generate GRUB's config file for you, so that might help with a couple of problems.

Beyond that, you might have to use an alternate bootloader, as GRUB doesn't seem to have very good support for LUKS at the moment. Alternatively, you could remove the LUKS encryption from your Arch install, but I'm not aware of how feasible that solution is since I don't use it.

[–] DNOS@reddthat.com 1 points 1 year ago* (last edited 1 year ago) (1 children)

Hy thanks Yeah i have encrypted only the lvm partition so Ubuntu should be fine i dont think this error Is related to that.. i have already read the wiky about encryption and seems likes i have done everything right i have modified the GRUB.conf file accordingly ... But i agree its strange since i dont have any prompt asking me of decrypting that partition ..

Yeah i know about update-grub notthing changes same output ...

The problem Is that i cant make anything register by GRUB i Will bet that even removing the encryption Will not add the new arch entry ... since eventhow os-prober recognize It and says adding the os wont show anything ... thats why i thought in a First Place about a Copy of a file which i couldn change of some backup file used since since new One Is somehow broken ...

[–] mectx02@lemmy.world 1 points 1 year ago (1 children)

Apologies for the longer delay this time, but I needed to have a play with a similar scenario since I haven't worked with LVM.

I set up a VM with Kubuntu (just out of preference; everything else compared to Ubuntu should be the same) and Archlinux similar to your setup (sans LUKS encryption - only wanted to test one thing at a time). I started with installing Kubuntu and letting it do LVM however it wanted, then shrunk it down and installed Archlinux afterwards.

When I was using Ubuntu's GRUB and letting it do the configuration, it could "find" the Archlinux partition, but it refused to boot it on the basis of "can't find kernel image" error. Manhandling it produced similar results - it just refused to boot.

Using Archlinux's GRUB, however, worked flawlessly. It even detected and booted up Kubuntu just fine.

Having a look at the GRUB configuration files, it looks like there's a difference between the options...

Kubuntu's GRUB config for booting Archlinux:

menuentry 'Arch Linux (on /dev/mapper/vgkubuntu-archlinux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--/dev/mapper/vgkubuntu-archlinux' {
                insmod part_gpt
                insmod lvm
                linux /boot/vmlinuz-linux root=/dev/mapper/vgkubuntu-archlinux rw loglevel=3 quiet
                initrd /boot/initramfs-linux.img
        }

Archlinux's default GRUB config:

menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-42a47177-8802-48bf-93d1-376419d431e5' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod lvm
        insmod ext2
        set root='lvmid/F8XGRm-mOlV-RmRq-sFoj-IBYw-7D8q-lNxCOg/ubT282-XqAq-DvJg-fj4H-bfpQ-1P4f-5215v9'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='lvmid/F8XGRm-mOlV-RmRq-sFoj-IBYw-7D8q-lNxCOg/ubT282-XqAq-DvJg-fj4H-bfpQ-1P4f-5215v9'  42a47177-8802-48bf-93d1-376419d431e5
        else
          search --no-floppy --fs-uuid --set=root 42a47177-8802-48bf-93d1-376419d431e5
        fi
        echo    'Loading Linux linux ...'
        linux   /boot/vmlinuz-linux root=/dev/mapper/vgkubuntu-archlinux rw  loglevel=3 quiet
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initramfs-linux.img
}

Notice a difference?

Granted, there's a lot of extra fluff in there, but I noticed that it looks like GRUB has no idea where the root is for the LVM when using (K)Ubuntu's config. Which is, frankly, just lazy - if you go the other way, Archlinux correctly recognizes the required defaults for booting the other operating system. (I suspect a bug report should be filed, but, eh.)

So, here's an option:

  1. Boot into Archlinux and have it install its GRUB. (Yes, an extra grub installation with grub-install is necessary since the EFI needs to point to the Archlinux install.)
  2. Generate a GRUB configuration file within Archlinux. (os-prober should work just fine on Archlinux since I've seen their version generating much more workable configurations for other operating systems.)
  3. Copy over the theming from Ubuntu's GRUB into Archlinux's GRUB config. (This is mostly just for style points - you can theme GRUB however you like).

Hopefully that works a little better.

[–] DNOS@reddthat.com 1 points 1 year ago (1 children)

Wow thanks so much such a dedication this time i thought i have tried them all ... yeah i should probably have mentioned that i have only arch on lvm while Ubuntu Is still on a normal partition like Windows but i think your test Is still usefull since somehow while i was trying to make arch appear on the boot screen by mounting all its partition from Ubuntu and generating a new GRUB file and fstab i got the same error you had of loading the kernel First i Will defently give It a shot... since its Easier to recognise what grub I'm using if I don't theme them the same way I will skip that step ... I have a feeling that notthing will change because I have already tried to reinstall grub with gru-install (I believe im not removing it first but I'm installing a new one on top ) but I always get the themed one on boot ...

[–] mectx02@lemmy.world 1 points 1 year ago (1 children)

If you reinstall GRUB from ArchLinux and get the Ubuntu themed one on reboot, might be wort going into your UEFI/BIOS and manually selecting which EFI file to boot from. Probably would be labeled “arch” or something similar.

[–] DNOS@reddthat.com 1 points 1 year ago

I will defenetly try this 👍🏻

[–] abir_vandergriff@beehaw.org 2 points 1 year ago (1 children)
[–] DNOS@reddthat.com 1 points 1 year ago

Hy thanks i would give it a go 👍🏻

[–] Surqa@lemmy.world 2 points 1 year ago* (last edited 1 year ago) (1 children)

If I'm not mistaken couldn't you just mount your already configured grub bootloader to /mnt/boot?

For example, during the arch install if your grub is at /dev/sda2, couldn't you do mount --mkdir /dev/sda2 /mnt/boot?

Somebody who knows more than I do can definitely jump in here as well! But could give that a try

[–] DNOS@reddthat.com 2 points 1 year ago* (last edited 1 year ago)

Hy I think silent_water is saying the same thing but unfortunately I don't already have a separate boot partition thanks for the answer I will defenetly dig deeper

[–] darcy@sh.itjust.works 1 points 1 year ago (1 children)

erm, have you tried reading the manual ? ☝️🤓

[–] DNOS@reddthat.com 3 points 1 year ago