Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

armbian-truncate-logs and PostgreSQL

Featured Replies

One of my Armbian machines (24.5.5 bookworm) is running PostgreSQL.  I don't think I've changed any of its default settings relating to PostgreSQL's log files or their permissions, but I'm occasionally getting emails from the armbian-truncate-logs cron job saying:

Quote

truncate: cannot open '/var/log/postgresql/postgresql-15-main.log' for writing: Permission denied

The directory /var/log/postgresql is owned by root (and group postgres) and has permissions drwxrwxr-t, and the file /var/log/postgresql/postgresql-15-main.log is owned by postgres (and group adm) and has permissions -rw-r-----.

 

In /var/log.hdd/postgresql the ownership and permissions are the same, and there are also files postgresql-15-main.log.1, postgresql-15-main.log.2.gz, postgresql-15-main.log.3.gz, ..., postgresql-15-main.log.10.gz (with the same ownership and permissions as postgresql-15-main.log).  The file postgresql-15-main.log.1 is a prefix of postgresql-15-main.log.

 

I have this problem only with PostgreSQL's logs; armbian-truncate-logs doesn't complain about any other log files.

 

Is there something I need to do to fix this, or is this a bug that will be fixed in future?

  • Author

I seem to have successfully worked around this problem by changing the permissions on /var/log/postgresql.  I'm not sure why the cron job, which looks like it's set up to run as root, couldn't truncate the file in that folder; and I'm not sure whether my solution is durable, or whether a reboot or something might reset the permissions at some stage, but it works for now.

As far as I know, the permissions of /var/log/postgresql after a reboot are recreated from those on /var/log.hdd/postgresql. So if you modify those as well (remove the sticky bit), the workaround should be permanent.

 

Thanks for highlighting this problem, I've encountered the very same issue, but didn't realize it was caused by this somewhat peculiar directory permission. So I just applied your workaround (plus my extension) and hope it will fix this once and for all.

  • Author

Thanks for the suggestion, but it didn't work for me.  Both /var/log/postgresql and /var/log.hdd/postgresql reverted to their pre-intervention ownership and permissions when I rebooted.

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.