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

"/etc/zoneinfo/local: No such file" after creating a container with --tz local #23550

Closed
vivienne-w opened this issue Aug 8, 2024 · 3 comments · Fixed by containers/common#2219
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@vivienne-w
Copy link

vivienne-w commented Aug 8, 2024

Issue Description

When creating a container on NixOS with --tz local, it later fails to start with this error:

Error: unable to start container "73dff85a07f82a43733f8685b561e4b175c282de8d6355ee433ab65c025088a8": configuring timezone for container 73dff85a07f82a43733f8685b561e4b175c282de8d6355ee433ab65c025088a8: setting timezone for container 73dff85a07f82a43733f8685b561e4b175c282de8d6355ee433ab65c025088a8: stat /etc/zoneinfo/local: no such file or directory

Steps to reproduce the issue

  1. podman create --tz local --name test debian
  2. podman start test

Describe the results you received

Error: unable to start container "73dff85a07f82a43733f8685b561e4b175c282de8d6355ee433ab65c025088a8": configuring timezone for container 73dff85a07f82a43733f8685b561e4b175c282de8d6355ee433ab65c025088a8: setting timezone for container 73dff85a07f82a43733f8685b561e4b175c282de8d6355ee433ab65c025088a8: stat /etc/zoneinfo/local: no such file or directory

Describe the results you expected

The container starts normally, with the correct timezone configured.

podman info output

