Link Search Menu Expand Document

System Configuration


Table of contents

  1. Introduction
  2. Configuring hostname
  3. Setting the system timezone
  4. Updating the system locale
  5. Using custom NTP pools

Introduction

The main goal of using cloud-init in BerryOS is to be able to easily configure your system during its first startup. It provides quite a lot of possibilities out of the box that we will explore here.

Most of the example shown here are related to your /boot/user-data file unless stated otherwise. This file is the main way you interact with cloud-init.

Configuring hostname

Setting the system hostname can be done quite easily using the hostname and manage_etc_hosts parameters. hostname will define which hostname to use while manage_etc_hosts will make sure that the /etc/hosts files is updated accordingly.

#cloud-config
hostname: berry
manage_etc_hosts: true

Other options are available in the Set Hostname cloud-init module such as setting a fully qualified domain name using the fqdn directive if needed.

Setting the system timezone

The timezone can be setup easily using the timezone directive. If set, it must be a valid file under /usr/share/zoneinfo.

#cloud-config
timezone: "Europe/London"

Updating the system locale

By default, BerryOS does not ship with any generated locale to save on space. This means that we cannot use the Locale cloud-init module to update it. Instead, it should be configured post-provisioning using localectl. We can instruct cloud-init to do so using the runcmd, which allows us to run arbitrary commands after all other modules have run.

For example, if we wanted to update the system locale to en_US.UTF-8, this could be done as follows:

#cloud-config
runcmd:
  - localectl set-locale en_US.UTF-8

Using custom NTP pools

BerryOS ships by default with systemd-timesyncd installed and activated to handle network time synchronization. This is pretty essential on the Raspberry Pi as it does not have a battery backed hardware clock. If you need to or want to update which NTP pools the system uses to synchronize itself, they can be updated using the NTP cloud-init module.

For example, to use your local pools if you are in the UK, they can be set via:

#cloud-config
ntp:
  enabled: true
  pools:
    - 0.uk.pool.ntp.org
    - 1.uk.pool.ntp.org
    - 2.uk.pool.ntp.org
    - 3.uk.pool.ntp.org