Page 1 of 1

Raspberry Pi customized SD card management

Posted: Sat Aug 31, 2019 2:27 pm
by bls
I suspect some of you have solved this problem in some creative ways, so thought I'd start a discussion about it...

The Raspbian team builds a wonderful Raspbian distro, and I'm guessing some of you are probably like me, and like to have your Pi configured "just so", with all the "right" packages installed and configured as you like them, and your important config files (.bashrc, .vimrc, etc) in their appropriate locations.

What techniques and tools do you employ to build up your "tailored" SD card from an initial distro?

I'm aware of tools like Ansible, etc, but I prefer lightweight solutions that don't add too much overhead, and are easy to configure/manage/update/use.

To start off the discussion, here's my solution, which is based on a set of small home-brew scripts:
1) Build an SD card from Raspbian Lite using an unzip|dd script
2) Mount it and use a little pre-configure script to load my config files, scripts, etc onto the SD card
3) Boot the SD card
4) Using a small set of scripts, apt-get update/upgrade, install additional "big" packages as needed, such as: required (a set of packages I always want), and some others that I may or may not want, depending on the planned use: VNC+X11+etc, Postfix, Apache, Dovecot, etc. Each one of these is a separate script, and I can bang through all of them plus basic install in about 30-40 minutes, depending on how much I pay attention to requests for input.

After a go-around or two, when i'm happy with it, I make a "golden master" SD card image as a jump start shortcut.

Each time I add new functionality new to my "knowledge base", I decide where in my script library it should go. By scripting it I only need to figure out all the nuances and gotchas once, test my script once, and then I'm good to go, at least until the next release of Raspbian comes out ;)

What's your strategy?

Re: Raspberry Pi customized SD card management

Posted: Sat Aug 31, 2019 2:36 pm
by PhatFil
asuming you dont use a gui at all for setup after setting up a pi just dump the cli history to a file and you have a roadmap for the next identical set up or restore.

Re: Raspberry Pi customized SD card management

Posted: Sat Aug 31, 2019 2:46 pm
by epoch1970
For me just an image and a readme (install description, cloning instructions).
Installing takes little time, validating takes a long time. So I either start from a new install, or from a full image tested to be working.

Re: Raspberry Pi customized SD card management

Posted: Sun Sep 01, 2019 1:02 am
by MaccyC
I use systemd-nspawn into my custom sd and update or configure as required.

Re: Raspberry Pi customized SD card management

Posted: Sun Sep 01, 2019 10:04 pm
by bls
MaccyC wrote:
Sun Sep 01, 2019 1:02 am
I use systemd-nspawn into my custom sd and update or configure as required.
Interesting idea!

I assume that you're doing this on a Pi, since (based on my understanding) systemd-nspawn doesn't do any CPU emulation?

Re: Raspberry Pi customized SD card management

Posted: Mon Sep 02, 2019 1:44 pm
by tqhien
Hello

I use Buildroot to create my custom embedded linux for Raspberry Pi. It is less easy that trimming down a Raspbian distro as the goal is to build from bottom to top a tailored kernel, with only packages I choose. Quite difficult to understand at the beginning, but really efficient for embedded systems.

Hien.

Re: Raspberry Pi customized SD card management

Posted: Mon Sep 02, 2019 2:15 pm
by epoch1970
Systemd-nspawn is container management à la Poettering. Didn’t exactly manage to steal the fire from Docker, but RHL has swallowed coreOS, so perhaps we’ve not seen the end of this “debate”.
https://wiki.archlinux.org/index.php/Systemd-nspawn