bls
Posts: 255
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Raspberry Pi customized SD card management

Sat Aug 31, 2019 2:27 pm

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?

PhatFil
Posts: 1404
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Raspberry Pi customized SD card management

Sat Aug 31, 2019 2:36 pm

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.

epoch1970
Posts: 3780
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Raspberry Pi customized SD card management

Sat Aug 31, 2019 2:46 pm

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.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

MaccyC
Posts: 1
Joined: Sun Sep 01, 2019 12:37 am

Re: Raspberry Pi customized SD card management

Sun Sep 01, 2019 1:02 am

I use systemd-nspawn into my custom sd and update or configure as required.

bls
Posts: 255
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Raspberry Pi customized SD card management

Sun Sep 01, 2019 10:04 pm

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?

tqhien
Posts: 46
Joined: Thu Feb 02, 2012 10:07 am

Re: Raspberry Pi customized SD card management

Mon Sep 02, 2019 1:44 pm

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.

epoch1970
Posts: 3780
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Raspberry Pi customized SD card management

Mon Sep 02, 2019 2:15 pm

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
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Advanced users”