Cannot install any APK file due to "Out of Space" misleading error (plenty of space) I know there are tons of questions about this, but I have tried many possible solutions to no avail. I believe the "Out of space" error is misleading...

I have a problem: I cannot install any .apk file no matter what I try... I can install apps using Play Store though.
When I tap on an APK file in any file explorer, Android Package Installer launches. I tap the INSTALL button but I always got the following error:


  Out of space {AnyAPKApp} couldn't be installed. Free up some space and
  try again.


I have plenty of space, but even a tiny 248 KB APK won't install with the same argument...

This is the only problem I have with the ROM and it is very frustrating...
First, the details of my case:


Device: Samsung Galaxy Grand Prime+ SM-G532M, alias Galaxy J2 Prime (Xtreme detects my device as Model Number: SM-G950F)
Android: 6.0.1
ROM: Xtreme Ultimate V6.0 (15.07.2018)
TWRP: 3.0.2-0
Magisk: v17.1
Magisk Manager: 6.0.1 (151)
Storage: Adoptable
Internal storage: 7.02 GB used of 8.00 GB
SD card: 9.09 GB used of 14.70 GB
Root Essentials "View storage used": 9759/15787 MB (62%)
DiskUsage analysis: /system = 2.94 GiB; Free space 1.61 GiB


I've already done my homework and tried all of the following to no avail:


Move all movable apps to SD
Enable Adoptable storage
Wipe Dalvik / ART Cache and Cache partitions with TWRP
Full clean with SD Maid PRO
Force move apps to SD using SD Maid PRO
Uninstall Google Play Services and Google Play Store updates
Overcome unauthorized device issue while using ADB
Trying to install APK using ADB (e.g. adb install someApp.apk). I got: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
Delete /data/log contents as suggested here
Attempt to install in Safe Mode
Using Termux and the df command, I got the following output and there is free space in each partition: 
Using pm install test.apk in a terminal emulator (Termux) I got [INSTALL_FAILED_INVALID_URI]. Using full path pm install /storage/emulated/0/Download/test.apk I got the same error: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]


The problem still remains. I think this is not really related to the full storage device error, I have plenty and the error seems misleading. It has to be something else...
I gave as much info as I thought it was useful. If more is needed, just tell me to share it.

I hope you can give me some advice to try to overcome this annoying issue.

P.S. I'll add more attempts to my list as I try them.
What are the permissions on the directories where the software will be installed (and the directories leading up to the installation directory)?

Do the application(s) you are using to install the APK's have the install software right denied?  With LineageOS, this is handled by Privacy Guard.  I use X-plore: try installing it (from Play Store) and see if you can install with it.  With LineageOS, you would be prompted to allow X-plore to install software.  (It may request root privilege too.)  Perhaps you inadvertently denied the privilege earlier to your other programs (though you mention trying with adb)?

My suggestion is to backup and try reformatting the sdcard (or better yet use a new one) with the default filesystem using the built-in system utility.  On my phone, this is handled by System Preferences -> Storage (I believe).  Don't make any further changes, and try to install the APK's.