#[solved] multiple arch installs-same kernel, how to populate grub?
121 messages · Page 1 of 1 (latest)
is it not as simple as os-prober
I assumed that was just for windows but that is a stupid assumption
you could also manually make an entry
Os prober did it, though windows didn’t show up so I think I have borked windows
Nope windows works so this is odd, and it’s in fstab
Forgot to mount windows efi, lol, silly me!
For some reason when I start arch now on btrfs it’s super super slow, any idea why? I’m stuck on:
Starting version 251.4-1-arch
For so long until it lets me log in as cli, or now that I have gdm installed and enabled loads that
I manually added my swap to the fstab and messed up the uuid-lol
Hmmm, so far os prober has not been the solution, I’m gonna need to nuke grub and reinstall it :/
Yeah when I try to load my ext4 grub gives me this:
it is obviously in there but I assume it's got like a system link to the btrfs install
basically both my btrfs arch and my ext4 arch each want to make their own /boot/initramfs-linux.img by the looks of things
is it that I just can't use the mainline kernel on both, or else use seperate efi partitions to boot them?
closest thing I have found is this but there's no solution on the thread and for some reason they start talking about VLC:
https://bbs.archlinux.org/viewtopic.php?id=224213
I was joking Nhail, I don't expect you to solve this 😂
Have you tried the solution you gave me?
I guess with multiple installs it wouldn't necessarily apply
it's a different issue, in short:
I've installed mainline kernel on sda3 and sdb3, sda3 is with ext4 and sdb3 is with btrfs, but I can't boot with the ext4
You installed it across both? Like a sort of RAID setup?
as I said I was kidding, though it's technically a tri-boot as I do have a windows partition
@deft dome hope you don't mind the ping, I believe you have a silly kernel name, I wondered if that might be the solution here?
.aw grub
lemme check this
I thought you meant for me 😂
u dont have to mount the efi parts for grub-mkconfig to find them
I nuked /boot and made /boot/efi on both ext4 and btrfs, and then reinstalled arch there once, and reinstalled the kernel and the intel-ucode on both, then ran grub-mkconfig from the btrfs arch, at first it only showed btrfs arch, but now it seems to show both. I'm not really sure why.
It's now not showing all of my snapshots, and I want to see if I can get it to select the last grub selection, not sure if that'll be possible or not, given that fat can't write to btrfs, which does a new mkconfig every time I install a package.
Not sure if I would need to reinstall it once more, but from the ext4 partition instead, to get that working?
For now I'll call it a night, not fully resolved.
Also curious some boots it seems to have my keys set to UK, others it doesn't (only on btrfs, ext4 never gets my keys right on boot so far)
I can tell which one is which as one is called btrfsarch and one is called ext4arch, and the usernames correspond like that as well XD
Thanks for your help so far @spare plank and @fading robin
fishie, and deezinit received a thank you cookie!
i think it's because you have all of them mounted on /boot
they will have conflicts with each other since they have similar names
Yeah /boot/efi has had some better results
I'm wondering if I can get my grub mkconfigs made from my btrfs to save to my ext4, in the hopes of being able to recall the previous entry
I mean I'll try that but I doubt it'll pick up on the btrfs snapshots
if you mean grub-btrfs then it probably wont
:/
so the main question there now is can my ext4 ever see the btrfs snapshots so that they can be included in the makeconfig
so if I mount my @snapshots subvolume, mkconfig on ext4 won't find the root (perhaps because both have the same UUID and it's from EXT4? but if I unmount the @snapshots partitions then it can find the btrfs root at least, but no way of, so far, finding the btrfs root and the snapshots from doing a mkconfig on ext4
But nope, now btrfs won’t load. Guess I’ll try reinstalling grub again.
did you manually make that entry?
cus that should be relative to the id5 subvol
and you should also add a rootflag that specifies the subvol to be used as root
I haven’t manually touched the cfg at all
L for grub for not being able to generate a correct config then
Hoping I can eventually get everything setup manually
I’m not convinced it’s not a skill issue on my part
You mean so it says subvol=@?
yes
or one of your snapshots
so this is what I've got for my fstab entry to mount the btrfs when I boot up ext4:
UUID=cd6bf273-37c9-4a0b-84e7-bdd383d32d74 /mnt/btrfs/rootsys btrfs rw,relatime,compress=lzo,ssd,space_cache=v2,subvolid=256,subvol=/@ 0 0```
I'm wondering if it's the / that's the problem?
I'll remove that and mount manually and see if that helps
no the problem is the path for the kernel and initrd and because it doesnt have a rootflags for the root subvol also
@ is on toplevel right?
yes
it should be /@/boot/vmlinuz-linux then
same with the initrd
you would also need rootflags=subvol=@ in the kernel cmdline
would that mean that every kernel update I'd need to manually change the kernel cmdline?
also what you're proposing is completely outside of my knowledge so I'm a bit lost on how to do any of that :p
but in that case youre better off making another entry
I'm very much outside of my knowledge zone :p
if I'm doing that I just do this:
mount /dev/sdb2 /mnt
nano /mnt/@snapshots/*/info.xml
#Find snapshot you want, go between files by using alt + , and alt + .
#when you have the snapshot you want, remember the number.
#for every file open do:
ctrl + x
rm -rf /mnt/@
btrfs subvol snapshot /mnt/@snapshots/<number>/snapshot /mnt/@
I'll have a google of how to change the kenrel cmdline I guess
aye that's what i used to do but you dont really need an iso
do you mean grub_cmdline_linux_default when you say the kernel command line?
as in, in /etc/default/grub
uh no im talking about the one in the grub.cfg
next to the path of the kernel
oh manually changing the .cfg
will I need to change that every mkconfig?
just makiny a test .cfg in my documents to play with I guess XD
you can just
sudo mv /mnt/@ /mnt/borked
sudo btrfs su sn /mnt/snapshot/thesnapshot /mnt/@```
then reboot
if you use the esp on /boot you will need to do an extra step which is mounting the esp on /mnt/@/boot (this is after the switch)
then arch-chroot /mnt/@ pacman -S linux
then just reboot and delete the old borked subvol
nah you can probably find a way to do it automatically but yeah, i think this would be easier if you use refind
I'll have to read about that later, as I'm messing with grub for now
this is all a valuable learning experience for me though
I might try refind and systemd-boot later
Yeah this is shockingly different
on the left is my mkconfig generated from ext4
On the right is my mkconfig generated from btrfs
yeah copying a chunk from the btrfs generated mkconfig to the ext4 mkconfig has allowed grub to load btrfs, which is useful, I just wish I could make the ext4 generate it correctly, and also pick up on snapshots, and also have the btrfs mkconfig write correctly but preserve the mkconfig to the /mnt/ext4/boot/grub/grub.cfg
have u considered swapping the roles and setting up grub from the btrfs partition?
that would I believe stop me from doing the last thing I want to do which is set grub to select the last selected option, which is what I'm struggling with
My solution thus far has been:
Install grub using ext4 as root.
Then from the snap-pac-grub aur package, edit this file it makes:
sudoedit /usr/share/libalpm/scripts/grub-mkconfig
I've changed the grub-mkconfig to be /mnt/ext4/boot/grub/grub.cfg instead of the normal /boot/grub/grub.cfg
And always do the grub-mkconfig as such from btrfs
can grub-customizer not set that for u??
never making the grub-mkconfig from ext4
i see
the traditional way of doing it is editing /etc/default/grub, I've edited both the ext4 file and the btrfs file, but I can't do that, the issue is on btrfs you can't have it done, I'll get the relevant part of the wiki page
i see i see
those two lines explain why:
This will only work if /boot is not a btrfs, because grub cannot write to btrfs. But it will generate a misleading error message: "sparse file not allowed. Press any key to continue.".
I'm wondering if that simply won't be possible at all due to this setup, I don't understand enough
do u actually get that error tho? i have /boot on btrfs and grub works fine?
perhaps the wiki is out of date as grub did used to have problems with btrfs
yea
given that the mkconfig is on ext4 I think it should work, but instead of getting the "sparse file not allowed" I'm just not getting any change behaviour
it will be nice when grub can write to btrfs, as that'll solve all of this headache :p
this is very much just a nice to have QoL as well
not a "I'm throwing everything out"
it is interesting that grub on ext4 is seemingly incapable of automatically making a correct config for btrfs subvolumes
Oh it works fine I just forgot to redo mkconfig from btrfs
Hahaha
Beautiful
Will rewrite the solution at the bottom and mark as solved soon
awesome :)
Solution: In order to be able to have the grub menu work, and be able to use grub tricks, the following must be done:
1) mount ext4 to /mnt and the EFI partition to mnt/boot/efi (you'll need to create that directory), then chroot in
2) do grub-install
3) install the kernel and ucode in ext4
4) exit
5) umount EFI and ext4 root
6) mount btrfs (in most cases it'll start mount -o subvol=@ /dev/<insert here> /mnt) and then the EFI partition same as above mnt/boot/efi (will need to mkdir again), and mount the ext4 onto /mnt/mnt/<any further mountpoint you choose to make)
7) install the kernel and ucode
8) do the mkconfig from btrfs, but do it to /<where ext4 is mounted>/boot/grub/grub.cfg
9) exit, reboot into the live system, and install the packages you want.
If that includes a package that does the mkconfig on every package installed, as I have a snapshot made every time I install, uninstall and update, then you'll want to edit a file, in my case I used the package from the aur: `snap-pac-grub'. I found out which file by doing `pacman -Ql snap-pac-grub` and realised the file I wanted was:
/usr/share/libalpm/scripts/grub-mkconfig
I edited that so that the mkconfig changed from:
/boot/grub/grub.cfg
To:
/mnt/ext4/boot/grub/grub.cfg
Finally I wanted it to select the last selected boot entry when I used grub, so I did the standard change to:
/etc/default/grub
so that the top now reads:
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
And then installed a package as that would automatically create a new grub-mkconfig.
That behaviour wouldn't work if I was writing to my btrfs partition, but instead as grub was installed from ext4 it is writing to ext4, so this can work. If I were to do a new mkconfig then the last selected option is wiped, and it goes to the top option, but if I'm doing a mkconfig it's from btrfs anyway, so it is correct by accident!```
If any of the above doesn't make sense to anyway and you want an explanation, please let me know
and to clarify:
pacman -Ql <package> shows you the files that a package owns, which is why that was useful, as snap-pac-grub automates a new grub-mkconfig with every update, install and uninstall from pacman.
[solved] multiple arch installs-same kernel, how to populate grub?
@compact minnow when you run grub-mkconfig and os-prober picking up btrfs as a secondary OS it seems unable to create the correct .cfg entry for btrfs, you have to actually be in btrfs. If you have multiple Linux OSes that are btrfs then you seemingly need to manually change the .cfg, but if you are running it like o do that means a manual cfg change every time you do an update, uninstall or install a new package