Error opening index.jar file of personal repo

client
repo

#1

I’ve run into an issue setting up my own repository using the fdroidserver utility (version 0.7.0). It all works without errors while generating the index files and rsyncing to the server.

But upon adding the newly created repository to the F-Droid client application, it gives the very informative error message ‘Error getting index file’. Looking at the logcat, I’ve found:

04-15 11:28:28.620 23782  2451 E UpdateService: Error updating repository xxxxxxxxxxxxxx
04-15 11:28:28.620 23782  2451 E UpdateService: org.fdroid.fdroid.RepoUpdater$UpdateException: Error getting index file
04-15 11:28:28.620 23782  2451 E UpdateService: 	at org.fdroid.fdroid.IndexV1Updater.update(IndexV1Updater.java:147)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at org.fdroid.fdroid.UpdateService.onHandleIntent(UpdateService.java:427)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:68)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at android.os.Handler.dispatchMessage(Handler.java:102)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at android.os.Looper.loop(Looper.java:154)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at android.os.HandlerThread.run(HandlerThread.java:61)
04-15 11:28:28.620 23782  2451 E UpdateService: Caused by: java.util.zip.ZipException: error in opening zip file
04-15 11:28:28.620 23782  2451 E UpdateService: 	at java.util.zip.ZipFile.open(Native Method)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at java.util.zip.ZipFile.<init>(ZipFile.java:225)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at java.util.zip.ZipFile.<init>(ZipFile.java:148)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at java.util.jar.JarFile.<init>(JarFile.java:161)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at java.util.jar.JarFile.<init>(JarFile.java:140)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at org.fdroid.fdroid.IndexV1Updater.processDownloadedIndex(IndexV1Updater.java:157)
04-15 11:28:28.620 23782  2451 E UpdateService: 	at org.fdroid.fdroid.IndexV1Updater.update(IndexV1Updater.java:102)
04-15 11:28:28.620 23782  2451 E UpdateService: 	... 5 more

It seems not to be able to open the index.jar zip file, while I’m able to open it normally on my PC and even on my Android phone using Ghost Commander.

Any ideas on how to solve this problem?

Btw. using the old (xml) index format works as expected.


#2

That sounds weird indeed. Could you upgrade to a newer fdroidserver version and test if this might be fixed there?

Apart from that if the old index format works I’m out of ideas. Which version of fdroidclient are you using?


#3

my guess is that your index.jar has an invalid signature on it.


#4

Thanks to some great tips from @NicoAlt I’ve been able to solve the problem, which in the end wasn’t a bug of the f-droid software:

Happens that my nginx server always returned the index.html page for all urls that did not exist instead of returning an 404 error code. F-Droid apparently searched for an index-v1.json file which indeed wasn’t generated by the installed fdroidserver version. So the client got the index.html page instead a proper index-v1.json and failed to read the index file (obviously).

Just for completeness, this was part of my nginx configuration before, where for all non existent files the root index.html was returned instead of the 404 HTTP status:

location / {
            try_files $uri $uri/ /index.html;
}

I’ve changed it to the following now, and everything started to work as a charm:

location / {
            try_files $uri $uri/ index.html =404;
}

Thanks again for all your ideas and comments!


#5

Thanks for posting the solution! I just wanted to add one small correction: F-Droid looks for index-v1.jar then index.jar, in that order. It never looks to download index-v1.json, but only extracts that file from index-v1.jar after it has verified the JAR signature.


#6

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.