-
Notifications
You must be signed in to change notification settings - Fork 18k
time: cannot find zone in zip file /usr/local/go/lib/time/zoneinfo.zip #34188
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
Comments
Do you mean you have compiled a go program on some machine with Go 1.11.4, and then you transfer the binary to an Ubuntu 16.04 system without Go installed? And then you get the error on that system? The compiled binary needs access to time zone data files on the destination system. You need to ensure this. Go cannot do it. On Ubuntu, you might be missing the tzdata package that has provides /usr/share/zoneinfo contents. Try "apt-get install tzdata". On the other hand, the error would imply that you have a /usr/local/go/lib/time/zoneinfo.zip file on that Ubuntu system. No ubuntu package should ever install anything to that location. Do you know where that file comes from? |
Hi @antong , Thanks for the help! Yes, I am running go binary as Debian package in Ubuntu(16.x) without go runtime. And I could see zoneinfo file in usr/share/zoneinfo file system I run locate zoneinfo command to find the zoneinfo in filesystem, it listdowns all zonefiles as below e.g: It means we have the zoneinfo in the filesystem but go library is not able to locate/find it seems. i tried setting ZONEINFO variable, that also didn't work |
I see two different issues that need to be figured out. First, why does the program not pick up the system tzdata on the Ubuntu system? Second, why can't the program find the zone data in zoneinfo.zip. @pagidi , Can you confirm that that you have /usr/share/zoneinfo/Asia/Kolkata on your system and that it is readable by the user running your program?
I checked this on Ubuntu 16.04 LTS (is this what you mean with Ubuntu 16.x?). And with tzdata installed, it exists. For the second issue, can you check whether zoneinfo.zip is readable by the user running your program, and that it contains Asia/Kolkata:
Where did this file /usr/go/lib/time/zoneinfo.zip come from, as you say there is no Go installed? I verified that in the file distributed with Go, the Asia/Kolkata entry does exist. I used the following program for testing (https://play.golang.org/p/lPgieqX_wj4). Can you verify that this is what you are doing?
|
Hi @antong Ideally program should try to read it from /usr/share/zoneinfo/, But I am not sure why it tries for /usr/local/go/lib/time/zoneinfo When I look at /usr/share/zoneinfo/Asia/Kolkata file access, it has full access ubuntu@dev-vir-abc:/usr/share/zoneinfo/Asia$ ls -l Kolkata Not sure what I am missing here... |
@pagidi Please show us the output of the exact command shown above, run on the Ubuntu server, run by the user that is running the Go program: |
Here is the output a38dc7a0d371d23d38dca5b5921b50e6 /usr/share/zoneinfo/Asia/Kolkata |
Thanks. Unfortunately I have no explanation for this. The Go code should always look for /usr/share/zoneinfo first. The error message you are seeing is a bit misleading; it was improved in the Go 1.12 release (#20969). As nobody else has reported this problem I think it is likely to have something to do with your environment, but I don't know what that would be. The next debugging step I would suggest would be to run your program under |
The username and directory in the output hints that this may not be a standard way running a binary, but perhaps a snapcraft/snappy app. I don't know much about that architecture, but I've understood that dependencies are bundled and there are different forms of security confinement. |
The problem is with my code Value being passed as "Asia/Kolkata" instead Asia/Kolkata (extra double-quote) I just trimmed the extra chars using It worked Thanks! @antong and @ianlancetaylor |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Not sure
What operating system and processor architecture are you using (
go env
)?OS: Ubuntu 16.x
No go Run time, Running as a .deb package
go env
OutputWhat did you do?
loc,err := time.LoadLocation(timeZone)
What did you expect to see?
*time.Location as a return value
What did you see instead?
error message : cannot find "Asia/Kolkata" in zip file /usr/local/go/lib/time/zoneinfo.zip
I've tried setting Variable as well but no luck!
$export ZONEINFO=/usr/share/zoneinfo/
The text was updated successfully, but these errors were encountered: