Kubuntu 23.04 update wiped out GRUB

I just spent an hour trying to get back into LM after my dual boot system with Kubuntu needed updating. I updated (which took forever and a day as I believe it updated the kernel) and rebooted Kubuntu to apply the updates. When it finally finished, it booted straight into Kubuntu, bypassing my grub menu, which used to default to LM.

I finally found a way from within Kubuntu to install the boot repair tool and have it scan/repair the grub, after failing to have grub repair itself from the grub advanced menu–it did not.

Now my grub has items it did not have before, i.e. two entries for memory test??. I didn’t get to snap a photo of it before it went to LM.

Any idea why the update in one Linux OS killed the grub that included the other Linux OS?

Is there a way to get back my old grub? I have Timeshift on LM (haven’t stayed in Kubuntu long enough to have a recent one) but does that restore grub?

Thanks,
Sheila

The Kubuntu update , if it updated the kernel, would have included an update-grub command… so that grub would
boot the new kernel.
If Kubuntu does not have os-prober installed, the update-grub would not have detected the other Linux, so it would not appear in the grub menu.
I am assuming that Kubuntu is the Linux that controls grub… ie the one that originally installed grub , and the one that stores the grub config files.

If LM had been the one controlling grub, the kubuntu upgrade would not have altered the grub menu. You would have had to go into LM and do update-grub there, to update the grub menu so it would see the new kubuntu kernel.

So it did not destroy grub, just made a mess of its menu. Because it only found kubuntu, it may have byoassed the menu and just booted… it depends, dpsome distros do that, others always make a grub menu, even if it has only one item in it.

Managing multiboot is not straightforward.
The survival recipe is

  • make sure you know which linux controls grub
  • if the non grub controlling linux updates a kernel, go to the controlling linux and do
    update-grub there
  • never do grub-install from the non controlling linux… you will make it the controlling linux.
  • make sure os-prober is enabled in the controlling linux

If you follow that managing multiboot is
a breeze

2 Likes

@nevj I did not know that having two Linux installs has one controlling grub. Another notation for Linux notebook. HA!

So I guess I did okay in repairing the grub from Kubuntu, as it must be the controller since it was installed first; LM added later, but I don’t like messy grub menus.

Have not dealt with os-prober.

Thing is, I just did my research this morning prior to this mess on getting rid of Kubuntu as I am running out of disk space between the two. So in the next few days, I intend to try and follow these instructions to delete the partition where Kubuntu resides and just have a single boot Linux Mint on this machine (I have other machines with Kubuntu and Pop OS so no longer needed on this one):

When resizing a partition you need to consider to which side the partition will grow, if you want to grow to the right for example, you don’t need sda3 and want sda2 to use that space the solution is deleting sda3 and resizing sda2, but in your case you want to resize sda3 to the left(taking sda2 space), the solution for this is more involved:

BEFORE THIS CREATE A BACKUP OF YOUR DATA

Boot in to a live iso with gparted installed.
Delete the windows partition (sda2)
move the ubuntu partition to the left(sda3) DO NOT RESIZE THE PARTITION YET
once the move operation is complete you can resize the partition to the right.
if you are using a bios system then recreate the GRUB install, but if you are using an EFi system this step is not required.
and that’s it.

NOTE: UNDER ANY CIRCUMSTANCE CANCEL OR STOP THE MOVE OR RESIZE OPERATIONS OR YOU WILL LOSE ALL YOUR DATA!

Please advise if this is not correct. I am using clonezilla first to image the entire disk before proceeding with the above.

Thanks,
Sheila

UPDATE: After re-reading my topic Change dual boot to single boot like I did on the newest tablet, I think it would be easier (I think) to just move my LM home directory to my external HDD. I had already made partitions on THAT 5 TB drive for both Kubuntu & LM to store the timeshift backups and in case of future decision to move home. So current home dir on LM internal SSD is 350 gb; partition on external HDD is 1.2 TB. Now if I just don’t mess up the fstab. BUT, don’t think I can move home from Kubuntu as it is 400 gb on internal partition and I only allotted 595 gb and 200 is already in use. That leaves the internal Kubuntu parition with 40 gb free. Maybe I can just move the large home folders/files to the external so to free up more space on that install.

Is it going to be noticeably slower having home on an external HDD (not SSD) than on the internal SSD? Albeit, I had been grumbling about my LM system getting slower and then noticed I have 10 gb left …duh.

What do you think?
Sheila

So just because there is a grub.cfg file on both installs does not mean they equally control? Just need to be sure which is the controller if I decide to keep both.

sudo os-prober:

/dev/sda2:Ubuntu 23.04 (23.04):Ubuntu:linux

That would be Kubuntu 23.04 is controlling grub, right?
So if I do keep it and LM does kernel update, I still need to use Kubuntu to update grub? Cause the above probe is from LM, meaning it has os-prober installed.

Sheila

If Kubuntu is the grub controller, and you are going to get rid of it, you need to make LM the grub controller.
Go into LM and do
grub-install
and then
update-grub
then reboot , and you have it .

Instead of moving home directory, consider doing this.
Make a new data directory on your externel HDD. Format it , and mount it to something like /data. Make an fstab entry so it mounts every time you boot.
Then, move all your own data files from your home directory to /data, but leave behind all the dot files ( ie files whose name begins with ‘.’ ).
When you work in future, work in /data, not in your home dir.
Only things like the mailer, which stores its stuff in dot files, will use the home dir, so it can be quite small.
You can even use the same /data partition, from Kubuntu as well as from LM… they will keep their dot files on separate home partitions, but share all the rest of your data.

