Motd wrong

  • Platform information:
    • Hardware: raspberry pi 3B
    • OS: openhabian installed from 1.7.1

Once in a while, openhabian-config decides to show motd when started. As you can see below, the text shown (no. of updates available) is wrong. I don’t think, this is intended, is it!?!

##   Updates = 11 apt updates available.
##  Sessions = 1 session(s)
## Processes = 114 running processes of 32768 maximum processes
###############################################################################

                          _   _     _     ____   _
  ___   ___   ___   ___  | | | |   / \   | __ ) (_)  ____   ___
 / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \ | | / _  \ / _ \
| (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )| || (_) || | | |
 \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/ |_| \__|_||_| | |
      |_|                  openHAB 3.2.0 - Release Build

Looking for a place to get started? Check out 'sudo openhabian-config' and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://openHABianPi:8080
To interact with openHAB on the command line, execute: 'openhab-cli --help'

openhabian@openHABianPi:~ $ sudo openhabian-config
[sudo] Passwort für openhabian:
2022-03-29_11:30:23_CEST [openHABian] Checking for root privileges... OK
2022-03-29_11:30:23_CEST [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
2022-03-29_11:30:23_CEST [openHABian] openHABian configuration tool version: [openHAB3]{2022-02-19T21:38:57+01:00}(9af1d52)
2022-03-29_11:30:23_CEST [openHABian] Checking for changes in origin branch openHAB3... OK
2022-03-29_11:30:24_CEST [openHABian] Switching to branch openHAB3... OK
2022-03-29_11:30:24_CEST [openHABian] Adding slightly tuned bash configuration files to system... OK
2022-03-29_11:30:27_CEST [openHABian] Updating Linux package information... OK
2022-03-29_11:30:31_CEST [openHABian] Updating repositories and upgrading installed packages...
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
Paketaktualisierung (Upgrade) wird berechnet… Fertig
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.

FireMotD is a third party application. If there is a problem with it that problem will need to be solved through their project.

But I believe that FireMotD only runs apt periodically to find the number of available updates. It is not unusual for it to list a different set than what is actually available.

Thanks for your reply, Rich! I know a bit about firemotd. But i do not believe this is causing the “fake news” above. The news had been created a while (days) before the login it is shown. An i think this to be an openhabian problem. Or maybe it’s intended (or just accepted), you never know: some days ago there were 11 apt updates available.

What is the timestamp and the content of file /usr/share/firemotd/data/FireMotD.json ?
That file is generated by scheduled runs of FireMotd.
bash_profile entries just display its entries + more data.

I logged in and had a look to answer your question - which isn’t helpfull at all:

$ ls -l /usr/share/firemotd/data/FireMotD.json
-rwxrw-rw- 1 root root 3086 29. Mär 21:29 /usr/share/firemotd/data/FireMotD.json

3 minutes later fpr reference - sorry about the delay:

$ date
Di 29. Mär 21:32:10 CEST 2022

I forgot to mention, that the problem above does not occur on every login when the message is shown. So it’s wrong every now and then from every now and then it is shown at all.

Although mine is dated at 21:14 CEST.
It contains an entry besides others:

 "Updates": {
    "Generated": "@cron",
    "Type": "apt",
    "Count": "15",
    "LastRun": "2022-03-29 05:13:02,118"
  },

That shows how many updates are available and that it was calculated at 05:13 by scheduled cron.

That’s fine. But nothing worth for the user i think.

Sorry, then I must have misunderstood your initial post.

Oh well, that’s my fault: i think i understand, what happens. I do not understand why / what is it good for.

Some able an willing to provide info about old info shown at times when logging in to openhabian (current version, updated from 1.7.1, for openHAB 3.2)? If so: can you please stop this or tell us what sense this makes?

###############################################################################
###############  openHABianPi  ################################################
###############################################################################
##        Ip = 172.16.172.64
##   Release = Raspbian GNU/Linux 11 (bullseye)
##    Kernel = Linux 5.15.32-v7+
##  Platform = Raspberry Pi 3 Model B Plus Rev 1.3
##    Uptime = 3 day(s). 2:20:21
## CPU Usage = 0.76% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.17, 5m: 0.04, 15m: 0.01
##    Memory = Free: 0.10GB (11%), Used: 0.84GB (89%), Total: 0.95GB
##      Swap = Free: 0.09GB (99%), Used: 0.00GB (1%), Total: 0.09GB
##      Root = Free: 22.95GB (83%), Used: 4.56GB (17%), Total: 28.71GB
##   Updates = 5 apt updates available.
##  Sessions = 1 session(s)
## Processes = 119 running processes of 32768 maximum processes
###############################################################################

                          _   _     _     ____   _
  ___   ___   ___   ___  | | | |   / \   | __ ) (_)  ____   ___
 / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \ | | / _  \ / _ \
