Skip to content

Commit ad6b5f3

Browse files
committed
fix timezone issue in incus
1 parent 1fda43c commit ad6b5f3

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

lxc/install.func

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,22 @@ setting_up_container() {
11271127
msg_warn "/etc was ${_etc_mode}, which stops apt and every other service resolving names - set to $(stat -c '%a' /etc)"
11281128
fi
11291129

1130+
# Debian records the zone name in /etc/timezone, and install scripts read it
1131+
# (immich, tracearr). PVE templates ship it, the linuxcontainers images used
1132+
# on Incus ship only the /etc/localtime symlink - so `cat /etc/timezone`
1133+
# aborted the install after everything else had already been built. Only
1134+
# fills the gap: where the file exists, nothing here runs.
1135+
if [[ ! -s /etc/timezone ]]; then
1136+
local _tz="${tz:-}"
1137+
if [[ -n "$_tz" && "$_tz" != "host" && -f "/usr/share/zoneinfo/$_tz" ]]; then
1138+
ln -sf "/usr/share/zoneinfo/$_tz" /etc/localtime 2>/dev/null || true
1139+
else
1140+
_tz="$(readlink -f /etc/localtime 2>/dev/null | sed -n 's#.*/zoneinfo/##p')"
1141+
[[ -z "$_tz" ]] && _tz="Etc/UTC"
1142+
fi
1143+
echo "$_tz" >/etc/timezone 2>/dev/null || true
1144+
fi
1145+
11301146
# Wait for network
11311147
local i
11321148
for ((i = RETRY_NUM; i > 0; i--)); do

0 commit comments

Comments
 (0)