I just recently noticed that ‘dmesg’ command is not working at all, but results in segfault:
$ dmesg
Segmentation fault
I’m using rpi 2b with osmc installed
$ uname -a
Linux osmc 4.19.122-2-osmc #1 SMP PREEMPT Sat Jul 4 02:39:56 UTC 2020 armv7l GNU/Linux
osmc@osmc:~$ grep VERSION_ID /etc/os-release
VERSION_ID=“2020.11-1”
I did apt-get update/dist-upgrade recently and tried it again today and there are no new packages to install/upgrade.
I’m pretty sure it was working before…
What could be causing this and how can I debug it further?
Thanks!
To get a better understanding of the problem you are experiencing we need more information from you. The best way to get this information is for you to upload logs that demonstrate your problem. You can learn more about how to submit a useful support request here.
Depending on the used skin you have to set the settings-level to standard or higher, in summary:
-
enable debug logging at settings->system->logging
-
reboot the OSMC device twice(!)
-
reproduce the issue
-
upload the log set (all configs and logs!) either using the Log Uploader
method within the My OSMC menu in the GUI or the ssh
method invoking command grab-logs -A
-
publish the provided URL from the log set upload, here
Thanks for your understanding. We hope that we can help you get up and running again shortly.
OSMC skin screenshot:
The problem seems to be in damaged /bin/dmesg file or something along those lines…
Solved it by repairing util-linux package:
# fist install apt-file if not already installed
$ sudo apt install apt-file
$ sudo apt-file update
$ apt-file search /bin/dmesg
util-linux: /bin/dmesg
# reinstall util-linux
$ sudo apt-get install --reinstall util-linux
now it works:
$ dmesg --version
dmesg from util-linux 2.33.1
Your SD card is likely corrupted.
Yes, those are my thoughts exactly 
So let’s me try to fix it… Find all corrupt system files and reinstall impacted packages…
Following useful instructions from here:
# 1) first remove old unused packages
$ sudo apt autoremove
# 2) install debsums utility:
$ sudo apt-get install debsums
# 3) log bad files
$ sudo debsums -c 2> badfileslist.txt
# 4) examine log and see if there are errors like: "debsums: invalid line (72) in md5sums for libwacom-common: 261f03$5af35edda0c6e6ee554af436a usr/share/libwacom/intuo<F3>-12x12.<F4>ablet"
# identify package with wrong md5sums line and manually fix this one first
$ sudo apt-get install --reinstall libwacom-common
# 5) log bad files again
$ sudo debsums -c 2> badfileslist2.txt
# now we should have only "changed files" reported...
# 6) Get a list of packages with missing or modified files.
$ dpkg-query -S $(sudo debsums -c 2>&1 | sed -e "s/.*file \(.*\) (.*/\1/g") | cut -d: -f1 | sort -u
binutils-common
cpp-8
e2fsprogs
git
iproute2
libavahi-client3
libpython2.7-stdlib
mediacenter-skin-osmc
python-apt-common
rbp2-image-4.19.122-2-osmc
# 7) Use generated list to reinstall group of packages.
$ sudo apt-get install --reinstall $(dpkg-query -S $(sudo debsums -c 2>&1 | sed -e "s/.*file \(.*\) (.*/\1/g") | cut -d: -f1 | sort -u)
# 8) verify all is well - should no longer have any errors
$ sudo debsums -as
All looks well now - crossing my fingers 
Next - get a good SD card and clone installation (I’m too lazy to do a full reinstall
)
1 Like