Raspian Jessie and Stretch

Mar 18, 2018 53 Replies

Another approach is to write a script something like:

========================================== #!/bin/bash

list="" list="$list package1" list="$list package2"

sudo apt_get install $list ===========================================

Keep this in your usual login directory and update it each time you add or remove packages. Then run it after a clean install.

I've done this for years with Fedora Linux, though now it has a good, reliable version upgrade in situ process. But, being a belt and braces type, I still maintain the list on my Fedora boxes (though the command there is 'dnf install', so it was natural to do the same on my RPi.

Martin | martin at Gregorie | gregorie dot org

Yes, I saw that being mentioned earlier today, thanks.

However, most of my hosts run Fedora and I don't think dnf, its package manager, has any equivalent command. So, I'll continue to use my scripted approach on all my Linux hosts.

Martin | martin at Gregorie | gregorie dot org

Get all manually installed packages in the last 12 months: zcat /var/log/apt/history*gz | grep 'install ' (this also catches uninstall but not purge)

If you want more than 12 months, change that number in the settings file /etc/logrotate.d/apt (obviously sooner than 12 months after a fresh install).

Well, you also have to identify & update any customized config files. I keep a list of the /etc files that I've modified, but I can't swear I haven't missed any out.

You also need to add the user accounts to a clean install with the right id numbers if you're using an external drive.

We know he [Larry Walters] broke some part of the Federal Aviation Act, and as soon as we decide which part it is, some type of charge will be filed. If he had a pilot's license, we'd suspend that, but he doesn't. ---Neal Savoy

Even better, why not keep copies of the modified files? I do that and keep them in the same place as my additional packages list.

That's quite easy to do:

Manually. ========= After you've flopped the contents of /home back in place, login as root. "ls -l /home" shows you the user numbers, so use one of the user maintenance utilities to add the users back, specifying the appropriate user number for each login directory. I normally did this with the Fedora system-config-users graphical program.

Scripted ======== Use groupadd and useradd followed by chpasswd to recreate any special groups, set up the users and reset the passwords. This is scripted.

Martin | martin at Gregorie | gregorie dot org

I install git, create an empty repo in / and commit all config changes to it. I also clone all such repos to a store on my SAN and use a cron job to do a regular git pull on all of the clones. Works pretty well across multiple unixish platforms.

Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. | http://www.sohara.org/

I keep my config file copies, along with everything else (package lists) that will need reinstatement after a clean Linux install, under version control - CVS rather than git at present.

It all got a good workout about a year ago when did disks in both my laptop and my house server died almost simultaneously. Both ended up needing to be recovered by clean installs on the new disks, followed by:

- pull the content of /home back from my rsynced backups

- reinstate groups, usernames, passwords by running the backed-up script

- run the backed-up script that retrieves missing packages

- replace config files from the copies in /home/user/configdir

- make sure everything is up and running

===== One point that those who suggested that the Raspbian installed packages list by running an apt utility or scraping the apt history log may have missed: your additional packages will available after a clean install or if your SD card gets corrupted.

So, to avoid losing this the packages list , you need to recreate it each time you install another package and make sure that the updated package list gets included in your regular backups.

Martin | martin at Gregorie | gregorie dot org

I did not miss that point because the point of this thread was how to upgrade from jessie to stretch, not how to recreate your install after a system crash.

I cant answer for Pis, but my desktop/laptops here get totally rebuilt when I upograde.

/home is elsehere on a server so that's OK anyway.

By NOT reinstalling everything I only need to reinstall what todays rather than yesterdays needs are, as and when I need to.

I keep backuos of config files on the server as well.

"Socialist governments traditionally do make a financial mess. They always run out of other people's money. It's quite a characteristic of them" Margaret Thatcher

-- "Socialist governments traditionally do make a financial mess. They always run out of other people's money. It's quite a characteristic of them"

Margaret Thatcher

Margaret Thatcher, of course, used her own money, not "other people's" - i.e. mine!

Governments all seem to think that they have their own money. In reality it's all ours. They just steal it from us!

--

Chris Elvidge, England

I have a daily backup of /etc anyway, so last time I did a reinstallation, I unpacked that somewhere else and diffed it against the new /etc to look for things I'd missed. Of course, a back up of

*only* the customized files would be even more useful --- & subject to the "forgot to include it" snag.

Also a good idea.

"It is the role of librarians to keep government running in difficult times," replied Dramoren. "Librarians are the last line of defence against chaos." (McMullen 2001)

The problem with left-wing governments is that they don't know where money comes from. The problem with right-wing governments is that they know exactly where money comes from.

No matter who you vote for, the politicians always get in.

/~\ cgibbs@kltpzyxm.invalid (Charlie Gibbs) \ / I'm really at ac.dekanfrus if you read it the right way. X Top-posted messages will probably be ignored. See RFC1855. / \ HTML will DEFINITELY be ignored. Join the ASCII ribbon campaign!

For managing /etc, it's reasonably easy to use a form of SCM to maintain a record of changes over time. When customizing a new distribution or release, it can be useful to do a diff of the changes you made to the file on the previous release, comparing the initial (distribution-supplied) content vs. your final content. That provides a reasonably reliable idea of what changes you would want to make on the new release.

Robert Riches spamtrap42@jacob21819.net (Yes, that is one of my email addresses.)

Sounds like you want etckeeper...

https://www.greenend.org.uk/rjk/

If you already use CSV, git or one of the other version control systems its probably just as easy to use them directly.

Martin | martin at Gregorie | gregorie dot org

That sounds like it would involve doing extra work for all the things etckeeper automates.

https://www.greenend.org.uk/rjk/

At this point, I have a Perl script that works for my needs, but likely would not be useful to anyone else. I'll definitely take a look of etckeeper in case it may be better than what I now have.

Thanks.

Robert Riches spamtrap42@jacob21819.net (Yes, that is one of my email addresses.)

you could also use etckeeper for that purpose.

gregor

.''`. https://info.comodo.priv.at -- Debian Developer https://www.debian.org : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06 `. `' Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe `- NP: John Coltrane & Dave Brubeck: Take Five

I might, if it existed on all the platforms I use (I don't see it in the FreeBSD packages) and handled config files outside of /etc and provided history and kept it all backed up to the NAS.

Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. | http://www.sohara.org/

Seems it does work on FreeBSD:

formatting link

I think it can be configured to do that.

It's git, so git push and friends are available.

formatting link

Theo

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required