How to solve initialization error 1 (read_params_file: parameter not found: II*) when using --tessdata-dir parameter? - linux

Environment & Setup
Operating System: Suse Linux Enterprise Server 12 SP 1
$ uname –a
Linux 3.12.62-60.64.8-default #1 SMP Tue Oct 18 12:21:38 UTC 2016 (42e0a66) x86_64 x86_64 x86_64 GNU/Linux
Since this environment is managed, I can not update any system libraries like glibc etc.
So the newest and only official supported version for "Suse 12 SP1 x86_64" of teaaseract I found is 3.02.
Installed Packages:
libgif4-4.1.6-34.1.1.x86_64.rpm
liblept3-1.69-16.1.x86_64.rpm
libtesseract3-3.02.02-3.2.1.x86_64.rpm
libwebp4-0.3.1-34.1.x86_64.rpm
tesseract-3.02.02-59.1.x86_64.rpm
tesseract version
$ tesseract –v
tesseract 3.02.02
leptonica-1.69
libgif 4.1.6 : libjpeg 8d : libpng 1.5.22 : libtiff 4.0.6 : zlib 1.2.8
Release details
$ zypper info tesseract
Information for package tesseract:
----------------------------------
Repository: #System
Name: tesseract
Version: 3.02.02-59.1
Arch: x86_64
Vendor: obs://build.opensuse.org/home:koprok
Support Level: unknown
Installed: Yes
Status: up-to-date
Installed Size: 3.8 MiB
Summary: Open Source OCR Engine
Description: […]
Traindata & Languages
Traindata has been manually downloaded from:
https://sourceforge.net/projects/tesseract-ocr-alt/files/tesseract-ocr-3.02.eng.tar.gz/download
https://sourceforge.net/projects/tesseract-ocr-alt/files/tesseract-ocr-3.02.deu.tar.gz/download
And files have been extracted to /usr/share/tessdata/
$ ls -la /usr/share/tessdata/
drwxr-xr-x 1 root root 230 Dec 31 16:37 configs/
-rw-r--r-- 1 root root 2438081 Dec 30 15:31 deu.traineddata
-rw-r--r-- 1 root root 171918 Dec 30 20:16 eng.cube.bigrams
-rw-r--r-- 1 root root 38 Dec 30 20:16 eng.cube.fold
-rw-r--r-- 1 root root 181 Dec 30 20:16 eng.cube.lm
-rw-r--r-- 1 root root 857304 Dec 30 20:16 eng.cube.nn
-rw-r--r-- 1 root root 254 Dec 30 20:16 eng.cube.params
-rw-r--r-- 1 root root 13020078 Dec 30 20:16 eng.cube.size
-rw-r--r-- 1 root root 2444187 Dec 30 20:16 eng.cube.word-freq
-rw-r--r-- 1 root root 996 Dec 30 20:16 eng.tesseract_cube.nn
-rw-r--r-- 1 root root 21876572 Dec 30 20:16 eng.traineddata
drwxr-xr-x 1 root root 88 Dec 31 16:37 tessconfigs/
tesseract detects 'deu' and 'eng' as available languages
$ tesseract --list-langs
List of available languages (2):
deu
eng
Application & Problem
The software application is build based on Spring Boot framework. The code executing the tesseract command looks sth. like:
Runtime.getRuntime().exec(new String[] {
"tesseract",
"--tessdata-dir", "/usr/share/tessdata",
"-l", lang.getISO3Language(),
inputTiff.toAbsolutePath().toString(), extractedcntPath });
The appication logfile says
2016-12-30 20:30:02,320 [https-jsse-nio-8443-exec-7] WARN PDFContentExtractor - read_params_file: parameter not found: II*
Executing tesseract with tessdata dir fails
$ tesseract --tessdata-dir /usr/share/tessdata -l deu inputPdf6632237754781472255.tiff out4
read_params_file: parameter not found: II*
When executing tesseract with no tessdata dir works well
$ tesseract -l deu input.tiff out5
Tesseract Open Source OCR Engine v3.02.02 with Leptonica
Questions & Ideas
Why does tesseract work well and detect the available languages without the --tessdata-dir parameter set?
Why does teasseract crash during initialization when using the --tessdata-dir parameter set?
Is there any difference between running tesseract with/without the --tessdata-dir parameter set?
What can I do to fix this problem?
Install a newer version of tesseract?
Compile a version from sources?
Use other traindata/tessdata?
Run tesseract without the --tessdata-dir param?
If anybody can help me getting this issue solved in the upcomming week, it would not only make me happy, but rather our whole team.
Thank you very much in advance!
-Rüdiger

That command switch is not available until 3.04 version. Executing tesseract command will reveal what command options are supported for the current version.
https://github.com/tesseract-ocr/tesseract/wiki/Command-Line-Usage

Related

PostgreSQL create extension mongo_fdw

I want to connect a PostgreSQL database with a MongoDB by using Mongo_fdw. After following this instruction to install mongo_fdw with the autogen.sh script on Ubuntu 22.04 LTS, I wanted to check the connection and ran CREATE EXTENSION mongo_fdw; in my database, but the following error occured:
ERROR: could not access file "$libdir/mongo_fdw": No such file or directory
Searchig for a solution I found this page on GitHub, where the same error is discussed. Following the recommendations there, I checked pg_config --version, pg_config --libdir and pg_config --sharedir with the following results:
$ pg_config --version
PostgreSQL 12.9
$ pg_config --libdir
/home/qgis/anaconda3/lib
$ pg_config --sharedir
/home/qgis/anaconda3/share
When I check /home/qgis/anaconda3/share/extension I get the following files:
drwxrwxr-x 2 qgis qgis 4096 Feb 1 10:58 ./
drwxrwxr-x 32 qgis qgis 4096 Jan 18 10:28 ../
-rw-r--r-- 1 root root 157 Feb 1 10:58 mongo_fdw--1.0--1.1.sql
-rw-r--r-- 1 root root 593 Feb 1 10:58 mongo_fdw--1.0.sql
-rw-r--r-- 1 root root 709 Feb 1 10:58 mongo_fdw--1.1.sql
-rw-r--r-- 1 root root 274 Feb 1 10:58 mongo_fdw.control
-rw-rw-r-- 2 qgis qgis 310 Jun 24 2022 plpgsql--1.0.sql
-rw-rw-r-- 2 qgis qgis 179 Jun 24 2022 plpgsql.control
-rw-rw-r-- 2 qgis qgis 370 Jun 24 2022 plpgsql--unpackaged--1.0.sql
I also ran ldconfig as it is recommended on the GitHub page but with no results.
Does someone has an idea how to solve this error?
Thanks in advance!
You have to specify the correct pg_config when building the software, probably
make PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config
That file should exist if you installed the package with the C headers, which is typically called "devel" or "dev" or similar.

dpkg error trying to install packages- "unable to open files list file for package linux-headers-generic: No such device or address"

Trying to run routine updates using Mint-update (19.3 Tricia) and I'm running into an issue I haven't seen before.
When I try to install, I get the following:
dpkg: unrecoverable fatal error, aborting:
unable to open files list file for package 'linux-headers-generic': No such device or address
E: Sub-process /usr/bin/dpkg returned an error code (2)
After some Googling, I tried to manually repair by running
sudo apt-get install --reinstall linux-headers-$(uname -r)
But got the same error.
I suspect the problem is a broken link or reference, as I was dropped into initramfs on boot yesterday, which required some repairs to proceed. I have no idea what links or problems to look for since I've never poked around in that sort of thing for the OS, but I did see the following:
linux-headers-generic.list looks ok in /var/lib/dpkg/info:
b-w-rwx-wx 1 20033 root 243, 10 Jul 21 08:15 linux-headers-generic.list
-rw-r--r-- 1 root root 163 Jul 9 16:21 linux-headers-generic.md5sums
I also saw the following files for my current kernel if this helps:
-rw-r--r-- 1 root root 803877 Jul 21 08:15 linux-headers-4.15.0-151-generic.list
-rw-r--r-- 1 root root 820163 Jul 9 16:19 linux-headers-4.15.0-151-generic.md5sums
-rwxr-xr-x 1 root root 259 Jul 9 16:19 linux-headers-4.15.0-151-generic.postinst
-rw-r--r-- 1 root root 1179614 Jul 21 08:15 linux-headers-4.15.0-151.list
-rw-r--r-- 1 root root 1482865 Jul 9 16:19 linux-headers-4.15.0-151.md5sums
No idea if this problem is connected, but these are the first install errors I've seen in a LONG time.