I do not think using HDD for workfiles will slow operation.
Leave the root filesystem on SSD… it is accessed frequently, but mostly for reads. Using HDD for data will reduce writes on your SSD.

Dont forget backup before changing anything.

1 Like

@nevj . Okay. Never thought of the data partition. So a) if keeping kubuntu, first make LM the grub controller, b) move all folders except “dot” ones from each OS to new data partition which both LM & Kubuntu can share. c) update fstab (might need to look at how to write “mount” that each startup) and d) before anything make my disc image.

If deciding to get rid of Kubuntu, , then clonezilla “image” and delete, move, resize partition and use clonezilla to lay only the LM image back on new partition.

Thanks so much.
Sheila

1 Like

In both Linuxes.

and
You only need to make LM the controller if Kubuntu is disappearing.

and
You will find most apps will write their files where you are working, and not go looking for /home/sheila. . So work in /data. You can even modify .bashrc so you go there on startup.

One final question:
My external HDD with partitions already mount in each OS. If I move the folders in current /home directory (i.e., documents, etc.) is there something I need to do each time I create a new document to ensure it saves on the external HDD /Documents instead of to the /Documents folder in the OS /home directory? Don’t want to have to navigate to the correct folder each time I save a doc, pic, etc. Do I need to edit something to point each folder from the OS /home directory to the respective one on the external HDD folder? Use a symlink?

Hope that is clearer than mud.

Sheila

That does not seem to affect me.
I simply work in /data instead of /home.
All the apps I use write to the current working directory.
Maybe that is because I mostly use the CLI.?
so
If an app is launched from an icon or a menu… where does it
write output files? I dont know because I never do it.
I can see what you are saying… some apps are hardwired to /Documents in your home directory.
One way to deal with that is to remove /Documents from your home directory and replace it with a link to /Documents on your external drive partition… I mean a link made with
ln -s… someting like ln -s /external/Documents /home/sheila/Documents

That only deals with Documents , of course.
Might want to do the same with Pictures, or Downloads.

There is always a way. Its a matter of what you find convenient.

1 Like

I looked at some articles on hardlink vs symlink, not sure I entirely understand it (inodes and such) but I remember using a symlink when I previously tried to move my home directory to the ext HDD and it did not work well.

I will see if I can do as you suggested. Didn’t know if I could actually remove the preset folders in home (Documents, Pictures, etc.) without the system automatically recreating them as they did at install.

Thanks,
Sheila

Save the contents first, before you remove them, of course.
Making the symbolic link will look to the system as if they are still there, so it will not replace them.

1 Like

I am wondering if I did the symlinks incorrectly. When you say remove Documents from /home, does that mean I should not have left them and put the symlink inside the original folder?

Reason I am wondering is 1) my script I wrote for a desktop app to ItsFOSS no longer displays the icon which is located in Picture; and 2) should I be able to open Pictures, see the link and click on it and it take me to the files/folders linked to? I should think clicking the symlink should take me to external /Data.

Thanks,
Sheila

No. I meant totally remove /home/Sheila/Documents and all its contents. (saving it somewhere else of course)
then
ln -s whereyousavedit/Documents /home/sheila/Docoments

So Documents in your home directory is now a symlink.

Is that what you did?

@nevj I followed some GUI instructions for using Nemo to create the symlink instead of using terminal. Now that I re-read those, I think I did it backwards. But I thought there had to be a folder in home called docs, pics, etc. to insert the symlink into. So each symlink just goes under /home/Sheila?

Here’s what I used:

To create a symbolic link in Nemo, press and hold the CTRL and SHIFT 
keys then drag and drop a file or folder to another location. Nemo will 
create a symbolic link to the original file or folder at the location you 
drop that file or folder. 

So I was sitting inside the internal Documents folder and while holding Ctrl-Shift, had another window open on the external /Data/Sheila/ and dragged /Document folder from there to my other window /home/Sheila/Documents.

I will try again. So I the mistake was not having the symlinks directly under /home/docs, pics, etc.?

Thanks,
Sheila

That is correct.
You want Eg Pictures in /home/shiela to be a symlink that points to where the Pictures directory is.

I always thought GUI was inferior to terminal for system work.
Your experience has reinforced my view.
It pays to do the hard work and learn how to do it hands on.
I am not being critical… at least you have the guts to try.
I admire the way you tackle things head-on.

2 Likes

@nevj thanks. The difference in CLI and GUI that I could see was that creating the link named the link “Link to Documents” etc. in CLI whereas GUI just named it “Documents”. The reason I gave up on CLI is each time I tried it, it would say either “no such directory” or “there is already…” I am not sure, but opening terminal defaults to sheila@linuxmint-desktop. I tried opening home in terminal, but it still defaulted to “-desktop” so in trying to create the symlink for desktop, i kept getting the errors. All other links were created without issue, only “desktop” had the problem. That is why I looked up how to use GUI to do it.

I think I have it now, as when I select the left pane “Documents” it no longer takes me to a folder on my internal drive showing the “link” but takes me to the files in Documents on external drive.

Thanks,
Sheila

That is what I expected… the link behaves as if it were the actual Directory that it points to.

I hate these Linux versions that open a terminal in ~/Desktop instead of ~.
Freebsd does it too.
I must find out how to change it.

1 Like

Lol @nevj let me know when you figure that out cause now I am heading over to Kubuntu to do all these links again and am sure I will encounter the same issue in creating the “Desktop” symlink in CLI.

Thanks,
Sheila

2 Likes