0

I currently use Debian Jessie and I would like to upgrade to Stretch, but I fear I would lose all the programs I installed on Jessie.

Is there a way to backup my programs and files before upgrading to Stretch?

Omar
  • 9
  • 2
  • 1
    how did you install this programs? – Luciano Andress Martini Apr 26 '18 at 19:05
  • @StephenKitt I didnt suggest it for the deletion part but: dpkg --get-selections >packages dpkg --get-selections – vfbsilva Apr 26 '18 at 20:55
  • @StephenKitt all migrations include such problems. He could try: #apt-get dist-upgrade which is the default way to do it and end up with a broken system. So what I see as culpirit here is how to backup the programs: keep a list of all programs installed, he should not keep a copy of the files per-se as apt can solve this from him – vfbsilva Apr 26 '18 at 21:01
  • Okay still it is a too broad description – vfbsilva Apr 26 '18 at 21:12
  • @Luciano Andress Martini Either with Apt-get or by downloading from the internet and then unzipping – Omar Apr 26 '18 at 21:47

2 Answers2

1

In short, you don't have to.

Upgrading debian means you change the name of the release in sources.list, then you run update/dist-upgrade and you're done.

Regarding programs, there are two situations:

1. Programs you've installed using Debian - you don't need to worry about these. All programs and dependencies are automatically upgraded. And, if there is no upgrade available for a certain package, it remains there, untouched by the upgrade process.

2. Programs you're installed separately - these are programs that you have installed independently of the Debian package system. There are several reasons for this: the program you use is not available on Debian, or you downloaded the source, compiled and installed it, or maybe it runs its own installation package, which ignores Debian. That is also fine, because the package system does not touch those programs, since they are installed in the "local" directories: "/usr/local", "/lib/local", and so on. Those programs - and their libraries - will also remain after the upgrade process. You may have to update them because some of their dependencies may get upgraded by Debian, but it's not the case for a backup before the upgrade.

If you really want to backup your programs, I suppose you can create an archive with all of /usr, /lib and /etc and keep it somewhere else:

# tar cvzf /root/backup.tar.gz /usr /lib /etc

But I must say, it's really unnecessary.

Francisco
  • 188
  • 7
0

If all the programs are in repositories, you can just backup the list of installed packages (in case something goes wrong and you need to reinstall).

dpkg -l | egrep "^ii" | cut -d' ' -f3

dpkg -l shows all installed packages

egrep "^ii" removes those things, that only have residual configs and are not actually installed

cut -d' ' -f3 just removes other columns of the output

Of course these aren't the only things you should backup if you are doing a full-backup, but that was not requested so I am not mentioning these

Jakub Lucký
  • 742
  • 3
  • 11
  • 1
    Please don’t parse the output of `dpkg -l`. To back up the installation state of packages, you should use `dpkg --get-selections`. For other queries, you should use `dpkg-query`. If you use `dpkg -l` as above you risk truncating package names... – Stephen Kitt Apr 30 '18 at 22:08