Backup / restore packages to / from a list using software repositories

In addition to creating images of my partition to keep the system backed up, I’m considering another safety which software repositories should theoretically allow; Backing up my home folder, together with my installed applications. That way, if I ever have to install openSUSE from a scratch (or duplicate my system to another computer) I simply import my apps, copy my home folder back, and it would be like nothing changed. Copying and changing a user’s home folder is basic, but keeping installed applications together with their repository settings and dependencies (Yast being aware of their version and software repo) is a different thing.

With software repositories however, this might be easy to do as follows: Use a backup and restore function that can read / write to / from the Yast repositories, and backup or restore a list of packages (as well as your repository configuration). In other words, a feature to create a text file (xml or whatever works) which firstly lists your repository settings, then includes the name of each package installed on your system… with information about which repository it came from, its version, what dependencies it has, etc. Then when loading this text file on a fresh system, it would automatically set your repository configuration to what’s located there, then download and install all packages on the list. The end result would be having the exact same packages installed as on the other system, without having to find and click each one manually. The backed up home folder would then take care of putting the settings back together.

An even better option would be to only backup the package names, without trying to re-install the exact same versions from the same repositories. So when loading the script, it automatically finds and installs the latest versions of the packages you backed up using the repository priorities in your configuration, while skipping packages it doesn’t find. Dependencies would also be re-detected in real time when checking each package, not remembered in the backup and searched for exclusively. This would be a very easy and flexible method of duplicating / keeping your list of installed packages, and could even be used to sync multiple systems online (by having a program installed on one computer automatically install itself on another, I think this is already possible on Android Market with smartphones).

Does Yast have a feature which makes this possible, or is there another program that can do it? I noticed the System Backup / System Restore tools have a checkbox to “only backup a list of installed packages”, but I haven’t tested it and don’t know if that’s exactly what I’m looking for. It would make a properly backed up system much safer and easier :slight_smile:

I am keeping a file “Customize.log” where I write notes about software that I have added after installing, config changes that I have made, etc. I keep that in a root-owned directory under “/home”. I put it there, because “/home” is a separate partition in my setup, and will be retained after installing new versions.

For the next version, I will rename “Customize.log” to “Customize.log.old”, and start a new Customize.log. That way, I can peek at what I had previously done, while customizing the new system.

My “Customize.log” is relatively small. Where I make changes to config files, I use the “rcs” commands (including “ci”, “co”) to keep a record of the original version of the config file and the changes that I have made.

Oh, that directory under “/home” is actually “/home/RCS.etc”. I make a symbolic link so that “/etc/RCS” acts as the same directory, and that makes it easy to check/checkout different versions of configuration files.

I did not read everyting in your long post, But to keep a list of repos you can use zypper and redirect the output to a file somewhere in a nice directory inside your $HOME. Then it wiill go with the backup of it. Something like

zypper lr -d >system-info/repo-list

(assuming that you created the directory system-info first of course).
And a list of al installed RPM packages:

rpm -qa >system-info/installed-rpms

or variants of this, read the man page of rpm.

the program rpm will list all packages currently installed

rpm -qa

note that rpm is the program the actually installs most things. You might want to look at
info rpm
to see how it is used

On 2012-09-30 22:16, MirceaKitsune wrote:

A full backup is easier and safer: you can always forget something important.

The list of repos can be restored with a script of zypper something commands. Or backup the
files in “/etc/zypp/repos.d/”. A list of packages installed from what repos, no, that doesn’t
exist. You also need to list also what packages changed repos and to what. It is stored as a
database. It is mostly “/var/lib/rpm/” and I don’t know what more.

Autoyast can be used for some of what you want. Don’t ask me how, I never used it. There is not
an automatic yast feature to backup and restore the installed packages from the appropriate
repos - yast backup does some of it, but i don’t know how it copes with different repos.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

rpm -qa lists ALL installed packages. For a backup I find it more useful to know what programms I’ve installed by commandline (without dependencies that are installed automatically). You can take a look at /var/log/zypp/history. There are all installed packages listed, including repos alias. The history log is not as readable as i.e aptitude.log, which shows more obviously what packages were installed manually. But you can search the zypp history file for the string “root@$HOSTNAME”. Packages with this string were manually installed. It looks like this:

2012-09-26 15:11:28|install|gparted|0.12.1-2.1.2|x86_64|root@Nibbana|repo-oss|

$HOSTNAME is here Nibbana. On most installs it might look something like “linux-5d0j”.

Packages installed as dependencies looks like this:

2012-09-26 15:11:29|install|snapper|0.0.11-2.4.1|x86_64||repo-update|

Thanks everyone. I shall look at those commands later when I’ll get to attempting such a backup, still a lot to configure around openSUSE for me.

From what I read however, I mostly seen commands about listing packages being mentioned. I’m not sure if that by itself is exactly what I need. I’m looking for a consistent backup + restore system that can create and apply package lists, as a native / intended feature (not generating a list with various commands then me looking for ways to load it into Yast). I’d also prefer those lists to not contain package dependencies (as I’d like those being discovered in realtime), not contain package versions (just the name, always look for the latest version) and to be honest I don’t need it to contain my repository setup either… just use the existing one and find the packages there (it’s easier to backup and maintain it separately).

Once again, I remember the System Backup / System Restore tools in Yast have a feature to do this, but someone mentioned it’s not very consistent. What does it do exactly, and has anyone else tried it? Also, I think I might know a system that could work which I used for installing the restricted formats… ymp. When I click ymp files, a Yast window pops up and I’m asked for a setup. Once I confirm it, the packages listed there are installed. Question is, how can I generate ymp files for personal use that work the way I want (if of course ymp is even consistent for such use).

On 2012-10-01 23:06, MirceaKitsune wrote:

> Once again, I remember the System Backup / System Restore tools in Yast
> have a feature to do this, but someone mentioned it’s not very
> consistent. What does it do exactly, and has anyone else tried it?

You try and tell us :slight_smile:

> Also,
> I think I might know a system that could work which I used for
> installing the restricted formats… ymp. When I click ymp files, a Yast
> window pops up and I’m asked for a setup. Once I confirm it, the
> packages listed there are installed. Question is, how can I generate ymp
> files for personal use that work the way I want (if of course ymp is
> even consistent for such use).

Dunno. Interesting.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

I haven’t tried the last suggestions yet, but I noticed something else: In Yast - Install Manager, if I go to the File menu there are options to Import and Export file lists. Anyone familiar with what this does exactly and how it can be used?

On 2012-10-10 12:36, MirceaKitsune wrote:
>
> I haven’t tried the last suggestions yet, but I noticed something else:
> In Yast - Install Manager, if I go to the File menu there are options to
> Import and Export file lists. Anyone familiar with what this does
> exactly and how it can be used?

Try :slight_smile:

It saves an xml file, with no repository info (and no vendor).


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

I believe I found two solutions to this question. Since threads like this tend to be found on google by people who have similar questions, I thought to post what I’m using to backup packages to lists:

Solution 1 - Apper: Open up Apper and go to Installed Software. Toward the top you’ll see a button for “Export installed packages list” and to its right one for “Install packages from list”. Use these to import / export a .catalog file of your programs. This also seems to skip dependencies and unnecessary entries, and I recommend this method.

Solution 2 - Yast: Open up Yast and go to Software Management. Expand the File menu and you have options for Import and Export which create / use xml software lists. This also adds dependencies to the table however, and doesn’t seem to separate them from packages installed by the user’s choice, so careful about using it.

Yes, I have done this in the past because I thought it would save me time.

It actually caused more headaches!

This is because there could be a bug…

When importing the exported list you made earlier, YaST will not know what repos to grab the actual package from even with ‘priorities’ applied.
Even though you can examine the contents of this exported xml file and it shows what repo and version numbers the packages belong too, it does not care and will install from whatever repo it finds it in first - this means it usually tries to install the package from the default openSUSE repos.

Like say I install package.2.x.x.rpm from repo-thirdparty and export the list from YaST then when I import that list again YaST may instead install package.1.x.x.rpm from repo-oss instead.

This was the behaviour I seen from 12.1 but haven’t tried it out for 12.2 and I never filed a bug for it so it likely hasn’t been fixed.

Interesting. I made a new list on a laptop running 12.2 and sure enough those repos aren’t there in the xml file from YaST Software Management.

I remember the repo was specified in the 12.1 xml file and I was scratching my head as to why it wouldn’t acknowledge it when importing.

I wonder if Apper will notice the repo the package came from? I don’t use it or have it installed so can’t test.

For me, the Yast method doesn’t seem to save repositories as well. I’m fine either way, but saying the result I get.

On 2012-11-22 20:46, saultdon wrote:

> This is because there could be a bug…
>
> When importing the exported list you made earlier, YaST will not know
> what repos to grab the actual package from even with ‘priorities’
> applied.
> Even though you can examine the contents of this exported xml file and
> it shows what repo and version numbers the packages belong too, it does
> not care and will install from whatever repo it finds it in first - this
> means it usually tries to install the package from the default openSUSE
> repos.

You could report that in Bugzilla. And point here the number.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))