#15230 closed bug (fixed)
Unable to add / remove repositories
Reported by: | kallisti5 | Owned by: | leavengood |
---|---|---|---|
Priority: | critical | Milestone: | R1/beta2 |
Component: | Kits/Package Kit | Version: | R1/Development |
Keywords: | pkgman | Cc: | ttcoder |
Blocked By: | Blocking: | ||
Platform: | All |
Description (last modified by )
After https://git.haiku-os.org/haiku/commit/src/kits/package?id=dfbf1c8a0ac59206efcf819b420fbbb5bcf55251, it's not possible to "add repositories" to Haiku.
Error: Failed to open repository file "/boot/system/cache/package-repositories/Haiku": No such file or directory
This is the responsible change:
diff --git a/src/kits/package/RefreshRepositoryRequest.cpp b/src/kits/package/RefreshRepositoryRequest.cpp index 300c1e481e..da23156f9b 100644 --- a/src/kits/package/RefreshRepositoryRequest.cpp +++ b/src/kits/package/RefreshRepositoryRequest.cpp @@ -74,7 +74,11 @@ BRefreshRepositoryRequest::CreateInitialJobs() BRepositoryCache repoCache; BPackageRoster roster; - roster.GetRepositoryCache(fRepoConfig.Name(), &repoCache); + result = roster.GetRepositoryCache(fRepoConfig.Name(), &repoCache); + if (result != B_OK) { + delete fetchChecksumJob; + return result; + } ValidateChecksumJob* validateChecksumJob = new (std::nothrow) ValidateChecksumJob(fContext,
While the error checks in that commit are correct, it seems the functionality of creating repository caches depends on "erroring out loading the cache file"
The ReaderImpl won't create repositories if they are missing. I had a partial fix adding a WriterImpl if the Cache doesn't exist, but a KDL in the network stack killed my git tree and lost my stash data :-(
Change History (11)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Description: | modified (diff) |
---|
comment:3 by , 5 years ago
Cc: | added |
---|
comment:4 by , 5 years ago
Milestone: | Unscheduled → R1/beta2 |
---|
Repository files do not exist after installation. So installing Haiku from a recent anyboot image won't be able to update or install anything.
comment:5 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → in-progress |
I am pretty confident I see the problem in the code, I'll try to fix it tonight.
comment:6 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | in-progress → closed |
So I worked on this for a while and tried to fix it properly but it became too much of a rabbit hole. It totally works to just ignore the error as we did before. I at least added a comment explaining it.
Fixed in hrev53356.
When I have time I'll see about fixing it in a better way. But this has worked fine for years, and I have plenty of other things I want to work on.
comment:7 by , 5 years ago
Also to explain a bit further, BPackageRoster::GetRepositoryCache has a bug because in a new Haiku install ~/config/cache/package-repositories does not exist, so this will always fail with B_NOT_FOUND until that directory is created.
Since RefreshRepositoryRequest is always called to update repos, it was always failing due to no ~/config/cache/package-repositories existing. So if that directory is created, and the files in /system/cache/package-repositories are copied there, updates will start working, but adding new repos still won't because of another bug.
Ignoring this error skirts around both of those bugs. I have a fix for GetRepositoryCache but it is kind of ugly. The other bug is harder which is why I just added back the ignoring of the error.
comment:8 by , 5 years ago
Heh, my sentiments exactly. I found a path calling the Write implementation (instead of just the Read which fails when the cache is missing), but quickly fell into just how 'bare minimum' everything is.
comment:9 by , 5 years ago
Hello! I just installed a nightly image of Haiku and I have this bug also. I've also searched for "RefreshRepositoryRequest.cpp" to make a change to make it work but I only found a header file with the exact name. I'm guessing that file is only needed before building or something like that? May I get help to fix this bug in my system or should I wait for another nightly image that contains this commit?
comment:11 by , 5 years ago
Please follow my steps above to work around this bug. To be more clear:
- mkdir ~/config/cache/package-repositories
- cp /system/cache/package-repositories/* ~/config/cache/package-repositories
That will work around this bug enough for updates to work so you can get my fix.
You can then delete the contents of ~/config/cache/package-repositories but you can leave the directory.
Until this is fixed, I would recommend *NOT* removing the "Haiku" repository. It creates a situation where you can't get future updates without a lot of manual hacking to the Repo caches.