"yum repolist" showing repo list but there is NO repo file in /etc/yum.repo.d

Could any one look into the issue and help ?
I have a Red Hat server which has Red Hat subscription and I tried to get all Security patches list using /usr/bin/yum list-security --security.
After executing above command, I see all the packages that listed are SuSE packages. Not sure why.
[root#test ~]# /usr/bin/yum list-security --security
Loaded plugins: rhnplugin, security
slessp3-bash-9740 security bash-3.2-147.20.1.x86_64
slessp3-bash-9780 security bash-3.2-147.22.1.x86_64
slessp3-binutils-201501-10214 security binutils-2.23.1-0.23.15.x86_64
Tried to verify the yum repository using yum repolist and I see the SuSE repo is enabled. But I didn't see repo file under yum.repos.d to disable.
[root#test ~]# yum repolist
Loaded plugins: rhnplugin, security
repo id repo name status
rhel-source Red Hat Enterprise Linux 5Server - Source enabled: 5,076
rpmforge RHEL 5Server - RPMforge.net - dag enabled: 11,403
sles11-sp3-pool-x86_64 SLES11-SP3-Pool for x86_64 enabled: 2,862
sles11-sp3-suse-manager-tools-x86_64 SLES11-SP3-SUSE-Manager-Tools x86_64 enabled: 121
sles11-sp3-updates-x86_64 SLES11-SP3-Updates for x86_64 enabled: 3,618
repolist: 23,080
[root#test yum.repos.d]# ls -lrt
total 28
-rw-r--r-- 1 root root 561 Jan 14 2015 rhel-debuginfo.repo
-rw-r--r-- 1 root root 1128 Mar 15 2012 rpmforge.repo
-rw-r--r-- 1 root root 728 Mar 15 2012 mirrors-rpmforge-testing
-rw-r--r-- 1 root root 739 Mar 15 2012 mirrors-rpmforge
-rw-r--r-- 1 root root 222 Sep 17 12:20 rhel-source.repo

Linux Build Package - Configure Script Throws Error, But it's Wrong

Server: SLES v11 sp3
Kernel: 3.0.101-0.47.71-default
Arch: x86_64
So I am trying to build a src package and when I run the "./configure" script it's throwing some errors that required packages are missing. Since it's x86_64 I thought adding "--libdir=/usr/lib64" or "--libdir=/lib64" would help it find the packages it's looking for but I get the same error either way.
The configure Script is failing with this error:
..........
...SNIP...
..........
checking for xgettext... (cached) /usr/bin/xgettext
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GEDIT... configure: error: Package requirements (
glib-2.0 >= 2.13.0
gio-2.0 >= 2.16.0
gtk+-2.0 >= 2.13.0
gconf-2.0 >= 1.1.11
gtksourceview-2.0 >= 2.5.1
gedit-2.20 >= 2.25.4
) were not met:
No package 'glib-2.0' found
No package 'gio-2.0' found
No package 'gtk+-2.0' found
No package 'gconf-2.0' found
No package 'gtksourceview-2.0' found
No package 'gedit-2.20' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables GEDIT_CFLAGS
and GEDIT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
I checked to make sure I actually have these packages and it seems as though I do. So I'm not sure if it's just not finding them or what... And it also seems as though I have versions of those packages >= what they are asking for, so I'm kinda stumped...
My Installed packages are:
# rpm -qa | grep -i glib-2
libglib-2_0-0-2.22.5-0.8.14.1
# rpm -qa | grep -i 'gtk2'
gtk2-32bit-2.18.9-0.35.1
gtk2-2.18.9-0.35.1
gtk2-engines-2.16.1-4.26
gtk2-branding-SLES-for-VMware-11.1-0.5.99
gtk2-engines-32bit-2.16.1-4.26
gtk2-themes-0.1-737.22
gtk2-lang-2.18.9-0.35.1
gtk2-theme-SLES-for-VMware-11.1-0.7.95
# rpm -qa | grep -i 'gio'
libgio-2_0-0-32bit-2.22.5-0.8.14.1
libgio-2_0-0-2.22.5-0.8.14.1
# rpm -qa | grep -i 'gconf2'
gconf2-2.28.0-1.8.1
gconf2-lang-2.28.0-1.8.1
# rpm -qa | grep -i 'gtksource'
gtksourceview-lang-2.8.2-0.1.195
libgtksourceview-2_0-0-2.8.2-0.1.195
python-gtksourceview-2.4.0-1.32
# rpm -qa | grep -i 'gedit'
gedit-2.28.3-0.8.1
gedit-lang-2.28.3-0.8.1
Anyone have any ideas what the issue could be here? I'm not sure what else to try..?
I had also tried installing the RPM based package but get similar errors for missing packages. See RPM Installation error below...
warning: gedit-plugins-2.28.0-2.el6.x86_64.rpm: Header V3 RSA/SHA256 signature: NOKEY, key ID c105b9de
error: Failed dependencies:
GConf2 is needed by gedit-plugins-2.28.0-2.el6.x86_64
pygobject2 is needed by gedit-plugins-2.28.0-2.el6.x86_64
pygtk2 is needed by gedit-plugins-2.28.0-2.el6.x86_64
pygtksourceview is needed by gedit-plugins-2.28.0-2.el6.x86_64
rpmlib(FileDigests) <= 4.6.0-1 is needed by gedit-plugins-2.28.0-2.el6.x86_64
If anyone has ANY thoughts or suggestions please feel free to reply, it would be much very appreciated!
Thanks in Advance,
Matt
Well I was unable to resolve those errors directly with compiling... However, we have another server with the same OS and everything that already had that package installed (which added more to my confusion why it wasn't working) so to just give it a try I copied that server's directory "/usr/lib64/gedit-2/plugins" to the one I was working on and now everything seems to be working just fine. All the plugins were able to be activated and they seem to work.!
The contents of the directory that I copied over were:
/usr/lib64/gedit-2/plugins # ll
total 700
drwxr-xr-x 4 root root 4096 Apr 28 2015 advancedfind
-rwxr-xr-x 1 root root 216 Apr 28 2015 advancedfind.gedit-plugin
-rw-r--r-- 1 root root 9856 Nov 13 2012 changecase.gedit-plugin
-rw-r--r-- 1 root root 6970 Apr 17 2014 codecomment.gedit-plugin
-rw-r--r-- 1 root root 9563 Mar 18 2014 codecomment.py
-rw-r--r-- 1 root root 8850 Apr 16 2014 codecomment.pyc
-rw-r--r-- 1 root root 8745 Mar 18 2014 codecomment.pyo
-rw-r--r-- 1 root root 18084 Nov 13 2012 docinfo.gedit-plugin
drwxr-xr-x 2 root root 4096 Jul 2 2013 externaltools
-rw-r--r-- 1 root root 9243 Nov 13 2012 externaltools.gedit-plugin
-rw-r--r-- 1 root root 8579 Nov 13 2012 filebrowser.gedit-plugin
-rw-r--r-- 1 root root 179 Apr 17 2014 gpdefs.py
-rw-r--r-- 1 root root 317 Apr 17 2014 gpdefs.pyc
-rw-r--r-- 1 root root 315 Apr 17 2014 gpdefs.pyo
-rw-r--r-- 1 root root 9654 Nov 13 2012 indent.gedit-plugin
-rwxr-xr-x 1 root root 18936 Nov 13 2012 libchangecase.so
-rwxr-xr-x 1 root root 19032 Nov 13 2012 libdocinfo.so
-rwxr-xr-x 1 root root 170256 Nov 13 2012 libfilebrowser.so
-rwxr-xr-x 1 root root 14816 Nov 13 2012 libindent.so
-rwxr-xr-x 1 root root 27320 Nov 13 2012 libmodelines.so
-rwxr-xr-x 1 root root 23248 Nov 13 2012 libsort.so
-rwxr-xr-x 1 root root 82168 Nov 13 2012 libspell.so
-rwxr-xr-x 1 root root 36104 Nov 13 2012 libtaglist.so
-rwxr-xr-x 1 root root 35840 Nov 13 2012 libtime.so
-rw-r--r-- 1 root root 9177 Nov 13 2012 modelines.gedit-plugin
drwxr-xr-x 2 root root 4096 Jul 2 2013 pythonconsole
-rw-r--r-- 1 root root 8602 Nov 13 2012 pythonconsole.gedit-plugin
drwxr-xr-x 2 root root 4096 Jul 2 2013 quickopen
-rw-r--r-- 1 root root 5719 Nov 13 2012 quickopen.gedit-plugin
drwxr-xr-x 2 root root 4096 Mar 20 2015 sessionsaver
-rw-r--r-- 1 root root 6035 Mar 20 2015 sessionsaver.gedit-plugin
drwxr-xr-x 2 root root 4096 Jul 2 2013 snippets
-rw-r--r-- 1 root root 8805 Nov 13 2012 snippets.gedit-plugin
-rw-r--r-- 1 root root 9235 Nov 13 2012 sort.gedit-plugin
-rw-r--r-- 1 root root 9416 Nov 13 2012 spell.gedit-plugin
-rw-r--r-- 1 root root 16794 Nov 13 2012 taglist.gedit-plugin
-rw-r--r-- 1 root root 11861 Nov 13 2012 time.gedit-plugin
And since all these plugins seem to be working without any issuse I guess the configure script was wrong about the missing requirements as I had thought...
Thanks anyways....!

CentOS and fontconfig: Cannot load default config file

I'm getting following error when using imagick:
Fontconfig error: Cannot load default config file
My script is working but i would like to fix this (is filling up log file).
OS is:
# cat /etc/redhat-release
CentOS release 5.10 (Final)
I was looking trough internet little bit and this is causing problem:
access("/etc/fonts/fonts.conf", R_OK) = -1 ENOENT (No such file or directory)
Folder exists:
# ls /etc/fonts/ -all
total 64
drwxr-xr-x 4 root root 4096 Jul 9 2010 ./
drwxr-xr-x 86 root root 12288 Jan 13 00:48 ../
drwxr-xr-x 2 root root 4096 Jan 3 2012 conf.avail/
drwxr-xr-x 2 root root 4096 Apr 14 2013 conf.d/
-rw-r--r-- 1 root root 5239 Jan 12 2008 fonts.conf
-rw-r--r-- 1 root root 6907 Jan 12 2008 fonts.dtd
But i see only this folder via root account, other account under with script is run doesn't see this folder. Permissions looks fine for me, but not so experienced with linux.
Account under with script is run is created with WHM.
Please help :)
I manage to solve my problem. chroot was making trouble.
I need to:
log with root account
find jailed environment of account on with i run script (in my case /home/virtfs/[username])
to create folder where i will mount real stuff mkdir /home/virtfs/[username]/etc/fonts
to mount /etc/fonts to this folder: mount --bind /etc/fonts /home/virtfs/[username]/etc/fonts
Posting an answer for CentOS 7 in 2021:
yum install fontconfig
More info here:
https://centos.pkgs.org/7/centos-x86_64/fontconfig-2.13.0-4.3.el7.x86_64.rpm.html

Resources