Skip to content

FAQ collection for building custom images #64

@fwilhe

Description

@fwilhe

The purpose of this issue is to collect FAQ regarding the builder. Eventually, they should end up in documentation or automation where possible.

Q: My image's partitions are too small, how to make them bigger?

A: One option is to edit fstab in the base feature like in this example

# <file system>    <dir>        <type>    <options>                                <makeimg args>
LABEL=EFI          /boot/efi    vfat      umask=0077                               type=uefi,size=512MiB
LABEL=ROOT         /            ext4      rw,errors=remount-ro,prjquota,discard    size=4GiB

Adapt the size arguments as needed

Q: I'm trying to download something in a builder feature but it fails because the hostname can't be resolved

A: Resolv conf needs to be configured. You may add a feature networking with the following scripts and include that in your build

exec.early:

#!/usr/bin/env bash

set -eufo pipefail

mkdir -p /run/systemd/resolve/
cp /etc/resolv.conf /run/systemd/resolve/stub-resolv.conf

exec.post:

#!/usr/bin/env bash

set -eufo pipefail

rootfs="$1"

rm "$rootfs/etc/hostname"
echo -n > "$rootfs/etc/hostname"

rm "$rootfs/etc/resolv.conf"
ln -s /run/systemd/resolve/resolv.conf "$rootfs/etc/resolv.conf"

Q: My image only has the root user. How do I create non-privileged user to work with?

A: Create a user feature with a exec.config file like this:

useradd --user-group --create-home --shell=/usr/bin/bash --password="$(openssl passwd -6 user)" user

This will create a user named user with password user.
You might want to read the password from a file or environment variable which are not checked into version control.

Q: My user should be able to use sudo for admin purposes.

A: Create a file in your user feature file.include/etc/sudoers.d/USERNAME, with this contents: USERNAME ALL=(ALL) NOPASSWD: ALL

Q: How can I use ssh to work with the machine?

A:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions