SEVERE: regression in latest systemd update for Raspbian Stretch
up vote
0
down vote
favorite
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:
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?
systemd raspberry-pi raspbian
add a comment |
up vote
0
down vote
favorite
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:
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?
systemd raspberry-pi raspbian
According to the changelog of 232-25+deb9u6 there doesn't seem to be any changes in logging... Are you sure this is really related to systemd?
– Filipe Brandenburger
Nov 30 at 7:06
The PR #10832 you mentioned only affects the line in the middle (pam_systemd(su:session): Cannot create session: Already running in a session
), so I'd think the other lines would still be there even with that patch on...
– Filipe Brandenburger
Nov 30 at 7:07
Also, file/var/log/auth.log
is typically managed by syslog (rsyslogd, or whatever implementation of syslog you're currently running...) Are you sure there were no changes to syslog in this last upgrade that caused it to start logging to this file?
– Filipe Brandenburger
Nov 30 at 7:08
4
According to the logs, you’re runningsudo su
as root, which means neither sudo nor su are necessary.
– Stephen Kitt
Nov 30 at 7:38
the command I need to run as root from the script that runs twice per second isecho $1 > /sys/class/backlight/rpi_backlight/brightness 2>&1
. If use onlysudo
I get "command not found", if I use onlysu
I get prompted for the root password...
– sba923
Nov 30 at 15:25
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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:
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?
systemd raspberry-pi raspbian
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:
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?
systemd raspberry-pi raspbian
systemd raspberry-pi raspbian
edited Nov 30 at 8:37
Rui F Ribeiro
38.5k1479128
38.5k1479128
asked Nov 30 at 6:55
sba923
62
62
According to the changelog of 232-25+deb9u6 there doesn't seem to be any changes in logging... Are you sure this is really related to systemd?
– Filipe Brandenburger
Nov 30 at 7:06
The PR #10832 you mentioned only affects the line in the middle (pam_systemd(su:session): Cannot create session: Already running in a session
), so I'd think the other lines would still be there even with that patch on...
– Filipe Brandenburger
Nov 30 at 7:07
Also, file/var/log/auth.log
is typically managed by syslog (rsyslogd, or whatever implementation of syslog you're currently running...) Are you sure there were no changes to syslog in this last upgrade that caused it to start logging to this file?
– Filipe Brandenburger
Nov 30 at 7:08
4
According to the logs, you’re runningsudo su
as root, which means neither sudo nor su are necessary.
– Stephen Kitt
Nov 30 at 7:38
the command I need to run as root from the script that runs twice per second isecho $1 > /sys/class/backlight/rpi_backlight/brightness 2>&1
. If use onlysudo
I get "command not found", if I use onlysu
I get prompted for the root password...
– sba923
Nov 30 at 15:25
add a comment |
According to the changelog of 232-25+deb9u6 there doesn't seem to be any changes in logging... Are you sure this is really related to systemd?
– Filipe Brandenburger
Nov 30 at 7:06
The PR #10832 you mentioned only affects the line in the middle (pam_systemd(su:session): Cannot create session: Already running in a session
), so I'd think the other lines would still be there even with that patch on...
– Filipe Brandenburger
Nov 30 at 7:07
Also, file/var/log/auth.log
is typically managed by syslog (rsyslogd, or whatever implementation of syslog you're currently running...) Are you sure there were no changes to syslog in this last upgrade that caused it to start logging to this file?
– Filipe Brandenburger
Nov 30 at 7:08
4
According to the logs, you’re runningsudo su
as root, which means neither sudo nor su are necessary.
– Stephen Kitt
Nov 30 at 7:38
the command I need to run as root from the script that runs twice per second isecho $1 > /sys/class/backlight/rpi_backlight/brightness 2>&1
. If use onlysudo
I get "command not found", if I use onlysu
I get prompted for the root password...
– sba923
Nov 30 at 15:25
According to the changelog of 232-25+deb9u6 there doesn't seem to be any changes in logging... Are you sure this is really related to systemd?
– Filipe Brandenburger
Nov 30 at 7:06
According to the changelog of 232-25+deb9u6 there doesn't seem to be any changes in logging... Are you sure this is really related to systemd?
– Filipe Brandenburger
Nov 30 at 7:06
The PR #10832 you mentioned only affects the line in the middle (
pam_systemd(su:session): Cannot create session: Already running in a session
), so I'd think the other lines would still be there even with that patch on...– Filipe Brandenburger
Nov 30 at 7:07
The PR #10832 you mentioned only affects the line in the middle (
pam_systemd(su:session): Cannot create session: Already running in a session
), so I'd think the other lines would still be there even with that patch on...– Filipe Brandenburger
Nov 30 at 7:07
Also, file
/var/log/auth.log
is typically managed by syslog (rsyslogd, or whatever implementation of syslog you're currently running...) Are you sure there were no changes to syslog in this last upgrade that caused it to start logging to this file?– Filipe Brandenburger
Nov 30 at 7:08
Also, file
/var/log/auth.log
is typically managed by syslog (rsyslogd, or whatever implementation of syslog you're currently running...) Are you sure there were no changes to syslog in this last upgrade that caused it to start logging to this file?– Filipe Brandenburger
Nov 30 at 7:08
4
4
According to the logs, you’re running
sudo su
as root, which means neither sudo nor su are necessary.– Stephen Kitt
Nov 30 at 7:38
According to the logs, you’re running
sudo su
as root, which means neither sudo nor su are necessary.– Stephen Kitt
Nov 30 at 7:38
the command I need to run as root from the script that runs twice per second is
echo $1 > /sys/class/backlight/rpi_backlight/brightness 2>&1
. If use only sudo
I get "command not found", if I use only su
I get prompted for the root password...– sba923
Nov 30 at 15:25
the command I need to run as root from the script that runs twice per second is
echo $1 > /sys/class/backlight/rpi_backlight/brightness 2>&1
. If use only sudo
I get "command not found", if I use only su
I get prompted for the root password...– sba923
Nov 30 at 15:25
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
You have several questions here, actually and I will try and address each. Note that the solution here seems to be to not use su
as pointed out by Stephen Kitt in the comments.
I will address some other aspects.
How do you prepare a debian-based system for building from source, example: systemd (I would recommend to do this in a sandbox system such as a VM few times first)
$ sudo apt-get build-dep systemd
Now, assuming the version you wish to build is not a lot newer than the one you have, the dependencies are often the same, this holds true for patch-releases of systemd. The above command will get all the packages you need to build systemd, except, of course, systemd itself. Note that below, we are going to grab the latest and greatest systemd, note sure all prerequisites are met.
You then get the sources and build; systemd is on github, so you need git to get the sources.
$ sudo apt-get install git
$ git clone https://github.com/systemd/systemd.git
How you exactly build the source depends on the build system used by the developers of the software in question, systemd uses meson. I saw that when I wen to https://github.com/systemd/systemd, I scrolled down, there they have info on the project.
I saw this line:
Information about build requirements is provided in the README file.
and read the README file, always a good idea!
$ sudo apt-get install meson
$ git clone https://github.com/systemd/systemd.git
$ meson systemd/ && ninja -C systemd
$ cd systemd; sudo ninja install
How to configure retention of logs, so they do not fill up your drive:
Here, you need to configure logrotation for rsyslog. The configuration for logrotate lives in /etc/logrotate.d
, the file we want is /etc/logrotate.d/rsyslog
Access the docs first:
$ man logrotate.conf
$ man logrotate
Ok, so now we have read the docs, we know that the keyword to rotate logs is rotate
, size
specifies when to rotate to the next file, compress
compresses the rotated file, mail
mails it (optional), I want the file to be rotated, so I set mailfirst
.
My /etc/logrotate.d/rsyslog
looks like:
[...]
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
[...]
To configure logrotate for /var/log/auth
:
[...]
/var/log/kern.log
/var/log/auth.log
{
rotate 10
size 100M
compress
mail jdoe@example.com
mailfirst
}
/var/log/user.log
[...]
This will keep max 10 files of 100Mb
so almost 1Gb, as soon as a file reaches 100M, it is compressed and emailed to jdoe@example.com. By default, rotatelog is run daily via cron, you might want to run it hourly. man crontab
.
Thanks for the elaborate writeup. Building systemd with the documented command line fails withMeson encountered an error in file /home/pi/systemd/systemd-master/meson_options.txt, line 165, column 53: Expecting rparen got id.
. Log rotation is already enabled, but given the speedauth.log
grows, I'm afraid even daily rotate would suffice ;-) I've bitten the bullet and replaced all thesudo su - -c
in my shell scripts with calling a setuid root binary that does the work (of setting/getting the settings for the Raspberry Pi's LCD display).
– sba923
Dec 1 at 6:55
Sorry for the systemd build failure, it appears something is broken in the systemd sources (I dunno, master should never have a broken build), the stable release appeared to be too old. You could also set hourly rotate, or even every minute.... but removingsudo
was the correct approach!auth.log
is an important log file!!
– thecarpy
Dec 3 at 11:34
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
You have several questions here, actually and I will try and address each. Note that the solution here seems to be to not use su
as pointed out by Stephen Kitt in the comments.
I will address some other aspects.
How do you prepare a debian-based system for building from source, example: systemd (I would recommend to do this in a sandbox system such as a VM few times first)
$ sudo apt-get build-dep systemd
Now, assuming the version you wish to build is not a lot newer than the one you have, the dependencies are often the same, this holds true for patch-releases of systemd. The above command will get all the packages you need to build systemd, except, of course, systemd itself. Note that below, we are going to grab the latest and greatest systemd, note sure all prerequisites are met.
You then get the sources and build; systemd is on github, so you need git to get the sources.
$ sudo apt-get install git
$ git clone https://github.com/systemd/systemd.git
How you exactly build the source depends on the build system used by the developers of the software in question, systemd uses meson. I saw that when I wen to https://github.com/systemd/systemd, I scrolled down, there they have info on the project.
I saw this line:
Information about build requirements is provided in the README file.
and read the README file, always a good idea!
$ sudo apt-get install meson
$ git clone https://github.com/systemd/systemd.git
$ meson systemd/ && ninja -C systemd
$ cd systemd; sudo ninja install
How to configure retention of logs, so they do not fill up your drive:
Here, you need to configure logrotation for rsyslog. The configuration for logrotate lives in /etc/logrotate.d
, the file we want is /etc/logrotate.d/rsyslog
Access the docs first:
$ man logrotate.conf
$ man logrotate
Ok, so now we have read the docs, we know that the keyword to rotate logs is rotate
, size
specifies when to rotate to the next file, compress
compresses the rotated file, mail
mails it (optional), I want the file to be rotated, so I set mailfirst
.
My /etc/logrotate.d/rsyslog
looks like:
[...]
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
[...]
To configure logrotate for /var/log/auth
:
[...]
/var/log/kern.log
/var/log/auth.log
{
rotate 10
size 100M
compress
mail jdoe@example.com
mailfirst
}
/var/log/user.log
[...]
This will keep max 10 files of 100Mb
so almost 1Gb, as soon as a file reaches 100M, it is compressed and emailed to jdoe@example.com. By default, rotatelog is run daily via cron, you might want to run it hourly. man crontab
.
Thanks for the elaborate writeup. Building systemd with the documented command line fails withMeson encountered an error in file /home/pi/systemd/systemd-master/meson_options.txt, line 165, column 53: Expecting rparen got id.
. Log rotation is already enabled, but given the speedauth.log
grows, I'm afraid even daily rotate would suffice ;-) I've bitten the bullet and replaced all thesudo su - -c
in my shell scripts with calling a setuid root binary that does the work (of setting/getting the settings for the Raspberry Pi's LCD display).
– sba923
Dec 1 at 6:55
Sorry for the systemd build failure, it appears something is broken in the systemd sources (I dunno, master should never have a broken build), the stable release appeared to be too old. You could also set hourly rotate, or even every minute.... but removingsudo
was the correct approach!auth.log
is an important log file!!
– thecarpy
Dec 3 at 11:34
add a comment |
up vote
1
down vote
You have several questions here, actually and I will try and address each. Note that the solution here seems to be to not use su
as pointed out by Stephen Kitt in the comments.
I will address some other aspects.
How do you prepare a debian-based system for building from source, example: systemd (I would recommend to do this in a sandbox system such as a VM few times first)
$ sudo apt-get build-dep systemd
Now, assuming the version you wish to build is not a lot newer than the one you have, the dependencies are often the same, this holds true for patch-releases of systemd. The above command will get all the packages you need to build systemd, except, of course, systemd itself. Note that below, we are going to grab the latest and greatest systemd, note sure all prerequisites are met.
You then get the sources and build; systemd is on github, so you need git to get the sources.
$ sudo apt-get install git
$ git clone https://github.com/systemd/systemd.git
How you exactly build the source depends on the build system used by the developers of the software in question, systemd uses meson. I saw that when I wen to https://github.com/systemd/systemd, I scrolled down, there they have info on the project.
I saw this line:
Information about build requirements is provided in the README file.
and read the README file, always a good idea!
$ sudo apt-get install meson
$ git clone https://github.com/systemd/systemd.git
$ meson systemd/ && ninja -C systemd
$ cd systemd; sudo ninja install
How to configure retention of logs, so they do not fill up your drive:
Here, you need to configure logrotation for rsyslog. The configuration for logrotate lives in /etc/logrotate.d
, the file we want is /etc/logrotate.d/rsyslog
Access the docs first:
$ man logrotate.conf
$ man logrotate
Ok, so now we have read the docs, we know that the keyword to rotate logs is rotate
, size
specifies when to rotate to the next file, compress
compresses the rotated file, mail
mails it (optional), I want the file to be rotated, so I set mailfirst
.
My /etc/logrotate.d/rsyslog
looks like:
[...]
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
[...]
To configure logrotate for /var/log/auth
:
[...]
/var/log/kern.log
/var/log/auth.log
{
rotate 10
size 100M
compress
mail jdoe@example.com
mailfirst
}
/var/log/user.log
[...]
This will keep max 10 files of 100Mb
so almost 1Gb, as soon as a file reaches 100M, it is compressed and emailed to jdoe@example.com. By default, rotatelog is run daily via cron, you might want to run it hourly. man crontab
.
Thanks for the elaborate writeup. Building systemd with the documented command line fails withMeson encountered an error in file /home/pi/systemd/systemd-master/meson_options.txt, line 165, column 53: Expecting rparen got id.
. Log rotation is already enabled, but given the speedauth.log
grows, I'm afraid even daily rotate would suffice ;-) I've bitten the bullet and replaced all thesudo su - -c
in my shell scripts with calling a setuid root binary that does the work (of setting/getting the settings for the Raspberry Pi's LCD display).
– sba923
Dec 1 at 6:55
Sorry for the systemd build failure, it appears something is broken in the systemd sources (I dunno, master should never have a broken build), the stable release appeared to be too old. You could also set hourly rotate, or even every minute.... but removingsudo
was the correct approach!auth.log
is an important log file!!
– thecarpy
Dec 3 at 11:34
add a comment |
up vote
1
down vote
up vote
1
down vote
You have several questions here, actually and I will try and address each. Note that the solution here seems to be to not use su
as pointed out by Stephen Kitt in the comments.
I will address some other aspects.
How do you prepare a debian-based system for building from source, example: systemd (I would recommend to do this in a sandbox system such as a VM few times first)
$ sudo apt-get build-dep systemd
Now, assuming the version you wish to build is not a lot newer than the one you have, the dependencies are often the same, this holds true for patch-releases of systemd. The above command will get all the packages you need to build systemd, except, of course, systemd itself. Note that below, we are going to grab the latest and greatest systemd, note sure all prerequisites are met.
You then get the sources and build; systemd is on github, so you need git to get the sources.
$ sudo apt-get install git
$ git clone https://github.com/systemd/systemd.git
How you exactly build the source depends on the build system used by the developers of the software in question, systemd uses meson. I saw that when I wen to https://github.com/systemd/systemd, I scrolled down, there they have info on the project.
I saw this line:
Information about build requirements is provided in the README file.
and read the README file, always a good idea!
$ sudo apt-get install meson
$ git clone https://github.com/systemd/systemd.git
$ meson systemd/ && ninja -C systemd
$ cd systemd; sudo ninja install
How to configure retention of logs, so they do not fill up your drive:
Here, you need to configure logrotation for rsyslog. The configuration for logrotate lives in /etc/logrotate.d
, the file we want is /etc/logrotate.d/rsyslog
Access the docs first:
$ man logrotate.conf
$ man logrotate
Ok, so now we have read the docs, we know that the keyword to rotate logs is rotate
, size
specifies when to rotate to the next file, compress
compresses the rotated file, mail
mails it (optional), I want the file to be rotated, so I set mailfirst
.
My /etc/logrotate.d/rsyslog
looks like:
[...]
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
[...]
To configure logrotate for /var/log/auth
:
[...]
/var/log/kern.log
/var/log/auth.log
{
rotate 10
size 100M
compress
mail jdoe@example.com
mailfirst
}
/var/log/user.log
[...]
This will keep max 10 files of 100Mb
so almost 1Gb, as soon as a file reaches 100M, it is compressed and emailed to jdoe@example.com. By default, rotatelog is run daily via cron, you might want to run it hourly. man crontab
.
You have several questions here, actually and I will try and address each. Note that the solution here seems to be to not use su
as pointed out by Stephen Kitt in the comments.
I will address some other aspects.
How do you prepare a debian-based system for building from source, example: systemd (I would recommend to do this in a sandbox system such as a VM few times first)
$ sudo apt-get build-dep systemd
Now, assuming the version you wish to build is not a lot newer than the one you have, the dependencies are often the same, this holds true for patch-releases of systemd. The above command will get all the packages you need to build systemd, except, of course, systemd itself. Note that below, we are going to grab the latest and greatest systemd, note sure all prerequisites are met.
You then get the sources and build; systemd is on github, so you need git to get the sources.
$ sudo apt-get install git
$ git clone https://github.com/systemd/systemd.git
How you exactly build the source depends on the build system used by the developers of the software in question, systemd uses meson. I saw that when I wen to https://github.com/systemd/systemd, I scrolled down, there they have info on the project.
I saw this line:
Information about build requirements is provided in the README file.
and read the README file, always a good idea!
$ sudo apt-get install meson
$ git clone https://github.com/systemd/systemd.git
$ meson systemd/ && ninja -C systemd
$ cd systemd; sudo ninja install
How to configure retention of logs, so they do not fill up your drive:
Here, you need to configure logrotation for rsyslog. The configuration for logrotate lives in /etc/logrotate.d
, the file we want is /etc/logrotate.d/rsyslog
Access the docs first:
$ man logrotate.conf
$ man logrotate
Ok, so now we have read the docs, we know that the keyword to rotate logs is rotate
, size
specifies when to rotate to the next file, compress
compresses the rotated file, mail
mails it (optional), I want the file to be rotated, so I set mailfirst
.
My /etc/logrotate.d/rsyslog
looks like:
[...]
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
[...]
To configure logrotate for /var/log/auth
:
[...]
/var/log/kern.log
/var/log/auth.log
{
rotate 10
size 100M
compress
mail jdoe@example.com
mailfirst
}
/var/log/user.log
[...]
This will keep max 10 files of 100Mb
so almost 1Gb, as soon as a file reaches 100M, it is compressed and emailed to jdoe@example.com. By default, rotatelog is run daily via cron, you might want to run it hourly. man crontab
.
answered Nov 30 at 12:30
thecarpy
2,255824
2,255824
Thanks for the elaborate writeup. Building systemd with the documented command line fails withMeson encountered an error in file /home/pi/systemd/systemd-master/meson_options.txt, line 165, column 53: Expecting rparen got id.
. Log rotation is already enabled, but given the speedauth.log
grows, I'm afraid even daily rotate would suffice ;-) I've bitten the bullet and replaced all thesudo su - -c
in my shell scripts with calling a setuid root binary that does the work (of setting/getting the settings for the Raspberry Pi's LCD display).
– sba923
Dec 1 at 6:55
Sorry for the systemd build failure, it appears something is broken in the systemd sources (I dunno, master should never have a broken build), the stable release appeared to be too old. You could also set hourly rotate, or even every minute.... but removingsudo
was the correct approach!auth.log
is an important log file!!
– thecarpy
Dec 3 at 11:34
add a comment |
Thanks for the elaborate writeup. Building systemd with the documented command line fails withMeson encountered an error in file /home/pi/systemd/systemd-master/meson_options.txt, line 165, column 53: Expecting rparen got id.
. Log rotation is already enabled, but given the speedauth.log
grows, I'm afraid even daily rotate would suffice ;-) I've bitten the bullet and replaced all thesudo su - -c
in my shell scripts with calling a setuid root binary that does the work (of setting/getting the settings for the Raspberry Pi's LCD display).
– sba923
Dec 1 at 6:55
Sorry for the systemd build failure, it appears something is broken in the systemd sources (I dunno, master should never have a broken build), the stable release appeared to be too old. You could also set hourly rotate, or even every minute.... but removingsudo
was the correct approach!auth.log
is an important log file!!
– thecarpy
Dec 3 at 11:34
Thanks for the elaborate writeup. Building systemd with the documented command line fails with
Meson encountered an error in file /home/pi/systemd/systemd-master/meson_options.txt, line 165, column 53: Expecting rparen got id.
. Log rotation is already enabled, but given the speed auth.log
grows, I'm afraid even daily rotate would suffice ;-) I've bitten the bullet and replaced all the sudo su - -c
in my shell scripts with calling a setuid root binary that does the work (of setting/getting the settings for the Raspberry Pi's LCD display).– sba923
Dec 1 at 6:55
Thanks for the elaborate writeup. Building systemd with the documented command line fails with
Meson encountered an error in file /home/pi/systemd/systemd-master/meson_options.txt, line 165, column 53: Expecting rparen got id.
. Log rotation is already enabled, but given the speed auth.log
grows, I'm afraid even daily rotate would suffice ;-) I've bitten the bullet and replaced all the sudo su - -c
in my shell scripts with calling a setuid root binary that does the work (of setting/getting the settings for the Raspberry Pi's LCD display).– sba923
Dec 1 at 6:55
Sorry for the systemd build failure, it appears something is broken in the systemd sources (I dunno, master should never have a broken build), the stable release appeared to be too old. You could also set hourly rotate, or even every minute.... but removing
sudo
was the correct approach! auth.log
is an important log file!!– thecarpy
Dec 3 at 11:34
Sorry for the systemd build failure, it appears something is broken in the systemd sources (I dunno, master should never have a broken build), the stable release appeared to be too old. You could also set hourly rotate, or even every minute.... but removing
sudo
was the correct approach! auth.log
is an important log file!!– thecarpy
Dec 3 at 11:34
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f485082%2fsevere-regression-in-latest-systemd-update-for-raspbian-stretch%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
According to the changelog of 232-25+deb9u6 there doesn't seem to be any changes in logging... Are you sure this is really related to systemd?
– Filipe Brandenburger
Nov 30 at 7:06
The PR #10832 you mentioned only affects the line in the middle (
pam_systemd(su:session): Cannot create session: Already running in a session
), so I'd think the other lines would still be there even with that patch on...– Filipe Brandenburger
Nov 30 at 7:07
Also, file
/var/log/auth.log
is typically managed by syslog (rsyslogd, or whatever implementation of syslog you're currently running...) Are you sure there were no changes to syslog in this last upgrade that caused it to start logging to this file?– Filipe Brandenburger
Nov 30 at 7:08
4
According to the logs, you’re running
sudo su
as root, which means neither sudo nor su are necessary.– Stephen Kitt
Nov 30 at 7:38
the command I need to run as root from the script that runs twice per second is
echo $1 > /sys/class/backlight/rpi_backlight/brightness 2>&1
. If use onlysudo
I get "command not found", if I use onlysu
I get prompted for the root password...– sba923
Nov 30 at 15:25