Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAQ collection for building custom images #64

Open
fwilhe opened this issue Feb 8, 2024 · 0 comments
Open

FAQ collection for building custom images #64

fwilhe opened this issue Feb 8, 2024 · 0 comments

Comments

@fwilhe
Copy link
Member

fwilhe commented Feb 8, 2024

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant