I have an embedded computer system running Linux. Its SoC is an Intel E3845. I was able to find the datasheet.
If the power blinks, the device just reboots. What I want to detect is if the system experienced a power failure that caused it to reboot. There exists on page 4325 this register documentation
This appears to a register of a PCI device. Of interest is bit 16. The documentation seems to indicate this bit is set whenever the machine is running (S0 state) and the system power goes too low.
Running lspci indicates that the system management bus is at this address, along with a power control unit
00:1f.0 ISA bridge: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Power Control Unit (rev 11)
00:1f.3 SMBus: Intel Corporation Atom Processor E3800 Series SMBus Controller (rev 11)
So I think I need to read one of these registers from /sys/bus/pci/devices.
# ls -l /sys/bus/pci/devices/0000\:00\:1f.0/resource*
-r--r--r-- 1 root root 4096 Nov 8 22:53 /sys/bus/pci/devices/0000:00:1f.0/resource
# ls -l /sys/bus/pci/devices/0000\:00\:1f.3/resource*
-r--r--r-- 1 root root 4096 Nov 8 22:53 /sys/bus/pci/devices/0000:00:1f.3/resource
-rw------- 1 root root 32 Nov 8 22:53 /sys/bus/pci/devices/0000:00:1f.3/resource0
-rw------- 1 root root 32 Nov 8 22:53 /sys/bus/pci/devices/0000:00:1f.3/resource4
Actually memory mapping one of these files & reading it should be simple. My questions are
Am I looking in the right place in /sys?
Which file do I need to read? The documentation is indicates an offset of [PMC_BASE_ADDRESS + 20h]. So do I read offset 32 bytes into one of these files?
Can I be sure that the boot loader or some other device is not clearing this bit by writing a 1 into this register? Is that a normal practice?
Observing that some kernel modules are not being loaded in the latest kernel 5.15.34-v7.
So I have built a core-image-base from meta-raspberrypi (0135a02) and while trying access the camera using Picamera got some errors. The errors mainly complain about mmal drivers not present.
root#raspberrypi3:~# python3
Python 3.10.4 (main, Mar 23 2022, 20:25:24) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from picamera import PiCamera
>>> camera = PiCamera()
mmal: mmal_vc_shm_init: could not initialize vc shared memory service
mmal: mmal_vc_component_create: failed to initialise shm for 'vc.camera_info' (7:EIO)
mmal: mmal_component_create_core: could not create component 'vc.camera_info' (7)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.10/site-packages/picamera/camera.py", line 408, in __init__
self._init_revision(options)
File "/usr/lib/python3.10/site-packages/picamera/camera.py", line 480, in _init_revision
with mo.MMALCameraInfo() as camera_info:
File "/usr/lib/python3.10/site-packages/picamera/mmalobj.py", line 2425, in __init__
super(MMALCameraInfo, self).__init__()
File "/usr/lib/python3.10/site-packages/picamera/mmalobj.py", line 696, in __init__
mmal_check(
File "/usr/lib/python3.10/site-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.camera_info': I/O error
>>>
>>>
root#raspberrypi3:~#
After digging through my system found an older build (don't know why I didn't delete it but thankfully it gave some insight into the issue), I tried booting that image and everything seems to be working fine.
So I checked out to the commit which the older build was using (63a3d8cb17c5d1affe8f2848f45fcc6a706f9412), and the camera worked fine(though I had to make few changes, which are not significant for this issue). While analyzing the bootlogs found that the latest build (0135a02) doesn't load all the drivers.
Also I have observed that the kernel module are compressed in the 5.15.34 kernel, eg: root#raspberrypi3:~# ls /lib/modules/5.15.34-v7/kernel/drivers/usb/gadget/libcomposite.ko.xz and while trying load the modules using modprobe getting the following error:
root#raspberrypi3:~# ls /lib/modules/5.15.34-v7/kernel/drivers/usb/gadget/legacy/
g_acm_ms.ko.xz g_cdc.ko.xz g_hid.ko.xz g_midi.ko.xz g_printer.ko.xz g_webcam.ko.xz gadgetfs.ko.xz
g_audio.ko.xz g_ether.ko.xz g_mass_storage.ko.xz g_multi.ko.xz g_serial.ko.xz g_zero.ko.xz
root#raspberrypi3:~# modprobe gadgetfs
modprobe: FATAL: Module gadgetfs not found in directory /lib/modules/5.15.34-v7
My question is what and where the changes have happened to the kernel between 63a3d8cb17c5d1affe8f2848f45fcc6a706f9412 (5.10) and 0135a02 (5.15) , so that I can look into and adapt the changes required ?
Note: All the commit hashes which are mentioned above are of meta-raspberrypi repo.
Logs
lsmod logs
5.15.34
root#raspberrypi3:~# lsmod
Module Size Used by
root#raspberrypi3:~#
5.10.81
root#raspberrypi3:~# lsmod
Module Size Used by
rfcomm 49152 2
cmac 16384 3
algif_hash 16384 1
nfc 86016 0
aes_arm_bs 24576 2
crypto_simd 16384 1 aes_arm_bs
cryptd 24576 2 crypto_simd
algif_skcipher 16384 1
af_alg 28672 6 algif_hash,algif_skcipher
bnep 20480 2
hci_uart 40960 1
btbcm 16384 1 hci_uart
bluetooth 421888 31 hci_uart,bnep,btbcm,rfcomm
ecdh_generic 16384 2 bluetooth
ecc 36864 1 ecdh_generic
ipv6 503808 26
brcmfmac 331776 0
brcmutil 24576 1 brcmfmac
sha256_generic 16384 0
bcm2835_v4l2 49152 0
cfg80211 782336 1 brcmfmac
bcm2835_codec 40960 0
bcm2835_isp 32768 0
v4l2_mem2mem 36864 1 bcm2835_codec
rfkill 32768 4 bluetooth,nfc,cfg80211
bcm2835_mmal_vchiq 36864 3 bcm2835_isp,bcm2835_codec,bcm2835_v4l2
videobuf2_dma_contig 20480 2 bcm2835_isp,bcm2835_codec
videobuf2_vmalloc 16384 1 bcm2835_v4l2
videobuf2_memops 16384 2 videobuf2_dma_contig,videobuf2_vmalloc
videobuf2_v4l2 32768 4 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem
videobuf2_common 61440 5 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
raspberrypi_hwmon 16384 0
videodev 253952 6 bcm2835_isp,bcm2835_codec,videobuf2_common,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
mc 45056 6 bcm2835_isp,bcm2835_codec,videobuf2_common,videodev,v4l2_mem2mem,videobuf2_v4l2
vc_sm_cma 32768 2 bcm2835_isp,bcm2835_mmal_vchiq
uio_pdrv_genirq 16384 0
uio 20480 1 uio_pdrv_genirq
fixed 16384 0
root#raspberrypi3:~#
Make sure you have kernel-modules installed:
IMAGE_INSTALL_append = " kernel-modules"
EDIT
The package that provides all kernel modules is kernel-modules, or each modules is within a separate package kernel-module-<module_name>. For meta-raspberrypi, they set kernel-modules as a package not essential for boot, means that if the package is not found, the board should boot normal:
meta-raspberrypi/conf/machine/include/rpi-base.inc
MACHINE_EXTRA_RRECOMMENDS += "kernel-modules udev-rules-rpi"
In previous meta-raspberrypi branches, it was a rpi image recipe rpi-basic-image.bb:
# Base this image on core-image-minimal
include recipes-core/images/core-image-minimal.bb
# Include modules in rootfs
IMAGE_INSTALL += " \
kernel-modules \
"
SPLASH = "psplash-raspberrypi"
IMAGE_FEATURES += "ssh-server-dropbear splash"
do_image:prepend() {
bb.warn("The image 'rpi-basic-image' is deprecated, please use 'core-image-base' instead")
}
So, the only thing needed for integrating the kernel modules is kernel-modules package, either by the image example, or try:
local.conf
MACHINE_EXTRA_RRECOMMENDS_remove = "kernel-modules"
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.
I'm trying to start a local mariadb server on my raspberry pi. I've changed the datadir to point to an external harddrive, and i've gotten that working previously (with other pi's).
however, now when i use this particular pi and type in
sudo service mariadb start
I get
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
When i check journalctl -xe i get
-- The unit mariadb.service has entered the 'failed' state with result 'exit-cod
Oct 07 09:08:25 BLUE systemd[1]: Failed to start MariaDB 10.3.15 database server
-- Subject: A start job for unit mariadb.service has failed
Pokiing around further I find that my ib_buffer_pool in the directory I've specified for this server seems maybe corrupted?
Typing in ls-l for this particlar datadir I get
ls: cannot access 'ib_buffer_pool': Bad message
total 110628
-rwxrwxrwx 1 pi pi 16384 Oct 7 08:34 aria_log.00000001
-rwxrwxrwx 1 pi pi 52 Oct 7 08:34 aria_log_control
-rwxrwxrwx 1 pi pi 0 Jul 1 06:34 debian-10.3.flag
-????????? ? ? ? ? ? ib_buffer_pool
-rwxrwxrwx 1 pi pi 12582912 Jul 9 13:38 ibdata1
-rwxrwxrwx 1 pi pi 50331648 Jul 9 13:38 ib_logfile0
-rwxrwxrwx 1 pi pi 50331648 Jul 1 06:34 ib_logfile1
-rwxrwxrwx 1 pi pi 0 Jul 1 06:34 multi-master.info
drwxrwxrwx 2 pi pi 4096 Jul 2 10:13 mysql
-rwxrwxrwx 1 pi pi 16 Jul 1 06:34 mysql_upgrade_info
drwxrwxrwx 2 pi pi 4096 Jul 2 10:13 performance_schema
drwxrwxrwx 2 pi pi 4096 Jul 2 12:49 test_db
THose question marks freak me out...tried deleting the ib_buffer_pool and just get this "Bad Message" thing over and over.
To get this setup working on my other pi's I had to change permissions with sudo chmod -R a+rwX directory/ and i did that for THIS pi also, thought maybe this was a permissions issue but I checked and the containing folders are all rwxrwxrwx also...
does anyone know what might be going on and how to resolve this so I can start a local mariadb server on this pi?
N.B. I do have a mariadb server successfully running on ANOTHER pi which THIS f-ed up pi is connected to via ethernet and I can connect to that OTHER pi's mariadb server with THIS f-ed up pi to manipulate data and so on, no problems. BUT I wanted to run a local mariadb server on THIS f-ed up pi ALSO (so it could manage a database which would be located on ITS respective harddrive)...is this kind of goal not possible and/or the cause of why my ib_buffer_pool has ??? ???? ???? and I'm getting exit-code when i try to start this local mariadb server? FYI
Much appreciated
okay just in case anyone else stumbles across this...
didn't fix it properly, BUT
it was the ib_buffer_pool file being corrupted that was the problem.
To make it work (but i don't think it's a good long term fix)
I just renamed the directory the ib_buffer_pool file was in to "directorynameCORRUPTED"
then created a new directory called "directoryname"
and copied all of the files from "directorynameCORRUPTED" other than ib_buffer_pool into this "directoryname" directory
And it worked. So it's a workaround...but still wanna know what to do about those ????? corrupted files why did it show up? troubling....
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