Jump to content

SOLVED - How to disable armbian-ram-logging correctly?


Recommended Posts

Posted

System Information:

 - Cubietruck with Ubuntu 16.04

 - armbian-config 5.62

 - armbian-firmware 5.60

 - armbian-tools-xenial 5.60

 

Hallo since last few updated I've noticed that I have no logs... With some update armbian ram logging was enabled and all logs moved to log.hdd folder, but not all of them are filled up after this operation.

I did disabled armbian-ram-loggin wia editing /etc/default/armbian-ramlog:

ENABLED=false

After this services was disabled, but no logs filled in a log folder... Also no log rotation happens.

  Reveal hidden contents

 

Posted (edited)

Long story short, to disable arbain-ramlog:

1. Change in /etc/default/armbian-ramlog

ENABLED=false

2. Disable in cron root user truncate-logs by editing /etc/cron.d/armbian-truncate-logs (just comment the line) like this:

#  0,15,30,45 * * * * root /usr/lib/armbian/armbian-truncate-logs

3. Delete /etc/cron.daily/armbian-ram-logging or comment it like:

#!/bin/sh
#/usr/lib/armbian/armbian-ramlog write >/dev/null 2>&1

4. Restart Server. Because armbian-zram is connected to ramlog service and will read config of it. It will not create compressed in-memory folder for logs. Without restart it will not be used properly and you will loose your logs.

Edited by gas_85
Added Step 3, as sxf2000 mentioned.
Posted
  On 10/16/2018 at 11:42 AM, gas_85 said:

Long story short,

Expand  

 

Long story short - it's a chained series of events that gets one to here...

 

in systemd... (nice that these are in systemd - I have no skin in the whole systemd discussion other than to recognize that it's there)

 

armbian-ramlog.service

armbian-zram-config.service

 

One can disable them easily enough by just doing systemctl... 

 

the crontab tip is good...

 

To get zram back - install zram-config, and for the log stuff once the ramlog is disable (along with the crontab entry), look at logrotate...

Posted
  On 10/16/2018 at 11:42 AM, gas_85 said:

Disable in cron root user truncate-logs by editing /etc/cron.d/armbian-truncate-logs (just comment the line)

Expand  

 

Take a look at /etc/cron.daily/armbian-ram-logging - might want to comment that line as well...

 

In any event - the services and crontab entries for ramlogging at well intentioned to keep pressure off the flash, so step carefully...

Posted

I read zram and log2ram config and source and recognized that zram will evaluate config of log2ram, so if I disable it in config - everything works.

Only issue - truncate operation is still in cron and script does not look into config by executing... This bring must be disabled in cron.

 

Yes, I forgot to say about this... daily script was commented:D

# cat /etc/cron.daily/armbian-ram-logging
#!/bin/sh
#/usr/lib/armbian/armbian-ramlog write >/dev/null 2>&1

Thanks a lot!

Posted
  On 11/2/2018 at 8:33 AM, gas_85 said:

Only issue - truncate operation is still in cron and script does not look into config by executing... This bring must be disabled in cron.

Expand  


This should fix this issue.

Posted

Good day. If I understand correctly, will this disable logging in / var / log? I understand correctly ?
If yes, then I would like to clarify. I use Orange PI PC2, transferred the entire system to usb hdd, only the boot area remained on the SD card. When log2ram is disabled, logs will be written to my hdd under the / var / log directory? I understand correctly ?

Posted
  On 6/25/2019 at 12:03 PM, Igor said:


Да.

Expand  

Thanks for the answer. I am quite new to this. Forgive one more clarification, with this disconnection will the recording go straight to my hdd or will the recording go through the SD card and then to hdd? I ask this because I wanted to extend the life of the SD card.

Posted (edited)

September 2019 : despite this discussion, a recent dowload of armbian has still the same default. Logrotate does not work in /var/log.hdd

The reason is fairly simple, even if finding this reason was less simple.

 

Armbian added the use or rsync to copy the files. Good idea, but unfortunately bad configuration : rsync deletes all unknown files in /var/log.hdd, which results in deletion of all rotated files.

 

 

The reason is the rsync command wich includes the  "--delete" parameter, in /usr/lib/armbian/armbian-ramlog, line 50 in syncToDisk function.

This will delete in /var/log.hdd/ all file not present in /var/log/. So, all rotated files will be deleted.

rsync -aXWv --delete --exclude "lost+found" --exclude armbian-ramlog.log --links $HDD_LOG $RAM_LOG

Just delete the "--delete" parameter, and your log files will remain.

A less important issue will remain, which will be discussed later.

 

Edited by Dysmas
Give the right solution to the problem
Posted
  On 9/26/2019 at 4:55 PM, Igor said:

Since when discussion fixes bugs?

Expand  

If I try to file an issue on Github, there is a message indicating :

  Quote

Issues with provided images should go to the Armbian forum.

Expand  

 

Now that I have a working solution which covers all aspects of the problem, I will file an issue on Github, after one week of testing. ram-log is a good idea, but as is, it is not finished.

 

 

 

Posted

In a current organisation, which is not perfect, we discuss solutions either here on forum or directly at already submitted pull request. But if bug is mentioned on forum, there is no warranty it will be noticed, addressed or fixed. Ratio between bugs and resources is extreme. Extreme because people expect few people can fix Linux kernel :) or any bug that is found in packages. Well, this bug is accidentally and amazingly a part of our work.

Posted

Thanks Dysmas, removing one of the 2 --delete solved the problems indeed in /var/log.hdd/syslog, I now see the syslog.1 2.gz etc on a daily basis.

 

Problem I still have , is that the log/syslog is not emptied, but keeps growing.

 

Any ideas on that ?

 

Posted
  On 10/1/2019 at 1:00 PM, Set3 said:

Problem I still have , is that the log/syslog is not emptied, but keeps growing.

Expand  

Yes, I solved this problem also, I will post the solution quickly on Github, and I will add the link here.

Posted

I posted the full solution here   :  https://github.com/armbian/build/issues/1582

The basic idea is :

 

Once the "--delete" issue is corrected, log.hdd is better, but there is still an issue : the rotated files overlap, because the effect of the rotation is not mirrored to /var/log. I have a log rotated daily, but each rotated file contains 3 or 4 days.
This can be solved easily by the following process :

  • ramlog write (to update log.hdd before rotation)
  • logrotate
  • ramlog postrotate (which will copy to /var/log the modified files of /ram/log.hdd).

 

See the code on Github, link above.

Posted

rsync is preferred when it comes to reduce traffic to sd card and that is what this was all about anyway right ?

 

I tried rsync -aXWv /var/log.hdd/* /var/test/ --exclude *.[0-9] --exclude *.[0-9].gz

 

looks good to me, or am I missing something ? is the var/log/syslog updated inbetween so that rsync sees /var/log/syslog as a newer file than the just empty /var/log.hdd/syslog ?

 

But I now also don't understand is that in the middle of the day, I can overwrite syslog with the version of last night, and  I cant see updates when I use logger. Hmm strange.

Probably needs a log restart.

 

I see discussions here on disabling ramlog, where the idea is very good. That is a shame.

The current solution is not easy to understand for the end user. And it is just about something as simple as logging :-)

 

Perhaps a stupid idea while we are might be redesigning anyway ?  why don't we

- do a standard logrotate in /var/log as designed, described and same as on other ( eg x86) installations

- probably do a kind of custom rotate on /var/log.hdd to move .1 to get .2.gz etc

- "rsync without --delete" to /var/log.hdd which then holds latest files and previous rotated .1

- remove all rotated files from /var/log to use as little RAM as possible

- do a cleanup of old compressed rotated files in /var/log.hdd according to logrorate settings ?

 

or just leave the rotate files on .var.log, makes it more simple, have users decide to change logrotate as per manual

 

Yes there may be complications, but that is for experts to point out.

 

To me looks less error prone, as log-rotate on /var/log then works as designed and described in all manuals.

And to avoid confusion, put a small text file with explanation /var/log/Where_are_the_rotated_files.txt  for the end user (without being rotated out :-) , explaining on how it works and where we can find the rotated files and why.

Including the 75% mechanism explained.

As end user I would be happy to see that.

 

Logging is  not a sexy subject, but I have a few OPiZero (256MB) with docker apps and memory is a challenge so having logs running up to 50MB is a lot. (although I know about the 75% monitoring which does work well, and I can change that to less % etc etc)

 

 

 

 

Posted

 

  On 10/4/2019 at 1:52 PM, Set3 said:

But I now also don't understand is that in the middle of the day, I can overwrite syslog with the version of last night, and  I cant see updates when I use logger. Hmm strange.

Probably needs a log restart.

Expand  

 

Sorry, I forgot to say why rync is not good for this operation. The problem is that it creates new files and this is a problem for several programs which probably do not use the filename but uuid or something like that. My experience was the same as yours, after rsync, for most programs, log was no longer working, the file remained empty and restart would not be a good solution. That's why I used cat source > dest, because this process overwrites the content, but do not create a new file. And it works like a charm.

Posted

By the way, while searching for this problem,  I think I read somewhere that there is a command that tells syslog and other apps to restart logs using new logs, cant remember where/which command

Is that not postrotate / sharescript?

Posted

until redesigned I will try your solution on a few OPiZeros, see if it lasts :-)

So do we need another request for a possible redesign or a discussion on a more worked out plan here first ?

Posted

One question Dysmas on implementation, I don't see in your request  :

 

"On a working system, it is better to copy this file from /lib/systemd/system to /etc/systemd/system to prevent possible overwriting during an update."


So somehow magically /etc/systemd/system overrules /lib/systemd/system ? or do I need to change something else ?

 

Posted

In the request you wrote logrotate.service ? I dont have that in ubuntu;18.04.3;lts 5.90 on OPiZ

You mean armbian-ramlog.service ?

 

now has

[Service]
Type=oneshot
ExecStart=/usr/lib/armbian/armbian-ramlog start
ExecStop=/usr/lib/armbian/armbian-ramlog stop
ExecReload=/usr/lib/armbian/armbian-ramlog write
RemainAfterExit=yes
TimeoutStartSec=30sec

Posted
  On 10/4/2019 at 2:40 PM, Set3 said:

So somehow magically /etc/systemd/system overrules /lib/systemd/system ? or do I need to change something else ?

Expand  

Nothing to do, systemd is designed like that.

Posted
  On 10/4/2019 at 3:09 PM, Set3 said:

In the request you wrote logrotate.service ? I dont have that in ubuntu;18.04.3;lts 5.90 on OPiZ

You mean armbian-ramlog.service ?

Expand  

No, I didn't modify armbian-ramlog.service.

The only thing I can say is that I have in Armbian (September 2019)  /lib/systemd/system/logrotate.service (in the same directory as armbian-ramlog).
But I don't have the Ubuntu version, I use the Debian Buster Armbian Linux 4.4.184.

 

Initial content of [service] in this file is only two lines :

 

[Service]

Type=oneshot

ExecStart=/usr/sbin/logrotate /etc/logrotate.conf

 

Posted

This issue really hurts.

The thing is that I'm using Orange Pi One Plus with Armbian Bionic (mainline based kernel 5.1.y) with all latest updates. I know it's in Testing mode currently, but anyway. 

I'm using Orange Pi with PiHole installed to filter ads in my home network. At times it reboots(why it reboots it's a separate topic), it start moving the files into persistant storage and with probability 20-50% fails to start.

The flow is:

Starting Armbian memory supported logging...

Then it tries to move logs to a storage for 4.5 min and fails with:

[FAILED] Failed to start Armbian memory supported logging.

See 'systemctl status armbian-ramlog.service' for details.

And then stuck for 3 more minutes resulting into:

[FAILED] Failed to start Flush Journal to Persistant Storage.

See 'systemctl status systemd-journal-flush.service' for details.

Starting Create Volatile Files and Directories.

 

And at this point it deadly stucks leaving my devices in the network w/o network access. I've tried all the hints provided above by Dysmas except modifying logrotate.service (was not able to find it).

 

TBH, having all these optimizations for the SD life is good, but it's not smth I'd like to have where system dies during its start. I've bought Opi One Plus in honor to change my Opi One that served same functionality of blocking ads via PiHole. The latter one (Opi One) was working for months w/o having any issue from stability stand point. Opi One Plus now stucks each each 2-4 hours disconnecting me from the internet.

Posted

Hi, Alex,

what I suggested will not help you, it is a different problem. Perhaps the good way for you is to follow the directions of gas_85 and disable this feature, because debugging this without having a Pi One will be difficult.

Nevertheless could you follow the recommendation of the message and type the command :

sudo systemctl status armbian-ramlog.service

and give us the result of this command. It will help us to understand what is happening.

Posted

Dysmas, thanks for your reply.

Not sure if would help... but here is output

root@orangepioneplus:~# sudo systemctl status armbian-ramlog.service
* armbian-ramlog.service - Armbian memory supported logging
   Loaded: loaded (/lib/systemd/system/armbian-ramlog.service; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2019-10-07 19:23:33 +03; 3h 26min ago
  Process: 711 ExecStart=/usr/lib/armbian/armbian-ramlog start (code=exited, status=0/SUCCESS)
 Main PID: 711 (code=exited, status=0/SUCCESS)

Oct 07 19:23:32 orangepioneplus armbian-ramlog[711]: lighttpd/access.log
Oct 07 19:23:32 orangepioneplus armbian-ramlog[711]: lighttpd/error.log
Oct 07 19:23:32 orangepioneplus armbian-ramlog[711]: ntpstats/
Oct 07 19:23:32 orangepioneplus armbian-ramlog[711]: pihole/
Oct 07 19:23:32 orangepioneplus armbian-ramlog[711]: sysstat/
Oct 07 19:23:32 orangepioneplus armbian-ramlog[711]: unattended-upgrades/
Oct 07 19:23:32 orangepioneplus armbian-ramlog[711]: unattended-upgrades/unattended-upgrades-shutdow
Oct 07 19:23:32 orangepioneplus armbian-ramlog[711]: sent 2,809,265 bytes  received 473 bytes  5,619
Oct 07 19:23:32 orangepioneplus armbian-ramlog[711]: total size is 2,806,659  speedup is 1.00
Oct 07 19:23:33 orangepioneplus systemd[1]: Started Armbian memory supported logging.

I can't provide an ouput when it fails to start as the issue happens during device boot, and it's not responsive until I do a power reset.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines