sba923
Posts: 5
Joined: Thu Mar 03, 2016 12:17 pm

SEVERE: regression in latest systemd update for Stretch

Fri Nov 30, 2018 6:17 am

Hi,

I've recently updated my Stretch system and this got me version 232-25+deb9u6 of systemd.

A very nasty side effect is that my /var/log/auth.log gets flooded with stuff like:

Code: Select all

Nov 30 07:13:34 rpi2-2 sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 30 07:13:34 rpi2-2 su[29165]: Successful su for root by root
Nov 30 07:13:34 rpi2-2 su[29165]: + ??? root:root
Nov 30 07:13:34 rpi2-2 su[29165]: pam_unix(su:session): session opened for user root by (uid=0)
Nov 30 07:13:34 rpi2-2 su[29165]: pam_systemd(su:session): Cannot create session: Already running in a session
Nov 30 07:13:34 rpi2-2 su[29165]: pam_unix(su:session): session closed for user root
Nov 30 07:13:34 rpi2-2 sudo: pam_unix(sudo:session): session closed for user root
Nov 30 07:13:35 rpi2-2 sudo:       pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/bin/su - -c echo 1 > /sys/class/backlight/rpi_backlight/bl_power
This seems to have been fixed by a more recent version of systemd (see https://github.com/systemd/systemd/pull/10832) but I haven't been able to build that version on my own.

This is a showstopper since I have some code that runs 'su' twice per second, causing auth.log to quickly fill up the root partition.

How can get the latest systemd binary for Raspbian Stretch, or an older version that doesn't have this problem?

TIA for your help.

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: SEVERE: regression in latest systemd update for Stretch

Fri Nov 30, 2018 8:55 am

Running "su" twice a second???

That's just wrong.

There has to be a better way to do whatever it is you're doing.

I tend to avoid using 'su' in frequently-run-jobs, for just this reason. No sense filling up the logs files with messages to no purpose. There is always another way to do it.

Maybe there is an option somewhere to turn of the system logging of 'su' events, but, for me, the simple solution is to just avoid doing it (on a recurring basis).
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

sba923
Posts: 5
Joined: Thu Mar 03, 2016 12:17 pm

Re: SEVERE: regression in latest systemd update for Stretch

Fri Nov 30, 2018 8:59 am

Sure, I can delegate the operations that need root privileges to another script that does the loop...

auth.log would keep growing, albeit at a much slower pace ;-)

sba923
Posts: 5
Joined: Thu Mar 03, 2016 12:17 pm

Re: SEVERE: regression in latest systemd update for Stretch

Sat Dec 01, 2018 7:05 am

I've bitten the bullet and replaced all the occurrences of

Code: Select all

sudo su - -c
in my shell scripts with invocations of a setuid root binary that does the job (of getting/setting the settings for the Raspberry Pi's LCD display by reading/writing from/to

Code: Select all

/sys/class/backlight/rpi_backlight/brightness
and

Code: Select all

/sys/class/backlight/rpi_backlight/bl_power
).

Note that auth.log will still grow faster than before that system update, but won't fill up the disk before logrotate kicks in ;)

Thanks for pushing me to do the right thing :D

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: SEVERE: regression in latest systemd update for Stretch

Sat Dec 01, 2018 2:22 pm

Good to hear it!

It's kind of a problem that Unix has always erred on the side of "Tell them everything; let the user figure out what is important" when it comes to logging.

One wonder what would happen if you made "auth.log " a symlink to "/dev/null"...
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

Return to “Raspberry Pi OS”