What's the best way to import / export package lists between installations?

I’m going to do a clean reinstall of openSUSE on an SSD I’m getting next week. The new install will contain the exact same software as my old one, and of course I don’t wish to remember and manually reinstall every custom package I’m using. Therefore I’m looking for a safe way to export my current package setup to a text file on my home partition, and once the new installation finishes simply import that in, after I also reconfigure my RPM repositories which I can easily do manually. There are a few ways to achieve this, but not all of them are as obvious as I’d have hoped… it thus felt safest to ask about this in case anyone has any better ideas.

The only user friendly method seems to be with YaST: When you go into Software Management and click File, you have the options “Import…” and “Export…”. Export generates a file called user-packages.xml which Import can then bring back. If nothing goes wrong that’s likely the method I’ll be using, but I wanted to have a failsafe in case there’s any problem with this one.

The other way I was hoping for was with zypper, however it doesn’t seem to have a builtin command for this sort of thing. I did however find a thread explaining how to use a combination of rpm and zypper commands to transfer package lists between machines. I wanted to ask if that approach was tested and is going to actually work. Here is what I’ll be using:


rpm -qa --queryformat "%{NAME}
" > /foo/bar.txt


zypper install $(cat /foo/bar.txt)

Note that I’m trying to avoid formats that also include the package version, only its name and arch. It’s for the unlikely event that during my installation, openSUSE decides to release a new OS snapshot and update countless packages, in which case the versions would no longer match and the import process may complain it can’t find those packages. I only care to have the latest version of everything as installed by ‘zypper dup’ so this shouldn’t be a problem. Which method do you recommend?

1 Like

What you describe as your second option is what I did last year when I had to replace my laptop. Mind, I did reuse ( parts of ) /etc and /var


For that purpose, that Import syntax should work because package names are not allowed to have spaces in them.
Also only the package name should appear from that output, so you don’t have to worry about the version being mixed up.
I always do almost similar way when installing in a vm and upgrading to a new openSUSE version.
So I suggest you try it a vm first if that makes you feel more comfortable.


rpm -qai | grep "^Name        :" | awk '{print $3}' | xargs > rpm_pkgs_list

IMPORT/INSTALL then exported list of software packages into new system:

zypper in $(cat rpm_pkgs_list)
1 Like

Reinstallation finished. The YaST2 - Software Manager xml did the trick perfectly, I didn’t even need to try the package list I exported manually. I’ll still keep doing backups both ways so that I always have a failsafe in case one option doesn’t work for any reason.

Thanks for all the tips. I’ve had a lot of issues with import export functionalities and I hope I’ll be able to solve them.