| (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )| || (_) || | | |
 \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/ |_| \__|_||_| | |
      |_|                  openHAB 3.2.0 - Release Build

Looking for a place to get started? Check out 'sudo openhabian-config' and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://openHABianPi:8080
To interact with openHAB on the command line, execute: 'openhab-cli --help'

[10:54:33] openhabian@openHABianPi:~# sudo openhabian-config
[sudo] Passwort für openhabian:
2022-04-10_10:54:36_CEST [openHABian] Checking for root privileges... OK
2022-04-10_10:54:36_CEST [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
2022-04-10_10:54:36_CEST [openHABian] openHABian configuration tool version: [openHAB3]{2022-03-27T13:22:11-06:00}(1305ac7)
2022-04-10_10:54:36_CEST [openHABian] Checking for changes in origin branch openHAB3... OK
2022-04-10_10:54:37_CEST [openHABian] Switching to branch openHAB3... OK
2022-04-10_10:54:38_CEST [openHABian] Adding slightly tuned bash configuration files to system... OK
2022-04-10_10:54:40_CEST [openHABian] Updating Linux package information... OK
2022-04-10_10:54:44_CEST [openHABian] Updating repositories and upgrading installed packages...
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
Paketaktualisierung (Upgrade) wird berechnet… Fertig
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
2022-04-10_10:54:55_CEST [openHABian] Updating Linux package information... OK
2022-04-10_10:54:55_CEST [openHABian] Updating repositories and upgrading installed packages...
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
Paketaktualisierung (Upgrade) wird berechnet… Fertig
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.

I was and I am willing to help…
Sorry, to write and I am repeating myself. Could you please have a look to /usr/share/firemotd/data/FireMotD.json . As far as I understand the firemotd script that file contains parts of the information that is being parsed and shown on your screen. That file is updated during nights and not during login times. I am asking you to check that files content to proof my theory. It either will confirm it then the number of updates and a timestamp when this information was collected is available. Based on that one we can continue.

Sorry, i think i did not read your previous posts attentively.

  "Updates": {
    "Generated": "@cron",
    "Type": "apt",
    "Count": "0",
    "LastRun": "2022-04-10 05:56:28,170"

ok. That indeed looks a bit strange.
As far as I read this the information in the json file is created at 05:56 in the morning of 2022-04-10.
While your log in took place at around 10:54.
Although you stated that your openhabian version is 1.7.1 could you give me a favor and check for the exact openhabian-config version ? It is displayed in the about menu as well in the main menu header and it looks like:

openHABian Configuration Tool — [openHAB3]{2022-03-27T13:22:11-06:00}(1305ac7)

openHABian Configuration Tool — [openHAB3]{2022-03-27T13:22:11-06:00}(1305ac7)

And this is not a copy from your post.

More Info: when i logged in after running 02 (Upgrade System), “0 apt updates available” showed up correctly.

Maybe the nightly run should create/update ~openhabian/.firemotd-cache, see ~openhabian/.bash_profile. Seems like half implemented workaround for FireMotD taking to much time.

What i do not understand up to now is, why the FireMotD generated text is not shown on every login.

I did not check if that action is CPU intensive and how long it takes. What about running it more often ?

on my system it takes about 3 … 4 seconds. If you can wait the file can be created during login time.

what do you mean ? sometimes the whole content is not shown ?

Are you interested in all these values ? What about checking if e.g. the updates can be removed from being displayed - would that be sufficient or would you like to see it ?
As ( not optimal ) workaround you can create a cronjob for user openhabian that creates the cache during morning hours ( as you suggested ).

Just to make shure: we are talking about unmodified openhabian. And i won’t go an change it. I think it does not make sense to show a status form “last night” when logging in in the evening and therefore expect this to be changed in openhabian - but maybe i’m wrong.

Yes. F.e. it happend when i logged in right now.

Using username "openhabian".
Linux openHABianPi 5.15.32-v7+ #1538 SMP Thu Mar 31 19:38:48 BST 2022 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Apr 16 13:13:04 2022 from 172.16.172.51


                          _   _     _     ____   _
  ___   ___   ___   ___  | | | |   / \   | __ ) (_)  ____   ___
 / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \ | | / _  \ / _ \
| (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )| || (_) || | | |
 \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/ |_| \__|_||_| | |
      |_|                  openHAB 3.2.0 - Release Build

Looking for a place to get started? Check out 'sudo openhabian-config' and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://openHABianPi:8080
To interact with openHAB on the command line, execute: 'openhab-cli --help'

openhabian@openHABianPi:~ $ ls -al .firemotd-cache
-rw-r--r-- 1 openhabian openhab 0 16. Apr 13:24 .firemotd-cache
openhabian@openHABianPi:~ $ ls -al .firemotd-cache
-rw-r--r-- 1 openhabian openhab 7592 16. Apr 13:24 .firemotd-cache
openhabian@openHABianPi:~ $

I’m not going to investigate this any more.

ok.