OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • 24.7 Production Series »
  • opnsense-code ports fails with "index file smaller than expected" [SOLVED]
« previous next »
  • Print
Pages: [1]

Author Topic: opnsense-code ports fails with "index file smaller than expected" [SOLVED]  (Read 597 times)

jds

  • Full Member
  • ***
  • Posts: 112
  • Karma: 3
    • View Profile
opnsense-code ports fails with "index file smaller than expected" [SOLVED]
« on: August 05, 2024, 10:19:45 pm »
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
Code: [Select]
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
Code: [Select]
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.
« Last Edit: August 10, 2024, 12:59:46 am by jds »
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17747
  • Karma: 1620
    • View Profile
Re: opnsense-code ports fails with "index file smaller than expected"
« Reply #1 on: August 05, 2024, 10:21:11 pm »
opnsense-code clones into /usr/$name so you are looking for /usr/src/.git probably.


Cheers,
Franco
Logged

jds

  • Full Member
  • ***
  • Posts: 112
  • Karma: 3
    • View Profile
Re: opnsense-code ports fails with "index file smaller than expected"
« Reply #2 on: August 05, 2024, 10:35:17 pm »
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
Code: [Select]
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.
Logged

jds

  • Full Member
  • ***
  • Posts: 112
  • Karma: 3
    • View Profile
Re: opnsense-code ports fails with "index file smaller than expected"
« Reply #3 on: August 05, 2024, 10:57:00 pm »
After some more research, I tried git pull --prune. This mostly worked, but there are some unexpected local audio commits:
Code: [Select]
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.
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17747
  • Karma: 1620
    • View Profile
Re: opnsense-code ports fails with "index file smaller than expected"
« Reply #4 on: August 06, 2024, 07:33:03 am »
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
« Last Edit: August 06, 2024, 03:58:28 pm by franco »
Logged

jds

  • Full Member
  • ***
  • Posts: 112
  • Karma: 3
    • View Profile
Re: opnsense-code ports fails with "index file smaller than expected"
« Reply #5 on: August 06, 2024, 03:24:48 pm »
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.
Logged

jds

  • Full Member
  • ***
  • Posts: 112
  • Karma: 3
    • View Profile
Re: opnsense-code ports fails with "index file smaller than expected"
« Reply #6 on: August 10, 2024, 12:59:10 am »
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.
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • 24.7 Production Series »
  • opnsense-code ports fails with "index file smaller than expected" [SOLVED]
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2