Boot too small - Rebuild

My guess for the size of the Boot partition for my 9.5 machine was wrong, too small. I suspect the proper move is to reinstall, not try to fudge partitions.
So does anyone know of a tool that will spin through the system, copying out or scripting all of the settings, changes etc. This would be a “magic” rebuild script.

I’d like to scrape the drive, and run the magic rebuild script and go back to work.

I can’t be the first lazy person with this problem.

I did something a number of years ago with CentOS that you can do. It’s not magic, unfortunately, but it does tend to get the things that you might miss.

  • First, make a backup of your data. (that’s obvious I’m sure)
  • Second, create a directory off-server somewhere where you are going to store scripts, and things out of /etc/
    *Third, make a copy of your repositories in this off-server location. Whatever is in /etc/yum.repos.d/
  • Next, make a listing of your Installed packages with dnf list installed > installed_packages.txt
  • Verify you have everything then nuke and re-install your machine.

When you are back up and running, make sure you have your repositories re-installed, then script that installed_packages.txt file and pass everything to dnf install… I don’t remember my exact procedure, but I do remember that it worked.

Anyone else with some magic for @crazyoldguy?

Good luck!
Steve

Thanks

Get [BlueMail for Android]

Hey @crazyoldguy, I had a few minutes today so decided to give you a procedure to do this. It’s dirty, I’m sure that there is an easier way to do all of this. This is just the reinstall of the packages portion. I already talked about creating the installed.txt file above.

dnf list installed > installed.txt

This file will have some unwanted content. All you want is the package name, which is in column 1. To get this, you can use awk to get only column 1’s data. Here I’m outputting to a new file (new_installed.txt), but there may be a way to do this in place, but this is what I did:

awk '{print $1}' installed.txt > new_installed.txt

Now there one item at the top of the file “Installed” which comes from the dnf list installed command. You don’t want that, so remove it with:

sed -i 's/Installed//g' new_installed.txt

This leaves a blank line, which may or may not cause a problem, but to be sure, you can just remove that with another sed run:

sed '/^$/d' new_installed.txt > installed.txt

Now everything is as it should be in the installed.txt file, so copy it off for safe keeping.

Reinstall and get the machine back with all of the repositories as mentioned in the first reply, and then copy your installed.txt file over to the new machine, and run:

sudo dnf upgrade

This just gets everything that has been updated since creating the .iso image. Now populate your machine with the installed.txt file:

dnf -y install $(cat installed.txt)

When you are done, you will have all of the packages back.

Sorry I didn’t just hash this all out a few days ago when you originally posted.

Thanks,
Steve

rpm -qa >> installed.txt

will create just the needed rpm names without having to do the followup edits. Though I would remove all the kernel rpm’s from the list.

What would you get with:

dnf list installed | awk 'NR>1 {print $1}' | sort -u > installed.txt

Ideally, one would have used list of dnf groups and packages when originally installing them.
If one had that, then one could re-use it.

There should be anaconda-something file in /root/ that has list of what the installer did add.
The dnf history in principle shows what has been done after install.
They are not as easy to parse as dnf list installed, but a shorter list as a lot of packages are just dependencies pulled in with installation of other packages.


/etc, /var, and /home may all have config or data.

The /root/.bash_history might also have something to remember, although it by default has at most 1000 commands.

You are correct, this single command works much better! I said that the procedure above was dirty. :slight_smile:

Another good idea to remove the kernel rpms.

sed -i '/kernel/d' installed.txt

But should make no difference:

# dnf install kernel bash
Last metadata expiration check: 0:16:37 ago on Thu 06 Feb 2025 09:54:18 AM EET.
Package kernel-5.14.0-503.19.1.el9_5.x86_64 is already installed.
Package kernel-5.14.0-503.22.1.el9_5.x86_64 is already installed.
Package bash-5.1.8-9.el9.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

Even the Minimal Install (or cloud image) contains several packages (including kernel) and it is a no-op if you ask dnf to install then “again”.

I had the sort -u to reduce multiple “kernel.x86_64” lines into one (even though repeats are not an issue for dnf either).

1 Like