Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detailed v6 migration output on fresh installs #2217

Open
MichaIng opened this issue Feb 20, 2025 · 4 comments
Open

Detailed v6 migration output on fresh installs #2217

MichaIng opened this issue Feb 20, 2025 · 4 comments

Comments

@MichaIng
Copy link
Contributor

MichaIng commented Feb 20, 2025

Versions

  • Pi-hole:
  • AdminLTE:
  • FTL:

Platform

  • OS and version: any
  • Platform: any

Expected behavior

On a fresh install, I expect max one output line, stating that no v5 configs have been found to migrate.

Actual behavior / bug

  [✓] Migrating Pi-hole configuration to version 6
    Migrating config to Pi-hole v6.0 format
    No readable FTL config file found, using default settings
    No legacy config file found, using defaults
    Migrating config from /etc/pihole/setupVars.conf
    setupVars.conf:WEBPASSWORD -> Not set
    setupVars.conf:BLOCKING_ENABLED -> Not set
    setupVars.conf:TEMPERATURE_LIMIT -> Not set
    setupVars.conf:TEMPERATURE_UNIT -> Not set
    setupVars.conf:WEBUIBOXEDLAYOUT -> Not set
    setupVars.conf:WEBTHEME -> Not set
    setupVars.conf:PIHOLE_DOMAIN -> Not set
    setupVars.conf:DNS_FQDN_REQUIRED -> Not set
    setupVars.conf:DNS_FQDN_REQUIRED -> Not set
    setupVars.conf:DNS_bogusPriv -> Not set
    setupVars.conf:DNSSEC -> Not set
    setupVars.conf:PIHOLE_INTERFACE -> Not set
    setupVars.conf:HOSTRECORD -> Not set
    setupVars.conf:DNSMASQ_LISTENING -> Not set
    setupVars.conf:REV_SERVER -> Not set
    setupVars.conf:DHCP_ACTIVE -> Not set
    setupVars.conf:DHCP_START -> Not set
    setupVars.conf:DHCP_END -> Not set
    setupVars.conf:DHCP_ROUTER -> Not set
    setupVars.conf:DHCP_LEASETIME -> Not set
    setupVars.conf:DHCP_IPv6 -> Not set
    setupVars.conf:DHCP_RAPID_COMMIT -> Not set
    setupVars.conf:queryLogging -> Not set
    setupVars.conf:GRAVITY_TMPDIR -> Not set
    setupVars.conf:WEB_PORTS -> Not set
    Could not move /etc/pihole/setupVars.conf to /etc/pihole/migration_backup_v6/setupVars.conf
    setupVars.conf migration complete
    Config initialized with webserver ports 80 (HTTP) and 443 (HTTPS), IPv6 support is enabled
    Wrote config file:
     - 152 total entries
     - 151 entries are default
     - 1 entry is modified
     - 0 entries are forced through environment
    Config file written to /etc/pihole/pihole.toml

Steps to reproduce

Steps to reproduce the behavior:

  1. curl -sSL https://install.pi-hole.net | bash

Debug Token

  • URL:

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

The migration is skipped it the v6 config exists already, which is not the case on a fresh v6 install. I probably makes sense to not trust the absence of one or two specific config files within the installer, where the migration includes a bunch of files and directories, but pihole-FTL internally can skip the verbose output. It already recognizes that there is no config, prints two lines about this, then prints another line that it will migrate this non-existing config and then a lot of lines that each setting was not set and hence all (but the network port) are defaults. I guess it can exit early if there is no /etc/pihole/setupVars.conf and /etc/pihole/migration_backup_v6 is empty, skipping everything else, to give users a better impression and overview of relevant install output.

@DL6ER
Copy link
Member

DL6ER commented Feb 21, 2025

We discussed this internally a long time ago and thought it'd be worth being verbose by default to ensure no surprises happen. We print this while we are working through the file so we don't know on the first line if there will be something coming later. But I agree that we do not need to run this at all if there is no setupVars.conf: #2238

@MichaIng
Copy link
Contributor Author

MichaIng commented Feb 21, 2025

But I agree that we do not need to run this at all if there is no setupVars.conf

Yes this is what I was thinking. Just to clarify, where I tracked it down correctly:

  • Migrating Pi-hole configuration to version 6 is the output of the installer
  • Migrating config to Pi-hole v6.0 format is pihole-FTL is from pihole-FTL when called with migrate v6 command.
  • No readable FTL config file found, using default settings is produced from readFTLlegacy() function, if there is no pihole-FTL.conf.
  • No legacy config file found, using defaults is produced from migrate_config_v6(), after calling readFTLlegacy(), repeating the same info.
  • Migrating config from /etc/pihole/setupVars.conf is self-explaining. And your PR would skip this one and everything until excluding Config file written to /etc/pihole/pihole.toml, if setupVars.conf does not exist.

You PR will address this issue pretty well. As perfectionist, I would further suggest the following:

  • Have pihole-FTL importing pihole-FTL.conf from the migration dir, instead of /etc/pihole/setupVars.conf, same with /etc/pihole/custom.list, so that it really only reads files from /etc/pihole/migration_backup_v6.
  • Have the installer copy /etc/pihole/setupVars.conf and /etc/pihole/custom.list to /etc/pihole/migration_backup_v6 (instead of pihole-FTL doing this), prior to calling pihole-FTL.
  • Add something like this to the installer:
    rmdir --ignore-fail-on-non-empty "${V6_CONF_MIGRATION_DIR}"
    if [ ! -d "${V6_CONF_MIGRATION_DIR}" ]; then
        printf "  %b %s..." "${INFO}" 'No Pi-hole v5 configuration files found. Skipping migration.'
        return 0
    fi
    
    # Finally, after everything is in place, we can create the new config file
    # /etc/pihole/pihole.toml
    # This file will be created with the default settings unless the user has
    # changed settings via setupVars.conf or the other dnsmasq files moved above
    str='Pi-hole v5 configuration files found. Calling pihole-FTL to migrate those for Pi-hole v6.'
  • Remove or degrade to debug/verbose (by default hidden) redundant No legacy config file found, using defaults output from migrate_config_v6().
  • Make clear in readFTLlegacy() that it is about the legacy pihole-FTL.conf, and align with setupVars.conf migration to print an info only, instead of a warning =>
    log_info("No readable legacy FTL config file found at %s, using default settings", path);

So as result:

  • pihole-FTL migrate v6 is only called if there is anything to migrate. On first service start, it creates a default /etc/pihole/pihole.toml anyway, the migration call is not needed for this.
  • The installer makes more clear whether v5 configs have been found or not, and that it will call pihole-FTL for the migration, so it is more transparent for interested people like me which output comes from where.
  • One redundant output about missing legacy pihole-FTL.conf is skipped, but it is made clear that it is about pihole-FTL.conf to better separate that output from setupVars.conf related ones.

@DL6ER
Copy link
Member

DL6ER commented Feb 21, 2025

I am currently rather swamped with support requests for all possible kinds of setups (mostly users having another web server on the same machine stuff), so I would not at all mind if you could PR your suggestions yourself and we only need to review this later ;-)

@MichaIng
Copy link
Contributor Author

Yes sure, and it is of course not at all important, just my perfectionist eye 😅.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants