opnsense-code ports fails with "index file smaller than expected" [SOLVED]

Started by jds, August 05, 2024, 10:19:45 PM

Previous topic - Next topic
Am running the latest firmware on OPNsense on bare metal, but this problem might have existed earlier, unnoticed. I am updating my tailscale installation with
root@OPNsense:/home # opnsense-code src
fatal: .git/index: index file smaller than expected


This typically indicates a corrupt index file which can be removed and rebuilt.  However, the index does not exist in the usual place root@OPNsense:/home # git status
fatal: not a git repository (or any of the parent directories): .git
, though I am not sufficiently familiar with freeBSD to know.  The OPNsense documentation (https://docs.opnsense.org/manual/software_included.html#the-ports-tree) does suggest that this should be the usual place.

Am hoping that anyone more knowledgeable than I knows how to find the index and fix this. Thanks.

opnsense-code clones into /usr/$name so you are looking for /usr/src/.git probably.


Cheers,
Franco

Wow, that was fast---thanks! Your guess was close, it is in /usr/tools/.git
I removed the index, and made progress, but with a new error. I removed that index, and ran
root@OPNsense:/usr/ports/.git # git reset HEAD
root@OPNsense:/usr/ports/.git # opnsense-code ports
remote: Enumerating objects: 2279, done.
remote: Counting objects: 100% (1829/1829), done.
remote: Compressing objects: 100% (582/582), done.
remote: Total 2279 (delta 1190), reused 1512 (delta 1111), pack-reused 450
Receiving objects: 100% (2279/2279), 711.82 KiB | 2.88 MiB/s, done.
Resolving deltas: 100% (1401/1401), completed with 56 local objects.
fatal: bad object refs/heads/master
error: https://github.com/opnsense/tools did not send all necessary objects

There is also /usr/ports/.git/index, which I moved and ran the above again, with the same results.  I don't know what /usr/ports/.git/refs/heads should look like but it is just some hex number, like a hash.

After some more research, I tried git pull --prune. This mostly worked, but there are some unexpected local audio commits:
error: Your local changes to the following files would be overwritten by merge:
        audio/vban/Makefile
        audio/virtual_oss/Makefile
        audio/virtual_oss/distinfo
        audio/virtual_oss_ctl/Makefile
        audio/virtual_oss_ctl/distinfo
        audio/visp-go/Makefile
        audio/vmpk/Makefile
        audio/vmpk/distinfo
        audio/vmpk/pkg-plist
        audio/vst3sdk/Makefile
        audio/vst3sdk/distinfo
        audio/vst3sdk/files/patch-cmake_modules_SMTG__AddSMTGLibrary.cmake
        audio/vst3sdk/files/patch-cmake_modules_SMTG__PlatformToolset.cmake
        audio/vst3sdk/files/patch-pluginterfaces_base_fplatform.h
        audio/vst3sdk/files/patch-pluginterfaces_base_funknown.cpp
        audio/vst3sdk/files/patch-public.sdk_source_vst_auwrapper_again_CMakeLists.txt
        audio/vst3sdk/files/patch-vstgui4_vstgui_lib_platform_linux_x11fileselector.cpp
        audio/vst3sdk/files/patch-vstgui4_vstgui_tests_unittest_CMakeLists.txt
Please commit your changes or stash them before you merge.
Aborting

Since I don't know anything about these files, I don't know where to discard or merge them. I may have already done enough damage.

Something is generally unstable on your end. If I could make a guess it's the disk. I've seen weird things from git over the years but not that it would always continue to fail setting up a clone.

You could also set up a shallow clone (away from opnsense-code):

# cd /usr && rn -rf ports && git clone --depth 0 https://github.com/opnsense/ports

This brings in the bare minimum of the current repo and you can --unshallow later with git-fetch if you need.


Cheers,
Franco

I am afraid that you are probably correct. I am trying to be in denial. It might be best to swap in my backup and do a fresh install after a disk check. Thanks for your help.

I took the drive out and did a smartctl long check, but nothing showed up. I just did a fresh install, and the problem seems to be gone, so I I should mark this as SOLVED.