How to prevent customized files from being updated?

Hi,

I've been using Pi-hole for a couple of months, it's awesome, I love it! I've found on this forum a lot of what I wanted to do, and much more, but I still have some questions. Here goes the first one.

I've changed the column widths, drop-down list values and default number of rows on the Query Log page, but it makes updating a hassle since my queries.js file needs to be restored afterwards.

Is there a simple way to prevent that file - and possibly others - from getting updated?

No for good reasons: They usually change. However, if you find your modifications useful, we happily accept pull requests (and also feature requests if you want to discuss something) to make your individual changes available to the community. Once they are part of the official release, there is no need for local file editing anymore.

Thanks for your very fast reply!

It's great that you accept pull requests, but I need to maintain that file separately at the moment, since v3.2 introduced some GUI features that... I don't understand... yet. I'll open an FR about that.

Take a look at the command chattr.

Yes, you can chattr a file and keep it from updating. However as @DL6ER points out, locking a single file or configuration may end up breaking further updates if you pull down a new Pi-hole update and there are files we have changed. Most of the files that we may modify include a header to specify that. So if you do end up with something breaking, let us know that you have chattr'd a file so that we know as well when trying to troubleshoot.

A quick experiment with setting the 'i' attribute indeed makes the file immutable, so it must be exactly what I needed. Thanks, @mibere!

And thanks @DanSchaper for the warning. I'll keep an eye on changes you guys make to that file, and I'll first try your version in case of an issue.

1 Like

I know this is old but I ran across this same type of issue.

I changed my port to another one in lighttpd.conf so I could implement caddy server and have https without a warning. I also changed the login timeout for the web interface to 30 days in password.php and cosmetically loginpage.php. When I update pihole (pihole -up), it overwrites these files and, unless I remember, breaks the web interface.

are these files usually or ever really changed during udpates or are they just overwritten as a matter of course?

Thanks!

There is a big fat warning right at the start of the file...


Sometimes we change something in the files, sometimes they are just overwritten.

My next question then: does the external.conf data supersede the values in lighttpd.conf?

If there are conflicting entries, lighttpd will throw an error.

The correct way to change the lighttpd port is as follows:

Check your lighttpd version with this command.

lighttpd -v

If that returns 1.4.46 or above, you can overwrite the port from Pi-hole's lighttpd.conf in your external.conf like this:

server.port := 8888

Note that the := operator isn't supported in older versions of lighttpd .

Thanks jfb
I'm running lighttpd 1.4.53.

So the := operator avoids a conflict because it is a replace. I see, thanks.

1 Like