What do I need for an OS reinstall?

Hey yall,

I have been using my EOS for around 1.5 years now? and I’ve just been tolerating some problems that I have had for the longest time, like my brightness controls not changing (this one I’m not sure why I couldn’t resolve, even after scraping through forums a lot, it might be because of what software I flashed my USB drive with?).

The recent Plasma 6 release though just borked so much of my stuff that I’m calling it (many widgets aren’t working, the OS’s bandwidth is low when using yay even though a speed test on Google says otherwise).

I haven’t done any OS reinstallation before, so what do I need to save before wiping out the partition and reinstalling? (Not sure actually if there’s a way to do it without wiping the partition).

  • I’ve found that pacman -Qqe lists out all installed packages, but how can I filter it to only show packages I installed myself?
  • Besides this, do I just need my files + my dotfiles in home? Are there any other things I need to save?

Thanks so much in advance!

My normal way of doing an OS reinstall is as follows

  1. I do a backup of my home folder and those few system files that i have modified.
  2. I have a package list file that I update every week with my current list of packages. I then just use the List to reinstall the packages I use. I have a very convoluted command for going through the package list and not running errors for aur packages. I have modified it in the past doing a diff between the command for listing packages and the command for listing packages that were installed from the aur.
    pacman -Qm
  3. I have a separate drive with my /home partition on it so I just replace the existing OS partition in the installer and after the install I use my packagelist and a custom script to help set my system back to the way I use it.

I do my package list after the OS install just to ensure that the default OS packages installed without issue and making sure I don’t have to do any fixes before trying to install all my stuff then try to trouble shoot the issue.

Since KDE just updated to version 6.0 you may want to be very selective on the dot files you put back as some may not be compatible now. Infact it may be best to avoid using your dot files that are KDE specific and just keep the ones you use for other programs.

Good Luck

2 Likes

I just save my home folder. I don’t save config files because I generally assume if I liked my current setup, I wouldn’t be reinstalling.

5 Likes

I’ll keep these in mind, thanks!

Also, I clicked on your profile and found your idiot’s guide to maintenance, and didn’t know that updating mirrors was one of these things :skull:. In fact, I don’t think I have been doing most of them, so thank you for that! Now, the internet connection problem is gone, I think :smile:

1 Like

Glad to help. Many many folks have found a lot of good use from it. It’s not the only way, it’s just one way.

Reinstalling won’t help with the issues you’re describing…

They’ll stop working on a new install, too, as soon as you update. Old widgets are not compatible with the new Plasma.

Fix your mirrorlist. It’s not your internet speed that’s the problem, it’s the mirror you’re using.

No need to reinstall anything.

2 Likes

Correction:

pacman -Qqs lists out all installed packages. pacman -Qqe does exactly approximately (see dalto’s reply below) the thing that you mentioned. -e stands for explicitly installed.

Not exactly, the packages installed from the ISO will also show as explicitly installed.

What would be the most reliable way to fulfill this use case, in your opinion? The only thing I can think of is parsing the pacman log file based on the installation timestamp or use a tool like expac (e.g: excluding packages installed prior to timestamp X from the list). Even this approach seems rather hackish to me.

Diffing the old list and the new list (generated from pacman -Qqs in the fresh installation) is also unreliable because the list of installed packages will change across different ISOs.

When I reinstall with my package list i use the --needed flag This will allow pacman to skip those apps installed already by the installer. I find this to be much less work than trying to diff package list. I occasionally go through the list and remove any packages that I may no longer use or need. But its very little maintenance to do

Yes, basically you need to go through the log and find the list of packages installed with the ISO.

Then remove those packages from the result of pacman -Qqe.

You should also grab pacman -Qqm so you have your AUR packages.

3 Likes

I had to go through the man page for pacman again because I wasn’t aware of the existence of --needed. Thanks for pointing that out.

1 Like

I use to do this as well with --needed flag.

In the old install: pacman -Qnq > native.pkg.list

In the new install: pacman -S - --needed < native.pkg.list

Don’t know if this is the most “elegant” way but it gets the job done.

1 Like

Will something like this work? The idea is to filter paclog’s output to obtain the entries that are logged prior to the creation of the user’s home directory.

$ paclog --before="$(stat ~ | grep "Birth" | cut -d " " -f 3,4)" | grep "installed" | cut -d " " -f 4

Assumption:

The installation of system packages takes place before the creation of the user account. This is true on Arch, where the user has to create a user account manually after installation. I’m not 100% sure if this is the case for Calamares installations.

Should be pretty close. As long as the user account you are using is the one that was created at install time.

Other than that, I would use --action=install instead of grepping. Also, I would add | sort | uniq at the end to remove dupes.

For the most part, this is a valid assumption. The vast majority of the packages get installed before the user account is created.

1 Like

Yeahh, I think I got slightly frustrated when I had to complete some pressing deadline and my workflow has been disturbed :sweat_smile: though reinstalling had always been at the back of my mind because of my screen brightness always being broken no matter what I tried ¯\_(ツ)_/¯

But yeah, I have the mirrorlist updated now!

Just back up your /home/ and if you have edited any files within it, /etc/ as well.

That’s it, yeah.

You can apparently do a soft reinstall with pacman -Qqn | pacman -S - which, if successful, reinstalls all packages from the official repository. (mentioned before btw)

And you can do a less soft reinstall by using something like pacman -S $(pacman -Qqn) --overwrite '*' which reinstalls the packages and forcefully overwrites any file normally installed by the package with the default version of it, so some of your system configuration will get reset by doing this (but not all, and pretty much only configs in /etc/ will be affected, unless you actually configure something in /usr/… which imo you generally shouldn’t do (I actually never do); so back that up before you run this and be prepared to just reinstall anyways if something goes dramatically wrong.

That’s a terrible idea.

2 Likes

Yes, it is. But if he’s reinstalling anyways, it’s worth a try.