Score:0

How to reinstall (a large group of) packages

pm flag

My main system (Xubuntu 20.04.) is in deep trouble. I see no hardware problems, but only very basic things are working. Web is down. My RAID is down. Several other things are flakey. I don't know if it's configuration or the actual programs.

I've made a clone of the main disk, so I can be a bit adventurous, but there are some basic tasks that I would like to do, but don't know how. The first is re-installing all the software I can. Not just the default stuff, but every package I ever installed. SO:

  1. I've read about how to do "something else" to do a refresh of the initial set of programs So I can already do that.

  2. There are various kinds of configuration files. I've been running Ubuntu for a couple of decades so there's no chance I remember them all; is there a way to find their locations? Can I ensure they are safe, or restorable?

  3. How do I reinstall the packages I have installed manually. I've got lists of all packages from three sources: (1) dpkg --get-selections, (2) apt-mark and (3) apt list, but don't see how to use them directly to cause packages to be refreshed.

In response to the first answer, I tried this script

apt update
dpkg --set-selections </PACKAGE-LISTS/b5-getsel
apt-get dselect-upgrade

but it made no changes to the installed packages, in spite of the file having >3000 lines, specifically including vim(1), which I sorely miss.

How can I debug this?

guiverc avatar
cn flag
You can re-install Ubuntu Desktop (*inc. flavors*) and it'll auto-reinstall the *manually installed* packages. If those packages are desktop apps, those configs/setups will survive this install; as those config files are stored in $HOME (ie. /home/$USER) and untouched unless you format!. Only server apps (*which can store configs within system directories*) OR any desktop configs that you've made system wide (*thus were placed in system directories, for a multi-user machine*) get lost; but that's rare for desktop systems.
guiverc avatar
cn flag
Your main question appears to be about apps; however App configs are app/package specific so maybe in many places. There are many standards to choose from, so the app developer gets to choose, though the packager can also alter it... GNOME apps tend to follow one standard, KDE another, Xfce..... ie. the apps involved (*you gave no specifics*) influence where those are found; though MOST apps from teams (eg. Xfce) tend to follow the same rules, there is no guarantee even of that.
guiverc avatar
cn flag
Just FYI: (*& sorry if this is off-topic*), but have you tried [Ubuntu Forums](https://ubuntuforums.org/)? as if it was me writing this question, I'd have used a forum rather than a Q&A site which requires questions to be specific on a problem that needs to be solved. Forums allow suggestions to be given easily & more completely (*and not deleted as my last comments aren't about your question itself & suggestions for improvement/clarification*). The box I'm using now is a recent build (*new second hand box, as my old box PSU died*) so I'm grabbing my old configs from backups etc
user535733 avatar
cn flag
This looks very much like the [question that you asked yesterday](https://askubuntu.com/questions/1452544/how-to-replicate-the-list-of-installed-packages-on-another-installation). There's no easy way to accomplish what you seek. And, since you are likely to have follow-up questions and issues, I am uncertain if AskUbuntu's format is suited to your issue(s).
ForDummies avatar
pm flag
Thanks for the advice. I'm taking most of this over to forums, which I was not aware of (or have forgotten about -- I was last doing this stuff over a decade ago).
Score:0
gh flag

this makes a list of your installed packages and export it. This is for your old system.

dpkg --get-selections > my.selections 

The next imports the package.list this is for the new system. So you need the created file on your new install.

sudo dpkg --set-selections < my.selections

Now you can run

 sudo apt-get dselect-upgrade

Make sure you have the same package sources active like before.And refresh it before with

sudo apt update
ForDummies avatar
pm flag
FAILURE: I just got far enough along in the recovery to try this, and it failed to make any changes at all. My selection file has 3299 lines, and dpkg reported nothing new was added. I checked, for instance, that vim was in the selections list, and is still not installed in this system. How can I debug this?
ForDummies avatar
pm flag
I added the script I used to the body of the question
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.