Jinja error: list index out of range when applying config change after upgrade

  • I'm running a Debian server with OMV on top. I was running buster with OMV 5, updated to bullseye with OMV 6. I ran into a few issues but resolved most of them except for an error when trying to apply configuration changes. I then (probably stupidly!) tried updating to OMV 7 but similar issues remain.


    Most things seem ok - the server is up, I can see the samba drives on the network, the UI loads and shows my config. However, the Ui shows pending configuration changes need applying, with a long list of modules to update starting with apt. When I try to apply changes, it comes up with an error regarding a Jinja template, "IndexError: list index out of range".


    My current setup has the following openmedia packages installed:

    Code
    ii  openmediavault                             7.0-24                           all          openmediavault - The open network attached storage solution
    ii  openmediavault-keyring                     1.0.2-2                          all          GnuPG archive keys of the openmediavault archive
    ii  openmediavault-omvextrasorg                6.3.6                            all          OMV-Extras.org Package Repositories for OpenMediaVault


    My apt sources.list and sources.list.d openmedia entries have the following between them:

    Code
    deb http://deb.debian.org/debian/ bookworm main contrib non-free
    deb https://deb.debian.org/debian-security bookworm-security main contrib
    deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free
    
    deb [signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] http://packages.openmediavault.org/public sandworm main
    deb [signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] http://openmediavault.github.io/packages/ sandworm main
    deb [trusted=yes] file:/var/cache/openmediavault/archives /

    I think this is primarily an issue from the 5->6 upgrade even though I'm now on 7. I've tried countless things so the path to getting to this point is a bit confused at this stage but hoping someone can help provide more clarity on how I can recover this.


    Many thanks in advance

    Toby

  • chente

    Hat das Thema freigeschaltet.
  • It's funny how posting an issue focuses the mind! I took at look at the aptpkg.py script where the error was starting from and added some logging

    This revealed the problem entry:
    Error handling opt 1, cdrom: [Debian


    A quick grep showed there was a commented-out entry in /etc/apt/sources.list for the cdrom so I deleted all the commented-out lines in the file, refreshed and tried again and now everything is working.

    • Offizieller Beitrag

    If you have everything apparently working the OMV database is supposed to be sorted, although you could still have other errors after what you've done, which is quite strange. I would recommend that you do a fresh installation and use omv-regen to move the OMV configuration. You can use a different disk and you can always go back if something goes wrong.

  • I agree it's odd for a commented line to cause an error. I think the reason is that the _get_opts call is using the following regular expression to pull out the data:

    get_opts = re.search(r"\[(.*=.*)\]", line)

    so doesn't exclude anything starting with #


    Looking at SourcesList and SourceEntry, it parses all the lines including those with a #, but SourceEntry adds a "disabled" flag for any line that's commented out.

    The original SourceList add() method filters out disabled SourceEntry instances, but the add() method is overridden in salt/modules/aptpkg.py and this overridden instance does not look at the disabled flag


    Chente - thanks for the advice, I will see how things go and keep it in mind in case of any further issues!

    • Offizieller Beitrag

    How can i reporduce that issue?


    My /etc/apt/sources.list looks like

    Code
    deb https://deb.debian.org/debian bookworm main
    deb-src https://deb.debian.org/debian bookworm main
    deb https://deb.debian.org/debian bookworm-updates main
    deb-src https://deb.debian.org/debian bookworm-updates main
    #deb https://deb.debian.org/debian bookworm-backports main
    #deb-src https://deb.debian.org/debian bookworm-backports main

    and i can run omv-salt deploy run apt without problems.

  • Hmm. I can't seem to replicate it. Unfortunately, I didn't backup the file before removing the commented lines so can't say exactly what it was


    The key thing was the line was commented out and had some text between square brackets, something like


    # deb cdrom:[Debian GNU/Linux 10.8.0 _Buster_ - Official amd64 DVD Binary-1 20210206-10:31]/ buster contrib main


    That said I've tried putting that back into sources.list and omv-salt deploy run apt runs fine. I must have had something a bit funkier but not sure what. I did delete multiple commented-out lines when I fixed it but can't recall what the others had. Probably not worth pursuing further to be honest!

    • Offizieller Beitrag

    and i can run omv-salt deploy run apt without problems.

    Is it worth having the apt module maintain /etc/apt/sources.list? It could have an environment variable to enable or disable maintaining the file for those that want a custom list of debian repos. Since the default is an http redirector, it should work for any location.


    Code
    deb http://deb.debian.org/debian/ bookworm main non-free non-free-firmware
    deb-src http://deb.debian.org/debian/ bookworm main non-free non-free-firmware
    
    deb http://deb.debian.org/debian/ bookworm-updates main non-free-firmware
    deb-src http://deb.debian.org/debian/ bookworm-updates main non-free-firmware

    omv 7.1.0-2 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.2 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.5 | scripts 7.0.7


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!