Git Product home page Git Product logo

ostree-utility's Introduction

OSTree in Arch Linux using Podman

Massive shout-out to M1cha for making this possible (M1cha/archlinux-ostree).

Overview

This is a helper script which aids in curating your own setup by demonstrating how to:

  1. Build an immutable OSTree image by using rootfs from a Podman Containerfile.
  2. Partition and prepare UEFI/GPT disks for a minimal OSTree host system.
  3. Generate OSTree repository in a empty filesystem.
  4. Integrate OSTree with GRUB2 bootloader.
  5. Upgrade an existing OSTree repository with a new rootfs image.

Disk structure

/
├── boot
│   └── efi
└── ostree
    ├── deploy
    │   └── archlinux
    └── repo
        ├── config
        ├── extensions
        ├── objects
        ├── refs
        ├── state
        └── tmp

Persistence

Everything is deleted between deployments except for:

  • /dev partitions which OSTree does not reside on are untouched.
  • /etc only if --merge option is specified.
  • /home is symlinked to /var/home (see below).
  • /var data here is mounted from /ostree/deploy/archlinux/var to avoid duplication.

Notes:

  • /var/cache/podman is populated only after the first deployment (to avoid including old data from the build machine), this speeds up consecutive builds.
  • /var/lib/containers same as above but for Podman layers and images. Base images are updated automatically during upgrade command.

Technology stack

  • OSTree
  • Podman with CRUN and Native-Overlayfs
  • GRUB2
  • XFS (not required)

Motivation

My vision is to build a secure and minimal base system which is resilient against breakage and provides setup automation to reduce the burden of doing manual tasks. This can be achieved by:

  • Git.
  • Read-only system files.
  • Restore points.
  • Automatic deployment, installation & configuration.
  • Using only required components like kernel/firmware/driver, microcode and GGC in the base.
  • Doing the rest in temporary namespaces such as Podman.

Goal

  • Reproducible deployments.
  • Versioned rollbacks.
  • Immutable filesystem.
  • Distribution agnostic toolset.
  • Configuration management.
  • Rootfs creation via containers.
  • Each deployment does a factory reset of system's configuration (unless overridden).

Similar projects

Usage

  1. Boot into any Arch Linux system:

    For instance, using a live CD/USB ISO image from: Arch Linux Downloads.

  2. Clone this repository:

    $ sudo pacman -Sy git
    $ git clone https://github.com/GrabbenD/ostree-utility.git && cd ostree-utility
  3. Find ID-LINK for installation device where OSTree image will be deployed:

    $ lsblk -o NAME,TYPE,FSTYPE,MODEL,ID-LINK,SIZE,MOUNTPOINTS,LABEL
    NAME   TYPE FSTYPE MODEL        ID-LINK                                        SIZE MOUNTPOINTS LABEL
    sdb    disk        Virtual Disk scsi-360022480c22be84f8a61b39bbaed612f         300G
    ├─sdb1 part vfat                scsi-360022480c22be84f8a61b39bbaed612f-part1   256M             SYS_BOOT
    ├─sdb2 part xfs                 scsi-360022480c22be84f8a61b39bbaed612f-part2  24.7G             SYS_ROOT
    └─sdb3 part xfs                 scsi-360022480c22be84f8a61b39bbaed612f-part3   275G             SYS_HOME
  4. Perform a takeover installation:

    ⚠️ WARNING ⚠️

    ostree.sh is destructive and has no prompts while partitioning the specified disk, proceed with caution:

    $ chmod +x ostree.sh
    $ sudo ./ostree.sh install --dev scsi-360022480c22be84f8a61b39bbaed612f

    ⚙️ Update your BIOS boot order to access the installation.

    💡 Default login is: root / ostree

    💡 Use different Containerfile(s) with --file FILE1:TAG1,FILE2:TAG2 option

  5. Upgrade an existing installation:

    While booted into a OSTree system, use:

    $ sudo ./ostree.sh upgrade

    💡 Use --merge option to preserve contents of /etc

  6. Revert to previous commit:

    To undo the latest deployment (0); boot into the previous configuration (1) and execute:

    $ sudo ./ostree.sh revert

Tips

Read-only

This attribute can be temporarily removed with Overlay filesystem which allows you to modify read-only paths without persisting the changes:

$ ostree admin unlock

Outdated repository cache

error: failed retrieving file '{name}.pkg.tar.zst' from {source} : The requested URL returned error: 404

Your persistent cache is out of sync with upstream, this can be resolved with:

$ ./ostree.sh upgrade --no-cache

ostree-utility's People

Contributors

frap129 avatar grabbend avatar wegel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ostree-utility's Issues

/etc merge?

First of all, this is pretty awesome. Playing with it is fun ;)

I was wondering why the --no-merge in ostree.sh? Without it (eg, enabling /etc merge), one could make changes to config files in /etc (for example, /etc/{passwd,group,sudoers} and /etc/NetworkManager/*), and have those changes available accross deployments.

Thanks for an awesome project!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.