Jump to content

[Invalid] - armbian-trucate-logs error


kollmos

Recommended Posts

After upgrading to Focal on hc1 I countinously receive cron mails with the following content:

 

/usr/lib/armbian/armbian-truncate-logs: 19: /etc/default/armbian-ramlog: Syntax error: "(" unexpected

 

Similar problem is reported here: https://forum.yunohost.org/t/continuously-receiving-email-about-armbian-log/16549

 

After checking the code, the problem seams to be, that nowerdays /etc/default/armbian-ramlog contains something like

# If USE_RSYNC is true, additional options may be specified for the rsync
# commands used to synchronize logs to disk from RAM (XTRA_RSYNC_TO) or from
# disk to RAM (XTRA_RSYNC_FROM).  These are bash arrays to make specifying
# multiple arguments easy even in the presence of whitespace.
XTRA_RSYNC_TO=(
  ## If you use log rotation programs that datestamp their logs (e.g., runit's
  ## svlogd or daemontools' multilog), deleting log files while synchronizing is
  ## likely a good idea.
  # --delete
)

 

When now /usr/lib/armbian/armbian-truncate-logs sources this file, this will always fail because the script is using `#!/bin/sh` which is actually (at least on my system) a link to dash.

 

To fix the problem, in armbian-truncate-logs the first line should be replaced with `#!/bin/bash` and the error disappears.

 

Would be great if this could be fixed.

 

Cheers

Link to comment
Share on other sites

