3

What I would like to do is get a comparison of my current ubuntu installation against a fresh version (probably a listing of all files changed/added/removed). I made the mistake of not documenting well enough when I was making small tweaks and now I would like to change VPS providers without rediscovering all of those tweaks that make the system run. Additionally, I would like to document these changes, so just copying everything wouldn't really solve my problem.

Is this possible with any current tools?

6
  • It should be possible to get a list of packages that you explicitly installed (without listing dependencies). Additionally, some package managers have a feature to list all files that are not managed by them and/or were modified, but I'm not that familiar with apt-get and dpkg and can't try it, because I don't have any debian or ubuntu installation.
    – FSMaxB
    Nov 16, 2013 at 9:10
  • Great. Would you happen to have any thoughts on what I can research to figure out that feature? I'm using Ubuntu 12.14, so I have apt for my package manager.
    – Seiyria
    Nov 16, 2013 at 15:42
  • Look at features that are provided by apt-get and dpkg. There is a tool called debsums that verifies packages, but I'm not sure if it verifies the installed files or the deb file only. Also take a look at dpkg -S and the dpkg-query man page. Probably all those options work only on single files, so you would have to use find to recursively apply the commands to the whole system. Debian based systems may also provide tools to handle config files, so maybe that's worth investigating.
    – FSMaxB
    Nov 16, 2013 at 21:27
  • And you always have the option to set up a virtual machine and install the same packages in it and then make a diff.
    – FSMaxB
    Nov 16, 2013 at 21:29
  • Good to know! Thanks a ton for that. If you want to submit some information as an answer, I'd gladly accept it.
    – Seiyria
    Nov 17, 2013 at 16:42

2 Answers 2

3

For Ubuntu/Debian

This is an old question, but for other people arriving here from Google searches in the future:

You can list the configuration files that were changed from the original in the installed packages by using debsums (or see How to check for modified config files on a Debian system? for alternative options):

sudo apt install debsums
sudo debsums -ce

After you have a list of the changed files, you can then diff the changes in configuration file, e.g. (using debsums):

cd /tmp
for FILE in $(sudo debsums -ce);
    do echo $FILE;
    PKG=$(dpkg -S $FILE | cut -d: -f1);
    diff <(apt-get download $PKG;dpkg-deb --fsys-tarfile $PKG*.deb | tar xOf - .$FILE) $FILE;
    echo "";
done
3
  • Thanks. Regretfully I have no idea if this works or can test it, as I've moved on.
    – Seiyria
    Mar 4, 2019 at 16:30
  • 1
    No problem! I actually came across this question while facing the same problem and posted my solution as a future reference to me and others. It worked perfectly in my case (i.e., found all changes made in the /etc configuration files).
    – divieira
    Mar 5, 2019 at 17:15
  • 1
    Worked as intended, thanks. Unforutnately, misses showing autocreated (or manually created) files.
    – Jan Katins
    Jan 31, 2021 at 13:05
0

etckeeper

One thing that can help is to put the configuration files under version control to keep track of changes to the system. For instance check out etckeeper, discussed in using git to manage /etc.

Obviously you'd want to start using this right after a fresh install, then you can keep track and document changes just as you would when managing source code. Afterwards you can have a look at the history of changes, extract a single change of interest etc... And if the repo is stored on another machine it has some backup benefits as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .