Nc-integrity-fix - Script to resolve "Some files have not passed the integrity check" warnings


nc-integrity-fix is a script to resolve

  • Some files have not passed the integrity check

warnings


Every Nextcloud admin has been confronted with this warning sooner or later and is then always busy searching and checking again to find and eliminate the causes.
The → search function of the forum ← shows that this problem is as old as Nextcloud itself. There are so many results (well over 500) that it is even recommended to restrict the searchquery string :face_with_raised_eyebrow:.

To solve this problem once and for all times - at least for such instances that have full access to the server files (no containerized solutions like Docker, AIO etc) - I created this script with ebtb.

Install it this way:

sudo wget -O /usr/local/bin/nc-integrity-fix https://global-social.net/script/nc-integrity-fix
sudo chmod +x /usr/local/bin/nc-integrity-fix

Explanation:
- the first line downloads the script into the directory /usr/local/bin
- the second line makes it executable

You only need to install it once.
As all of my → ebtb ← scripts, it comes signed and does an integrity check on the first run and checks for updates on every startup.

Simply run it:

nc-integrity-fix

I really hope that this tool will make your life easier and save you a lot of searching and time in future.


Much and good luck,
ernolf

==========================================

  • PayPal:
    PayPal.Me @ernolf
  • Github Sponsors:
    Github Sponsors @ernolf
  • Bitcoin to
    bc1qwlcqc7zsak45vwqk0dt7hnxlrta7syzstgf7t8
  • Ethereum, BNB Smart Chain, Polygon to
    0x72b7901b3daa45a7266A77Aa3B3552aB686d0D0D
  • Solana to
    E7e13hBB7rmhY2N1MqAY88TKobBktJA7rSpTZWAPec6Y

==========================================

3 Likes

You’re a life saver!!! I was just about to cut my loses and spin up a new LXC for Nextcloud when I saw your post. I was able to successfully resolve all of my integrity checks.

Thank you for all your hard work. What a legend!

1 Like

Thank you for the appreciative words! That means a lot to me, as you obviously looked at the code yourself.
Your blog post encourages me to continue developing and maintaining my scripts.

:pray:


ernolf

2 Likes

Hello ernolf,
thanks for your script, but I receive the following message:
root@5d2365650c3f:/usr/local/bin# nc-integrity-fix
… loading modules - dependency/dev/fd/63: line 43: dpkg: command not found
/dev/fd/63: line 43: dpkg: command not found

Dependency not met!

missing dependencies:

Binary Package Description

gpg gnupg GNU Privacy Guard
xmlstarlet xmlstarlet Command line XML toolkit


please install first

I am on a linixserver-nextcloud image 29.X
Pls advice what to do?
regards
Alex

Hi @Broxel,

thank you very much for your feedback!

Could you please explain more in deep what that is. I do not know that image. Is it a containerized solution?

The script is designed for and on debian based distributions with dpkg.

Since you have not installed xmlstarlet, it tries to offer you, to install it with apt-get, wich is an interface to dpkg, which fails.

You should install

xmlstarlet

with the package manager of your system and try again.

Please give me feedback if that solves it for you and maybe some more information about your OS, maybe I can implement support for it, so that future users of the script can benefit from your feedback.


ernolf

Yes. I think @Broxel is referring to this: https://hub.docker.com/r/linuxserver/nextcloud, which would be a Docker container based on Alpine.

1 Like

Hi you both,
thanks. I do undestand that the script is made for Debian with dpkg. I am on an alpine based linux container. That’s ok.
I will check some of your other scripts, ernolf.
regards
Alex

1 Like

OK, thank you @bb77

@Broxel :

the script is not meant to run on or from within docker images. Integrity failures should be solved by the container devs.

As you can read here, it does not even support AIO or snap.

h.t.h.


Much and good luck,
ernolf

You are absolutely right. The Image developer should take care of things related to Nextcloud and underlying linux Distribution.
Anyway, many thanks to your time and Engagement here. I‘ve seen some interesting scripts and comments from you in the Forum.
Regards
Broxel

1 Like

Hello, thank you for this script. I ran about five iterations of this, which removed many files. Now each successive iteration returns the following:

Q: Do you want to remove these needless file? ([y]es or [n]o) [yes]:
rm: cannot remove ‘/var/www/nextcloud/dlib/docs/docs/chm/READ’: No such file or directory
rm: cannot remove ‘/var/www/nextcloud/THE’: No such file or directory
rm: cannot remove ‘/var/www/nextcloud/README.’: No such file or directory
rm: cannot remove ‘/var/www/nextcloud/DO’: No such file or directory
rm: cannot remove ‘/var/www/nextcloud/NOT’: No such file or directory
rm: cannot remove ‘/var/www/nextcloud/EDIT’: No such file or directory
rm: cannot remove ‘/var/www/nextcloud/THE’: No such file or directory
rm: cannot remove ‘/var/www/nextcloud/TABLE’: No such file or directory
rm: cannot remove ‘/var/www/nextcloud/OF’: No such file or directory
rm: cannot remove ‘/var/www/nextcloud/CONTENTS’: No such file or directory
rm: cannot remove ‘/var/www/nextcloud/FILE3’: No such file or directory


This exception was detected for [files_mindmap]:

  • Certificate is not valid.
    This script cannot resolve integrity violations of type ‘EXCEPTION’.

I resolved this by running
rm -rf /var/www/nextcloud/dlib/docs/docs/chm/

Additionally, dlib had come up often in this scan since long ago I had manually installed the ‘face recognition’ app. Those directories were owned by root. After fixing permissions on those directories (setting www-data as owner) the integrity check passed. Thanks again!

1 Like

Tank you for your feedback. I am hapy that you could solve it!

Hey ernolf
great work with all your scripts. I really like them :slight_smile:

One question - as I was looking for the error mentioned above:

This exception was detected for [files_mindmap]:

Certificate is not valid.
This script cannot resolve integrity violations of type ‘EXCEPTION’.

… did you also run into that problem and how did you resolve it?
Finally this thing doesn’t cause any problems - nextcloud itself is running fine and also mindmap doesn’t show any problems - so I guess it could also be ignored till a new version with a valid certificate is published.

Hi @hartmut001,

thank you very much for your kind feedback!

That’s exactly how it is. Certificates can only be corrected by the app developers themselves. It is a hint that shows that there is something wrong or incorrect with the certificate and such an error cannot simply be corrected by an “external” script.
As long as you understand why this is the case, there is no need to worry about it.


Much and good luck,
ernolf