Your issue report is not a valid bug report per the Armbian bug reporting instructions (https://www.armbian.com/bugs).  With limited resources the Armbian project is only able to spend time on issues where all the requested information has been provided and for only the boards/images/software that are supported.  Your report is invalid for one or more of the following reasons (non-exhaustive list):

 

  • it is for an unsupported board or image (CSC/EOS/WIP/edge)
  • it is for software that is not supported (such as userspace modules installed on top of the core operating system)
  • it has been logged in the wrong forum (for example requests for help that are not actual bug reports)
  • it lacks requested data (armbianmonitor output)
  • it could have been easily solved by a quick search and/or reading documentation

 

Please review what you have submitted and the bug logging instructions (https://www.armbian.com/bugs) and either add the required information or open a new topic in the correct forum (such as Common issues / peer to peer technical support or General chit chat)

Link to comment
Share on other sites

Hi Werner,

 

Understood.

Unfortunatly the bug reporting is asking a lot of questions and I need to provide the armbianmonitor ourput which is not required at all.

Please take the solution given as a hint to fix https://github.com/armbian/build/blob/master/packages/bsp/common/usr/lib/armbian/armbian-truncate-logs

 

I will mark this as solved because my solution given above works for me (and maybe others).

 

Cheers

Link to comment
Share on other sites

On 8/25/2021 at 6:15 PM, kollmos said:

which is not required at all.

 

Without providing logs, you are on your own - i highly suspect your install is broken in some way, but since there are no logs ... Please don't double post and make us additional expenses. We don't need to fix bugs over and over again, for each person individually.

Link to comment
Share on other sites

On 8/25/2021 at 1:05 AM, kollmos said:
 

When now /usr/lib/armbian/armbian-truncate-logs sources this file, this will always fail because the script is using `#!/bin/sh` which is actually (at least on my system) a link to dash.

 

To fix the problem, in armbian-truncate-logs the first line should be replaced with `#!/bin/bash` and the error disappears.

 

Would be great if this could be fixed.

 

Cheers

I noticed the same issue with fresh (today's) Armbian setup on Odroid HC2. Changing `#!/bin/sh` to `#!/bin/bash` seemed to help. Thanks @kollmos!

Interesting how much time was spent not on actually looking into the issue but resisting to and reasoning against.

 

Best regards

Link to comment
Share on other sites

2 hours ago, mack said:

not on actually looking into the issue but resisting to and reasoning against.

 

Solving bugs can eat a lot more time - you contribute nothing to - and require a lot more energy then casual chatting with forum newbies. We have prepared FAQ for your welcoming. Make friends, then ask for help. There are 1000 people before you asked extremely limited and expensive resources for something ... why your problem is more important ?

Link to comment
Share on other sites

On 8/25/2021 at 7:05 AM, kollmos said:
 

After upgrading to Focal on hc1 I countinously receive cron mails with the following content:

 

/usr/lib/armbian/armbian-truncate-logs: 19: /etc/default/armbian-ramlog: Syntax error: "(" unexpected

 

Similar problem is reported here: https://forum.yunohost.org/t/continuously-receiving-email-about-armbian-log/16549

 

After checking the code, the problem seams to be, that nowerdays /etc/default/armbian-ramlog contains something like

# If USE_RSYNC is true, additional options may be specified for the rsync
# commands used to synchronize logs to disk from RAM (XTRA_RSYNC_TO) or from
# disk to RAM (XTRA_RSYNC_FROM).  These are bash arrays to make specifying
# multiple arguments easy even in the presence of whitespace.
XTRA_RSYNC_TO=(
  ## If you use log rotation programs that datestamp their logs (e.g., runit's
  ## svlogd or daemontools' multilog), deleting log files while synchronizing is
  ## likely a good idea.
  # --delete
)

 

When now /usr/lib/armbian/armbian-truncate-logs sources this file, this will always fail because the script is using `#!/bin/sh` which is actually (at least on my system) a link to dash.

 

To fix the problem, in armbian-truncate-logs the first line should be replaced with `#!/bin/bash` and the error disappears.

 

Would be great if this could be fixed.

 

Cheers

Thanks for providing the fix and explaining the cause, kollmos :)

My device has been spamming me with emails about this and I am grateful to have it shut up now.

Link to comment
Share on other sites

Hi,

 

actually don't wanted to argue anymore about this but have to leave some comment.

I fully understand the feedback from Werner and actually many thanks to do the patch! Unfortunatly I don't have the capability to do all the tests with all the different setups (otherwise I would really like to do).

 

What I can provide is the clear view about the root cause of the issue (acutally I have some strong Linux background and I just wanted to share this here because I really appreciate the job you guys doing).

Hope this helps with merging the patch from Werner.

 

1. The issue depends on the shell used via symlink /bin/sh. In all my systems (even non armbian) this seams to be nowerdays dash instead of bash.

2. the change raising the issue (aka root cause) is the change done in /etc/default/armbian-ramlog using arrays (commit https://github.com/armbian/build/commit/2606d17ec7e8cc28c298bbac31549f3597253121#diff-2d82f72c778209a339df3f1d9b3b300c795161a8572719b7ee9e589ef5724dc9) introduced Jun 12 2021 so it's more a regression then the issue reported is a bug.

3. the change introduce leads to the general failure that running /usr/lib/armbian/armbian-truncate-logs with /bin/sh (so actuall dash) will always fail when trying to source the configuration file /etc/default/armbian-ramlog because dash cannot handle the arrays

4. Solution to this is (you can choose)

  • revert the change done from above (not using arrays in configuration) -> I assume there is a good reason not to revert so I was not proposing this.
  • change the link /bin/sh in general to /bin/bash -> seams to be not compatible with all the different debian/ubuntu releases so even bigger risk, so also not a good proposal
  • just change #!/bin/sh in armbian-truncate-logs -> should not have any other negative impact -> therefor the proposal

I guess anyway (even if this costs time): if you run the armbian-truncate-logs on any of your system, this will fail as well if you did not change either the /bin/sh link or you still use older /etc/default/armbian-ramlog from before Jun 12th.

On the other hand the change should not break anything because bash should be installed on every debian/ubuntu. If you try to uninstall it, you will get a big fat warning and there are related dependencies.

 

Last thing again: I really have to thank you to do the work on armbian and can totally understand the problem with all the different bugs and the work behind and the reason asking for logs. Maybe the explanation above is sufficient to merge the patch from Werner and I believe everybody can be happy :)

You don't have to spend a lot of time reading error logs (I'm quite sure you will not find a problem in there) any many still upcoming problem reports will be solved already (the number will increase as soon as the change above will spread over all the different systems).

 

Cheers

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines