Skip to content

rootfs: add resize, timesync, and staging repo cleanup#124

Open
bjordiscollaku wants to merge 1 commit intomainfrom
feat/rootfs-resize-timesync-repo-cleanup
Open

rootfs: add resize, timesync, and staging repo cleanup#124
bjordiscollaku wants to merge 1 commit intomainfrom
feat/rootfs-resize-timesync-repo-cleanup

Conversation

@bjordiscollaku
Copy link
Contributor

Three independent improvements to the rootfs build pipeline:

  1. First-boot filesystem resize (rootfs-resize.service)

    • Add Step 7.6 that writes /usr/local/sbin/rootfs-resize.sh and /etc/systemd/system/rootfs-resize.service into the rootfs from the host side before entering chroot.
    • The service uses a ConditionPathExists flag file (/etc/rootfs-resize-pending) to guarantee single execution: on first boot resize2fs expands the ext4 root filesystem to fill the underlying block device, then ExecStartPost removes the flag so the unit never fires again.
    • systemctl enable rootfs-resize.service is called inside the chroot to wire the unit into multi-user.target.
  2. Time synchronization (systemd-timesyncd)

    • Install and enable systemd-timesyncd inside the chroot immediately after the networking stack.
    • systemd-timesyncd is the standard lightweight SNTP client shipped with systemd and is the broadly accepted solution on both Ubuntu and Debian for non-server embedded/IoT targets. It resolves clock-skew failures observed in browsers and TLS certificate validation at runtime.
  3. Staging apt source cleanup (Step 9.5)

    • Remove /etc/apt/sources.list.d/pkg-oss-staging-repo.list from the rootfs after the chroot exits and before the ext4 image is created, ensuring internal staging repositories do not leak into the shipped image.

Three independent improvements to the rootfs build pipeline:

1. First-boot filesystem resize (rootfs-resize.service)
   - Add Step 7.6 that writes /usr/local/sbin/rootfs-resize.sh and
     /etc/systemd/system/rootfs-resize.service into the rootfs from
     the host side before entering chroot.
   - The service uses a ConditionPathExists flag file
     (/etc/rootfs-resize-pending) to guarantee single execution: on
     first boot resize2fs expands the ext4 root filesystem to fill the
     underlying block device, then ExecStartPost removes the flag so
     the unit never fires again.
   - systemctl enable rootfs-resize.service is called inside the
     chroot to wire the unit into multi-user.target.

2. Time synchronization (systemd-timesyncd)
   - Install and enable systemd-timesyncd inside the chroot
     immediately after the networking stack.
   - systemd-timesyncd is the standard lightweight SNTP client
     shipped with systemd and is the broadly accepted solution on
     both Ubuntu and Debian for non-server embedded/IoT targets.
     It resolves clock-skew failures observed in browsers and TLS
     certificate validation at runtime.

3. Staging apt source cleanup (Step 9.5)
   - Remove /etc/apt/sources.list.d/pkg-oss-staging-repo.list from
     the rootfs after the chroot exits and before the ext4 image is
     created, ensuring internal staging repositories do not leak into
     the shipped image.
EOF

# ==============================================================================
# Step 7.6: Create first-boot rootfs resize service
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create this as static file, or a deb package which can be installed instead of creating it at build time?

@shoudil
Copy link
Contributor

shoudil commented Mar 24, 2026

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

Successfully merging this pull request may close these issues.

3 participants