When I try to set the timezone of a debian container immediately after launching it, I get the error “Failed to connect to bus: No such file or directory”. If I wait a few seconds after launching, then I don’t get the error. Is there a better workaround other than sleeping a constant amount of time?
To reproduce, run this script on an LXD host:
#!/bin/sh
lxc launch images:debian/11 time1
lxc exec time1 timedatectl set-timezone Europe/Athens
result:
Creating time1
Starting time1
Failed to connect to bus: No such file or directory
Workaround:
#!/bin/sh
lxc launch images:debian/11 time2
sleep 5
lxc exec time2 timedatectl set-timezone Europe/Athens
snap list lxd
Name Version Rev Tracking Publisher Notes
lxd 5.4-82d05d6 23339 latest/candidate canonical✓ -