uCore Documentation

repository·main·Indexed 20 days ago

https://github.com/ublue-os/ucore

uCore is an opinionated, OCI-based distribution built on top of Fedora CoreOS, designed as a 'batteries-included' lightweight server image. It provides various image variants including ucore-minimal, ucore, and ucore-hci, with support for x86_64 and aarch64 architectures. The distribution offers multiple build streams (stable, lts, testing) and specialized tags for NVIDIA driver support. Key features include ZFS integration, build transparency via SBOMs and provenance, and support for containerized workloads using Podman and Docker.

Tokens
5.8K
Snippets
18
Records
27
Agent score
21%

What's inside uCore

  1. What is uCore?

    main
    uCore is an OCI image based on Fedora CoreOS that comes with "batteries included". It is an opinionated, custom CoreOS image built daily to serve as a lightweight server image. It includes common tools and services or the building blocks required to host them, making it suitable for server environments.
  2. Choose the right uCore image variant

    main

    uCore provides three primary image types tailored for different use cases. All images are based on Fedora CoreOS and can be optionally combined with NVIDIA driver tags.

    • ucore-minimal: Lightweight and functional. Best for running containerized workloads on bare metal or virtual machines. Includes bootc, cockpit, firewalld, guest VM agents, docker-buildx, docker-compose, podman-compose, tailscale, wireguard-tools, tmux, and ZFS drivers.
    • ucore: Built on ucore-minimal. Adds drivers, storage tools, and utilities. Best for bare metal or NAS/storage server use cases. Includes distrobox, mergerfs, nfs-utils, rclone, samba, snapraid, and cockpit-zfs-manager.
    • ucore-hci: Built on ucore. Adds virtualization tools for Hyper-Converged Infrastructure. Includes libvirt-client, libvirt-daemon-kvm, virt-install, and cockpit-machines.
  3. Use NVIDIA drivers in uCore

    main

    If you use a uCore image tagged with -nvidia, the following are pre-installed:

    • NVIDIA kernel module
    • Basic CUDA libraries
    • nvidia-container-toolkit

    Important: This does not install desktop graphics services. It is intended for container workloads (e.g., using the GPU for nvdec, nvenc, or CUDA inside containers).

    If you require an older or different driver version, consider using the container-toolkit-fcos driver approach, which uses a systemd service to load drivers in Podman at boot. This approach is typically used with standard uCore images rather than the -nvidia tagged ones.

  4. Build Transparency: SBOMs, Provenance, and Changelogs

    main

    uCore provides build transparency features to help users verify their images:

    • RPM Package Provenance: Information regarding the origin of RPM packages from each image build is surfaced.
    • Software Bill of Materials (SBOM): Signed per-architecture SPDX SBOMs are attached to image digests.
    • Release Changelogs: Generated GitHub Release changelogs are available for the stable, testing, and lts streams.
  5. uCore Build Streams and Kernels

    main

    uCore uses different streams to balance stability and feature updates:

    • stable: Follows the standard Fedora CoreOS kernel. This is the recommended stream for most users.
    • lts: Uses a Long Term Support (LTS) kernel (e.g., longterm-6.18) to provide more consistent behavior for servers between updates. Note that using the LTS kernel with SecureBoot enabled requires importing the ublue-os MOK before rebooting to avoid boot failure.
    • testing: Uses the upstream Fedora CoreOS kernel and is intended for testing new updates before they reach stable.
  6. Inspect a running VM using `VM_TEST_KEEP`

    main

    If you want to manually inspect the guest state after a test completes (successfully or otherwise), set the VM_TEST_KEEP environment variable to any non-empty value.

    When VM_TEST_KEEP is set:

    1. The script leaves the QEMU process running.
    2. The complete work directory is retained.
    3. The script will print the SSH command and the QEMU process ID (PID) before exiting so you can connect to the guest or stop the process manually.

    Important: You must manually stop the recorded QEMU process before deleting the work directory.

    VM_TEST_KEEP=1 just vm-test SOURCE_IMAGE TARGET_IMAGE
  7. Available uCore Image Variants

    main

    uCore provides several image variants depending on your needs:

    • ucore-minimal: A stripped-down version for minimal footprints.
    • ucore: The standard "batteries included" image.
    • ucore-hci: A variant specifically for Human Interface Controller (HCI) use cases.

    Images are available for both x86_64 and aarch64 (ARM64) architectures. Note that aarch64 builds may lack certain Intel-specific packages (e.g., intel-compute-runtime) and currently do not include mergerfs.

  8. Select uCore tags for stability and drivers

    main

    uCore uses a tag matrix to combine image types with different update streams and driver support. Use these tags when pulling images from ghcr.io/ublue-os/.

    Stream Tags:

    • stable: Based on Fedora CoreOS stable stream (includes ZFS).
    • testing: Based on Fedora CoreOS testing stream (includes ZFS).
    • lts: Based on Fedora CoreOS stable stream with a Long Term Support (LTS) kernel (includes ZFS).

    Driver Tags:

    • nvidia: Includes the latest open NVIDIA driver and container runtime.
    • nvidia-lts: Includes the LTS NVIDIA driver and container runtime.

    Example Combinations:

    • ucore:stable (Minimal, stable stream)
    • ucore:lts-nvidia (Minimal, LTS kernel, NVIDIA drivers)
    • ucore-hci:testing-nvidia-lts (HCI, testing stream, LTS kernel, NVIDIA drivers)
  9. Configure NFS Server sharing

    main

    To use uCore as an NFS server, you must configure the firewall, SELinux contexts, and the service itself.

    1. Firewall Configuration

    Add the NFS service to the FedoraServer zone:

    sudo firewall-cmd --permanent --zone=FedoraServer --add-service=nfs
    sudo firewall-cmd --reload

    2. SELinux Configuration

    By default, nfs-server is blocked from sharing directories. You must set the appropriate context.

    For Read-Only shares:

    sudo semanage fcontext --add --type "public_content_t" "/path/to/share/ro(/.*)?"
    sudo restorecon -R /path/to/share/ro

    For Read-Write shares:

    sudo semanage fcontext --add --type "public_content_rw_t" "/path/to/share/rw(/.*)?"
    sudo restorecon -R /path/to/share/rw

    Simplest (Least Secure) Method: To allow sharing anything without specific context management:

    • Read-only: sudo setsebool -P nfs_export_all_ro 1
    • Read-write: sudo setsebool -P nfs_export_all_rw 1

    3. Service Management

    Enable and start the service:

    sudo systemctl enable --now nfs-server.service

    4. Export Configuration

    Configure shares in /etc/exports or /etc/exports.d/*.

    # Example: Enable RW NFS sharing via SELinux booleans
    sudo setsebool -P nfs_export_all_rw 1
    
    # Example: Start the service
    sudo systemctl enable --now nfs-server.service
  10. Install uCore via Auto-Rebase

    main

    The fastest way to install uCore is to use a Butane template to generate an Ignition file that automatically rebases the system to a uCore image during the initial Fedora CoreOS installation.

    Prerequisites:

    Steps:

    1. Use examples/ucore-autorebase.butane as a template. Replace YOUR_GOOD_PASSWORD_HASH_HERE with your actual password hash and add your SSH public key.
    2. Generate an Ignition file from your Butane configuration using the butane utility.
    3. Install CoreOS on your target platform (hypervisor, cloud, or bare-metal) using the coreos-installer and point it to your Ignition file via --ignition-url or --ignition-file.

    Tip: Test your Ignition configuration in a VM before attempting a bare-metal installation.

    sudo coreos-installer install /dev/nvme0n1 --ignition-url https://example.com/ucore-autorebase.ign
  11. Configure Samba sharing

    main

    To use uCore as a Samba server, configure the firewall, SELinux, and the service.

    1. Firewall Configuration

    sudo firewall-cmd --permanent --zone=FedoraServer --add-service=samba
    sudo firewall-cmd --reload

    2. SELinux Configuration

    Set the samba_share_t context on your directories:

    sudo semanage fcontext --add --type "samba_share_t" "/path/to/share(/.*)?"
    sudo restorecon -R /path/to/share

    Simplest (Least Secure) Method: To allow Samba to share anything: sudo setsebool -P samba_export_all_rw 1

    3. Service Management

    sudo systemctl enable --now smb.service

    4. Share Configuration

    Manual configuration is done in /etc/samba/smb.conf. Alternatively, use user shares via: net usershare add sharename /path/to/share [comment] [user:{R|D|F}] [guest_ok={y|n}]

    # Example: Enable Samba service
    sudo systemctl enable --now smb.service
    
    # Example: Set SELinux context for a specific share
    sudo semanage fcontext --add --type "samba_share_t" "/var/home/myshare(/.*)?"
    sudo restorecon -R /var/home/myshare
  12. Configure ZFS on uCore

    main

    ZFS kernel modules and tools are pre-installed but not loaded by default.

    1. Loading the Module

    Load it manually with modprobe zfs. To ensure it loads automatically at boot, create a configuration file:

    echo zfs > /etc/modules-load.d/zfs.conf

    2. Creating Zpools on an Immutable Root

    Because the uCore root filesystem (/) is immutable, you cannot create directories for mountpoints directly in /. Always specify a mountpoint in a writable location (like /var) when creating a pool:

    Correct:

    zpool create -m /var/tank tank /dev/sdb

    To fix an existing pool with the wrong mountpoint:

    zfs set mountpoint=/var/tank tank

    3. ZFS Scrub Timers

    You can enable built-in timers to periodically run zpool scrub for data integrity:

    • Weekly: systemctl enable --now zfs-scrub-weekly@<pool>.timer
    • Monthly: systemctl enable --now zfs-scrub-monthly@<pool>.timer

    4. Backups with Sanoid/Syncoid

    ucore includes sanoid and syncoid.

    • Sanoid: Use it for automated snapshots. Create a sanoid.conf in /etc/sanoid (use a template from the sanoid repo) and enable the timer: systemctl enable sanoid.timer.
    • Syncoid: Use it for ZFS replication. For a "pull" configuration, create a syncoid.service and syncoid.timer in /etc/systemd/system/ and enable the timer.
    # Load ZFS at boot
    echo zfs > /etc/modules-load.d/zfs.conf
    
    # Create a pool with a writable mountpoint
    zpool create -m /var/tank tank /dev/sdb
    
    # Enable weekly scrub
    systemctl enable --now zfs-scrub-weekly@tank.timer