Dashboard login does not recognize password change

After setting a new password on the CLI, the web interface don't kicks me out from an active session and the login still only accepts the old password.

The pwhash value in pihole.toml gets updated and the file's modify timestamp also changes, but FTL seem to do not get that.

dietpi@DietPi:~$ stat /etc/pihole/pihole.toml
  File: /etc/pihole/pihole.toml
  Size: 43696           Blocks: 88         IO Block: 4096   regular file
Device: 179,1   Inode: 133947      Links: 1
Access: (0660/-rw-rw----)  Uid: (  996/  pihole)   Gid: ( 1001/  pihole)
Access: 2023-11-22 17:48:49.615667230 +0000
Modify: 2023-11-22 17:48:49.619667230 +0000
Change: 2023-11-22 17:49:03.043667237 +0000
 Birth: 2023-11-22 17:48:49.615667230 +0000

dietpi@DietPi:~$ sudo pihole setpassword 1111
  [✓] New password set

dietpi@DietPi:~$ stat /etc/pihole/pihole.toml
  File: /etc/pihole/pihole.toml
  Size: 43696           Blocks: 88         IO Block: 4096   regular file
Device: 179,1   Inode: 134385      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-11-22 17:51:05.611667295 +0000
Modify: 2023-11-22 17:51:05.619667295 +0000
Change: 2023-11-22 17:51:05.643667295 +0000
 Birth: 2023-11-22 17:51:05.611667295 +0000

But if I do

sudo nano /etc/pihole/pihole.toml

and write out the file without making any changes, then I'm getting kicked out immediately from the active web session.

BTW, when tailing the FTL.log file in the browser while restarting pihole-FTL on the CLI, the last displayed output is

Shutting down... // exit code 0 // jmpret 0

Newer lines never displayed until the website gets reloaded.

I already re-wrote the OS image (dietpi) and re-installed pi-hole but still the same

Thanks for the tests.

I just tested inside a container and I saw the same behavior.

pihole setpassword is not triggering the web interface reload. After manually opening and saving the config file, the process was triggered as expected.

Please set

debug.inotify = true

either directly in the TOML file or by running something like

pihole-FTL --config debug.inotify true

and test setting the password via the CLI.

Does FTL log according change messages into /var/log/pihole/FTL.log ?

Yes, it does. I get

2023-11-22 20:58:50.825 File created: /etc/pihole/pihole.toml.tmp
2023-11-22 20:58:50.825 File written: /etc/pihole/pihole.toml.tmp
2023-11-22 20:58:50.826 File moved: /etc/pihole/pihole.toml.tmp
2023-11-22 20:58:50.826 File moved: /etc/pihole/pihole.toml

Ah, yes, that makes it clear. This is a regression of Do not rewrite config files if unchanged by DL6ER · Pull Request #1746 · pi-hole/FTL · GitHub. Before, we wrote directly to pihole.toml triggering a CLOSE_WRITE event in inotify. Now we, instead, first write to pihole.toml.tmp, compare it with pihole.toml and either replace pihole.toml (MOVE event) or simply discard pihole.toml.tmp not touching pihole.toml at all.

The inotify watching was configured to only monitor writing events but not the replacement due to move. I also refined the debug printing to instead log more explicitly:

2023-11-22 20:58:50.826 File moved from: /etc/pihole/pihole.toml.tmp
2023-11-22 20:58:50.826 File moved to: /etc/pihole/pihole.toml

Please try FTL from branch fix/inotify_move at your earliest convenience (pre-built binaries should become available in roughly 20-30 minutes
pihole checkout ftl fix/inotify_move

edit It has already been merged into development-v6

1 Like

I could reproduce it on bare metal. The linked branch fixed it.

1 Like

Thanks. It works now as expected.

There's one more thing from the first post:

When pihole-FTL gets restarted (e.g. after an settings change or by hand via sudo service pihole-FTL restart), this will break the tailing output.
The webserver gets still queried every second for new data, but no further lines are transmitted.

Ah yes, that's likely because the web interface keeps asking for nextID=50 so no new content is added until the new log reaches 50 lines. This needs to be reset to 0 on FTL restart. Thanks!

This will be fixed by

in combination with

Many thanks! It works now as expected :+1: