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

Timezone is no longer persisted due to read-only root file system #78

Closed
2 tasks done
zehnm opened this issue Apr 7, 2021 · 2 comments · Fixed by #83
Closed
2 tasks done

Timezone is no longer persisted due to read-only root file system #78

zehnm opened this issue Apr 7, 2021 · 2 comments · Fixed by #83
Assignees
Labels
bug Something isn't working

Comments

@zehnm
Copy link
Member

zehnm commented Apr 7, 2021

Description

After introducing the read-only root file system, the timezone can no longer be set with timedatectl set-timezone.

How to Reproduce

Steps to reproduce the behavior:

  1. Log in by ssh
  2. Set a new timezone, e.g.: timedatectl set-timezone UTC
  3. Reboot remote
  4. Check timezone with date: back to CEST

Expected behavior

Timezone can be set and is persisted during reboots.

Your Environment

  • Version used: latest master
  • Running on:
    • YIO Remote
    • Standalone Raspberry Pi

Additional context

The /etc file system overlay is only an in-memory overlay which is not persisted during reboots.

@zehnm zehnm added the bug Something isn't working label Apr 7, 2021
@zehnm zehnm added this to the Full System Update milestone Apr 7, 2021
@zehnm zehnm self-assigned this Apr 7, 2021
@zehnm
Copy link
Member Author

zehnm commented Apr 8, 2021

My current understanding: timedatectl is a systemd utility, which requires /etc/localtime to be a symlink to the timezone information. The /etc/timezone file is mostly a "Debian thing". Setting a new timezone with timedatectl only sets a new symlink and leaves /etc/localtime untouched.
More information:

Options:

  • Use TZ environment variable
    • Easy for shell & system stuff
    • Awkward to integrate into app
# date
Tue Feb  2 18:00:51 CET 2021
# export TZ=UTC
# date
Tue Feb  2 17:01:04 UTC 2021
# export TZ=US/Hawaii
# date
Tue Feb  2 07:01:38 HST 2021
  • Just use UTC as system time and handle the timezone offset in the app.
    • Needs special handling whenever dealing with times
    • Logfiles and file timestamps will be UTC
  • Persist symlink so that timedatectl can be used. Options:
    • bind-mount doesn't seem possible
    • use a persistent overlay for /etc (as for /var). Easiest solution but /etc was intended to be read-only with special exceptions.
    • Individual files are synced between the in-memory overlay and the data folder.

@zehnm
Copy link
Member Author

zehnm commented Apr 17, 2021

Setting the TZ variable in /opt/yio/app-launch.sh works fine. I think this is the easiest way to make the timezone user configurable with a read-only root filesystem and leaving systemd untouched.

  • Set system timezone to UTC
  • Store app timezone in user data file within the yio directory
  • Read the user data file in the app start up script
  • Write the user data file from within the initial setup / app configuration screen.

Alternatively a profile.d entry with a bind-mount could be used.

zehnm added a commit that referenced this issue Apr 17, 2021
The system time is now set to UTC.
The user timezone can be set with /boot/timezone containing a single line with the TZ name.

This resolves #78
zehnm added a commit that referenced this issue Apr 17, 2021
The system time is now set to UTC.
The user timezone can be set with /boot/timezone containing a single line with the TZ name.

This resolves #78
@zehnm zehnm closed this as completed in #83 Apr 18, 2021
zehnm added a commit that referenced this issue Apr 18, 2021
The system time is now set to UTC.
The user timezone can be set with /boot/timezone containing a single line with the TZ name.

This resolves #78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant