All Projects → geerlingguy → diet-raspbian

geerlingguy / diet-raspbian

Licence: other
DEPRECATED - Trim the fat from the default Raspbian image.

Projects that are alternatives of or similar to diet-raspbian

Gamer Os
A Steam Big Picture based couch gaming OS
Stars: ✭ 366 (+1043.75%)
Mutual labels:  distribution, os
celos
CelOS is a simple, easy-to-use, flatpak centric Linux distribution for everyone based on Ubuntu 20.04.
Stars: ✭ 18 (-43.75%)
Mutual labels:  distribution, os
Aqeous
(Inactive, Checkout AvanaOS, Rewrite of this) This is a New Operating System (Kernel right now). Made completely from scratch, We aim to make a complete OS for Learning purpose
Stars: ✭ 23 (-28.12%)
Mutual labels:  os
cryptctl
A disk encryption utility that helps setting up LUKS-based disk encryption using randomly generated keys, and keeps all keys on a dedicated key server.
Stars: ✭ 23 (-28.12%)
Mutual labels:  os
mbed-tools
⚠️ Beta Status: New command line tooling for Mbed OS
Stars: ✭ 40 (+25%)
Mutual labels:  os
tupai
Tupai is a multi-tasking operating system I wrote for my degree that focuses on safety and design, targeting a variety of platforms.
Stars: ✭ 21 (-34.37%)
Mutual labels:  os
Onyx
UNIX-like operating system written in C and C++
Stars: ✭ 52 (+62.5%)
Mutual labels:  os
ansible-raspbian
Ansible role for setting up a secure basic Raspbian environment with sensible defaults.
Stars: ✭ 54 (+68.75%)
Mutual labels:  raspbian
Cardinal
Operating system designed to be fast and secure.
Stars: ✭ 20 (-37.5%)
Mutual labels:  os
raspberrypi-ptp
How to run IEEE-1588 on RaspberryPi hardware
Stars: ✭ 57 (+78.13%)
Mutual labels:  raspbian
build-raspbian-image
Builds a minimal Raspbian Stretch image
Stars: ✭ 40 (+25%)
Mutual labels:  raspbian
raspberrypi-rstudio
RStudio for Raspberry Pi - Docker Build and Runtime Environment
Stars: ✭ 57 (+78.13%)
Mutual labels:  raspbian
DemOS
Free, simple, extremely lightweight, stackless, cooperative, co-routine system (OS) for microcontrollers
Stars: ✭ 18 (-43.75%)
Mutual labels:  os
Ultra
An operating system that doesn't try to be UNIX. Made completely from scratch with its own bootloader. 😊
Stars: ✭ 48 (+50%)
Mutual labels:  os
src
MidnightBSD OS source code
Stars: ✭ 21 (-34.37%)
Mutual labels:  os
DSAC
DockSTARTer App Config helps you configure some of your Docker apps!
Stars: ✭ 20 (-37.5%)
Mutual labels:  raspbian
toddler
Toddler is a well-designed usable and portable microkernel OS
Stars: ✭ 70 (+118.75%)
Mutual labels:  os
wor-flasher
Legal utility that runs on RPiOS to flash another SD card with Windows 10/11
Stars: ✭ 451 (+1309.38%)
Mutual labels:  raspbian
opuntiaOS
opuntiaOS - an operating system targeting x86, ARMv7, Aarch64
Stars: ✭ 566 (+1668.75%)
Mutual labels:  os
chaos-2
A hand-made SMP-aware kernel
Stars: ✭ 20 (-37.5%)
Mutual labels:  os

NOTE - Official Raspbian Lite Distribution Now Available!: As of November 2015, the official Raspbian image is now maintained in a full GUI and 'lite' GUI-less flavor. This project has now been deprecated as of the 2.0.0 ('Jessie') release, and you should switch your servers over to the official Lite image instead.


Diet Raspbian - Minimal Raspbian with Ansible

Trim the fat from the default Raspbian image.

Many minimal Raspbian images are based on very old versions of Raspbian and aren't built in an open/simple way.

Diet Raspbian uses Ansible to take a system built with the official Raspbian image, and strip it of extraneous bits like default IDEs, languages, Wolfram, a window manager, etc. Why? If you're running a Raspberry Pi as a small headless server (e.g. for home automation, a fun robot project, or in a clustered configuration), there's no need for all the extra cruft.

Usage

You can skip all of these directions and download a pre-generated Diet Raspbian image directly from the Midwestern Mac Files site (under the 'Raspberry Pi Images' section).

Everything should be done on your local host machine—nothing needs to be done on the Raspberry Pi itself!

  1. Install Ansible.
  2. Build a microSD card with the official Raspbian image, and boot your Pi.
  3. Copy your public key for passwordless SSH login (e.g. ssh-copy-id pi@[IP-ADDRESS]), and make sure you can login to the Pi without a password (e.g. ssh pi@[IP-ADDRESS]).
    1. If you want, you can also SSH into the Pi and run passwd to change the pi account password from the default, raspberry.
    2. Don't run raspi-config at this time.
    3. If you boot the Pi the first time while connected to a monitor, follow the instructions under 'Initial setup via GUI/X' before completing this step.
  4. Edit the inventory file and set the IP address to the address of your running Pi.
  5. Run the following command: $ ansible-playbook -i inventory diet.yml.