host:
  arch: amd64
  buildahVersion: 1.37.0
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: Unknown
    path: /nix/store/3azk5pxlxzdmsif5qnr0agy1rgp73qd7-podman-helper-binary-wrapper/bin/conmon
    version: 'conmon version 2.1.12, commit: '
  cpuUtilization:
    idlePercent: 98.92
    systemPercent: 0.21
    userPercent: 0.87
  cpus: 64
  databaseBackend: sqlite
  distribution:
    codename: vicuna
    distribution: nixos
    version: "24.11"
  eventLogger: journald
  freeLocks: 2024
  hostname: tomato
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 100
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.6.35
  linkmode: dynamic
  logDriver: journald
  memFree: 173756747776
  memTotal: 202666819584
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: Unknown
      path: /nix/store/2imm3vch2vf0r1b4y4rzwh5qs50yq3p8-podman-5.2.0/libexec/podman/aardvark-dns
      version: aardvark-dns 1.12.0
    package: Unknown
    path: /nix/store/2imm3vch2vf0r1b4y4rzwh5qs50yq3p8-podman-5.2.0/libexec/podman/netavark
    version: netavark 1.7.0
  ociRuntime:
    name: crun
    package: Unknown
    path: /nix/store/3azk5pxlxzdmsif5qnr0agy1rgp73qd7-podman-helper-binary-wrapper/bin/crun
    version: |-
      crun version 1.15
      commit: 1.15
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  pasta:
    executable: /nix/store/2imm3vch2vf0r1b4y4rzwh5qs50yq3p8-podman-5.2.0/libexec/podman/pasta
    package: Unknown
    version: |
      pasta 2024_06_24.1ee2eca
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootlessNetworkCmd: pasta
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: ""
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /nix/store/2imm3vch2vf0r1b4y4rzwh5qs50yq3p8-podman-5.2.0/libexec/podman/slirp4netns
    package: Unknown
    version: |-
      slirp4netns version 1.3.1
      commit: e5e368c4f5db6ae75c2fce786e31eef9da6bf236
      libslirp: 4.8.0
      SLIRP_CONFIG_VERSION_MAX: 5
      libseccomp: 2.5.5
  swapFree: 0
  swapTotal: 0
  uptime: 5h 56m 29.00s (Approximately 0.21 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
  - quay.io
store:
  configFile: /home/vivienne/.config/containers/storage.conf
  containerStore:
    number: 3
    paused: 0
    running: 0
    stopped: 3
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/vivienne/.local/share/containers/storage
  graphRootAllocated: 1000190722048
  graphRootUsed: 243351670784
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /tmp
  imageStore:
    number: 47
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/vivienne/.local/share/containers/storage/volumes
version:
  APIVersion: 5.2.0
  Built: 315532800
  BuiltTime: Tue Jan  1 01:00:00 1980
  GitCommit: ""
  GoVersion: go1.22.5
  Os: linux
  OsArch: linux/amd64
  Version: 5.2.0

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

OS: NixOS

echo $TZDIR 
/etc/zoneinfo

❯ ls -l /etc/localtime                   
lrwxrwxrwx - root  8 Aug 14:47 /etc/localtime -> /etc/zoneinfo/Europe/Berlin

Additional information

I assume this issue is related to NixOS setting TZDIR.

@vivienne-w vivienne-w added the kind/bug Categorizes issue or PR as related to a bug. label Aug 8, 2024
@vivienne-w
Copy link
Author

From what I can tell, the issue seems to stem from ConfigureContainerTimeZone:

case os.Getenv("TZDIR") != "":
// Allow using TZDIR per:
// https://sourceware.org/git/?p=glibc.git;a=blob;f=time/tzfile.c;h=8a923d0cccc927a106dc3e3c641be310893bab4e;hb=HEAD#l149
timezonePath = filepath.Join(os.Getenv("TZDIR"), timezone)
case timezone == "local":
timezonePath, err = filepath.EvalSymlinks("/etc/localtime")
if err != nil {
return "", fmt.Errorf("finding local timezone for container %s: %w", containerID, err)
}

Since TZDIR is set on my system, it completely ignores that timezone is "local", and thus tries to look up etc/zoneinfo/local.

Since the fix looks simple enough, Id happily open a PR, if its alright to use the CI for running the tests.

@Luap99
Copy link
Member

Luap99 commented Aug 8, 2024

PR are welcome, note that the code you linked is in c/common so the fix must be submitted there first then we can update the dependency in podman once this is merged there.

I guess swapping both cases will make it work.

vivienne-w added a commit to vivienne-w/containers-common that referenced this issue Aug 9, 2024
More specifically, when timezone is "local", ignore the value of TZDIR
entirely - previously, ConfigureContainerTimeZone would check TZDIR
first, and then look for a literal "local" timezone.

This lead to a "/etc/zoneinfo/local: No such file or directory" error
with `podman start` on NixOS.
See: containers/podman#23550

Signed-off-by: Vivienne Watermeier <[email protected]>
@Luap99
Copy link
Member

Luap99 commented Sep 6, 2024

@vivienne-w I see commit here linked, are you going to open a PR in c/common?

@Luap99 Luap99 self-assigned this Oct 30, 2024
Luap99 added a commit to Luap99/common that referenced this issue Oct 30, 2024
The special value local must always be higher priority then the TZDIR
env so make sure local is matched before. Without this we joined local
on the TZDIR path which of course does not result in a valid timezone
path.

I will add a regession test in podman.

Fixes: containers/podman#23550

Signed-off-by: Paul Holzinger <[email protected]>
Luap99 added a commit to Luap99/libpod that referenced this issue Nov 1, 2024
Regression test for containers#23550. Setting the TZDIR env should make no
difference for the local timezone as this is not a real timezone name
that is resolved from that directory.

Signed-off-by: Paul Holzinger <[email protected]>
Luap99 added a commit to Luap99/libpod that referenced this issue Nov 4, 2024
Regression test for containers#23550. Setting the TZDIR env should make no
difference for the local timezone as this is not a real timezone name
that is resolved from that directory.

Signed-off-by: Paul Holzinger <[email protected]>
Luap99 added a commit to Luap99/libpod that referenced this issue Nov 5, 2024
Regression test for containers#23550. Setting the TZDIR env should make no
difference for the local timezone as this is not a real timezone name
that is resolved from that directory.

Signed-off-by: Paul Holzinger <[email protected]>
Luap99 added a commit to Luap99/libpod that referenced this issue Nov 6, 2024
Regression test for containers#23550. Setting the TZDIR env should make no
difference for the local timezone as this is not a real timezone name
that is resolved from that directory.

Signed-off-by: Paul Holzinger <[email protected]>
Luap99 added a commit to Luap99/libpod that referenced this issue Nov 6, 2024
Regression test for containers#23550. Setting the TZDIR env should make no
difference for the local timezone as this is not a real timezone name
that is resolved from that directory.

Signed-off-by: Paul Holzinger <[email protected]>
Luap99 added a commit to Luap99/libpod that referenced this issue Nov 7, 2024
Regression test for containers#23550. Setting the TZDIR env should make no
difference for the local timezone as this is not a real timezone name
that is resolved from that directory.

Signed-off-by: Paul Holzinger <[email protected]>
Luap99 added a commit to Luap99/libpod that referenced this issue Nov 7, 2024
Regression test for containers#23550. Setting the TZDIR env should make no
difference for the local timezone as this is not a real timezone name
that is resolved from that directory.

Signed-off-by: Paul Holzinger <[email protected]>
(cherry picked from commit fb3a0e9)
Signed-off-by: Paul Holzinger <[email protected]>
kwilczynski pushed a commit to kwilczynski/common that referenced this issue Nov 24, 2024
The special value local must always be higher priority then the TZDIR
env so make sure local is matched before. Without this we joined local
on the TZDIR path which of course does not result in a valid timezone
path.

I will add a regression test in podman.

Fixes: containers/podman#23550

Signed-off-by: Paul Holzinger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants