I looked into it further: the --user-installed flag does seem to exist, but only in newer versions of zypper, typically in rolling-release systems like openSUSE Tumbleweed or recent SLE updates.
If you’re on an older version - such as openSUSE Leap - it’s likely not supported, which is why the command failed for you.
Since this option is probably not available across all systems, this might be an alternative approach you can try zypp history… :
Did you try it this way? :
Check the zypper history log
grep 'install ' /var/log/zypp/history
This should show packages installed explicitly by user commands, including timestamps.
But: it may still include dependencies if they were installed as part of a command.
No idea if it would be useful enough for you.
Sorry, I seem to have run out of any other ideas.
Perhaps someone else might be able to help you.
Hi @Rosika thank you for your suggestion. I have just done a fresh install of OpenSuse Slowroll and still can’t see the –user-installed flag. I found # zypper se -i which seems to have a similar output to the suggested # grep ‘installed’ /var/log/zypp/history, but both include every library and dependency.
@pdecker , I can see your point. The rolling distro upgrades anything already installed, so why fresh install?. I have only very recently changed from Leap to Slowroll but my concern is that superseded and outdated logs, conf, tmp, bak, etc files that accumulate from changes to the system may interfere with the newer/ upgraded packages. A fresh install could provide a faster spring clean.
I think I now know why --user-installed doesn’t work.
If my information is correct then the --user-installed flag was introduced in zypper 1.14.37 (2020).
But since you are on openSUSE Slowroll, it’s possible that the zypper version is older. Does that make sense?
Without this newer zypper, there simply is no built-in way to filter out “only manually installed” packages.
zypper search --installed-only lists all installed packages, but indeed includes dependencies.
grep 'installed' /var/log/zypp/history doesn’t separate manually requested packages from their pulled-in dependencies either.
O.K., at this point I turned to AI for some help, as I´m running out of ideas.
What about this suggestion:
On older versions, the best workaround is to parse /var/log/zypp/history yourself. For example:
This will show you packages you explicitly installed, while filtering out the ones marked as automatically installed (dependencies). Not as elegant as --user-installed, but it should help until a newer zypper is available.
Explanation:
/var/log/zypp/history logs all package transactions.
Lines with install tell you what was installed.
Lines that mention auto indicate dependencies (auto-installed).
By filtering out auto, you get mostly the manually installed packages.
It’s not 100% perfect, but it’s the nearest equivalent to apt-mark showmanual in older zypper.
But since I did a fresh install to a rolling distro (Slowroll) the comparison to previous is probably not relevant. My fresh install went fairly quick and easy, thanks to all the advice here, and now hopefully will be a while for my next fresh install!
That’s a neat trick to get the manually installed packages. I copied it right away!
I have a script that reads a package list (fromm dpkg -l) and tries to install them on the new system. It uses a trick though. It checks if they are aready installed and skips those that are. TIhis is mainly useful for dependencies (which your method avoids) because reinstalling them marks them as manual instead of automatic so they can’t be autoremoved.
```
dpkg -s "$1" &> /dev/null
rc=$?
if (( rc ))
then
echo sudo apt-get install "$1"
rc=$?
else
echo -e "\tSkipping [$1] - already installed"
rc=1
fi
```
I use a combination of what others have posted. I customize a lot and dread doing a clean install because it takes forever to get everything customized again.
What I am doing to make it easier is to setup and install Zim as early as possible on a new system. Then I use it to keep notes on everything I do both to have a reference and to make it easier the next time.
Zim is nice because it lets you structure the text a bit and embed graphics in a much easier way than using a full word processor such as LibreOfiice Writer.
The tool itself (Zim) doesn’t matter much, but keeping notes somehow helps a lot.
I replied elsewhere in this dscussion about how I use a script to reistall packlages from a dpkg list without breaking things. It’s apt (Debian) specific though.
That makes sense, but the rolling release distros I looked into (years ago) seemed to be prone to new things breaking old things on an unpredictable basis. I don’t have the time and gumption for an arch-based distro and I know nothing about Tumbleweed.
That has changed. Most of those problems were the AUR repo in Arch.
Today there are better managed rolling release distros than Arch… have a look at OpenSUSE Tubmbleweed, Solus, Void… they are all well managed rolling releases not derived from Arch.
There is also MX which is semi-rolling.
@josephj222222 the script I used after a fresh install was as basic as it gets: I had a manually compiled list of my user-installed packages and the script just run through the list and installs anything not already in. Anything already installed is ignored. Zypper doesn’t seem to flag user installed, and if so the autoremove issue would not apply. It also means it would be easier to compile the list of packages before the fresh install and then run through the install script after the fresh install. Otherwise next time I should try a zypper version of your script.
I discovered zim a while back through this forum and I found it perfect for keeping my notes: easy to use, very good searching, good but not too fancy formatting, and data is stored using common formats and user defined directory that are easily reusable if necessary.
I first tested OpenSuse Slowroll for a while on a couple of oldish PCs and then updated my main laptop from OpenSuse Leap (stable distro) to Slowroll. So far my experience has been very good. Just there are almost daily upgrades, many minor but quite often fairly substantial downloads
All rolling release distros have that feature… overall about twice the amount of downloads. I find weekly is enough with Void., and I have let it go for a month… it copes.
Sometimes updates are necessary before an install will work,
I recently was installing the package chrony in antiX. It is an NTP alternative.
I ran the install apt install chrony … it seemed to work , but ht e daemon chronyd would not start.
I tracked it down to the config file `/etc/chrony/chrony.conf being missing.
Then I did
apt update
apt upgrade
apt reinstall chrony
and then it worked … ie chronyd would start.
I cant see how an install would miss putting in a config file. I cant see why an update and a reinstall would fix it. But that is what happened … apt install can fail if the system is not updated … usually you get a meaningless message, but I got no indication it had failed?
apt is not a perfect package system. You need to nurse it.