After 10-20 minutes, the space consumed by Raspbian should go from ~2.5 GB to ~700 MB (or lower, depending on how far along this project has come!). If you'd like to create a new image for cloning purposes, run the command ansible all -i inventory -a "shutdown -h now" -s to shut down your Pi, then follow the steps under 'Creating a new Diet Raspbian disk image'.

IMPORTANT: The diet.yml playbook is meant to be run prior to any other Raspberry Pi configuration; it changes locale settings, general configuration, etc. (see vars/main.yml). This is meant to be run on a freshly-imaged Raspbian microSD/SD card.

Initial setup via GUI/X

If you want to do the first couple setup steps using the GUI instead of just connecting to the Pi via SSH headlessly, you can do so using the steps below; then go to step 3 in the above directions from your local host machine.

  1. Boot the Pi with the fresh Rasbpian install; the Pi will boot straight into X (the GUI).
  2. If you have WiFi, connect to the WiFi network. If you have Ethernet, connect the network cable to your Pi.
  3. Open a Terminal window on the Pi and type ifconfig, to get your Pi's IP address.
  4. Open Menu > Preferences > Raspberry Pi Configuration, and change the 'Boot' option to 'To CLI' and uncheck "Login as user 'pi'".
  5. Click OK and reboot the Pi.

Creating a new Diet Raspian disk image for cloning (optional)

Once you've run the diet.yml playbook on your Pi, you can create a new diet-raspbian.img.gz compressed disk image that you can use to clone (or re-clone) to your microSD cards, so you don't have to run the diet.yml playbook in the future, or if you want to quickly rebuild your existing Pi's OS.

  1. With your Raspberry Pi powered off, remove the microSD card and put it into your Mac's card reader.
  2. Resize the ext4 partition (OPTIONAL, but will save a couple GB of space and ~10 minutes per cloned microSD card): 1. Boot up an Ubuntu VM using VirtualBox, VMWare Fusion, or Parallels Desktop. 2. Attach the USB device that has the microSD card attached to the VM. 3. Make sure gparted is installed: $ sudo apt-get install -y gparted 4. Start the gparted GUI: $ sudo gparted 5. Select the microSD card (e.g. /dev/sdb) from 'Devices' in the GParted menu. 6. Right click on the ext4 (should be ~4 GB) and boot volumes and unmount them. 7. Right click on the the ext4 volume and resize it to a smaller value (e.g. 1024 MB). 8. Click the 'Apply' button (green checkbox) to apply the changes (this will take ~10 minutes). 9. Eject the card from the Ubuntu VM so you can use it from the Mac again.
  3. Locate the card: $ diskutil list (should be something like /dev/disk2)
  4. Make a compressed image of the card using dd: 1. With pv: $ sudo dd if=/dev/disk2 bs=1m count=1536 | pv | gzip > ~/Desktop/diet-raspbian.img.gz 2. Without pv: $ sudo dd if=/dev/disk2 bs=1m count=1536 | gzip > ~/Desktop/diet-raspbian.img.gz

WARNING: Double-check that you're using the right if disk and of or gzip destinations; these values will be different on your system.

The count=1536 above will create an image that is 1.5 GB. If it needs to be larger to contain all the partitions on the microSD card, you'll need to increase the size here.

At this point, you should have a disk image you can write to new SD cards, or use to overwrite your existing SD card.

Write the Diet Raspbian image to another microSD card

  1. Put the new card into your Mac's card reader.
  2. Locate the card: $ diskutil list (should be something like /dev/disk2)
  3. Unmount any mounted partitions on the card: $ diskutil unmountDisk /dev/disk2
  4. Write the image to the new card: 1. With pv: $ gzip -dc ~/Desktop/diet-raspbian-2.0.0.img.gz | pv | sudo dd of=/dev/disk2 bs=1m 2. Without pv: $ gzip -dc ~/Desktop/diet-raspbian-2.0.0.img.gz | sudo dd of=/dev/disk2 bs=1m

WARNING: Double-check that you're using the right if disk and of or gzip destinations; these values will be different on your system.

Use the fresh microSD card in your Raspberry Pi

  1. Put the freshly-minted card into your Pi and boot the Pi.
  2. Log in (either locally or via SSH).
  3. Disable swap and remove the swap file temporarily: sudo swapoff -a && sudo rm -f /var/swap
  4. Run $ sudo raspi-config, and select the first option ('Expand Filesystem').
  5. Reboot the Raspberry Pi.

Author Information

Created in 2015 by Jeff Geerling, author of Ansible for DevOps.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].