
Ubuntu日本語フォーラム
ログインしていません。
/var/log/ の容量が大きくなっていた >数十ギガ
で logroteteでファイルサイズの容量を制限しようと思い立ちました
logrotateの設定は /etc/logrotate.conf と /etc/logrotate.d の中に記載してあって
logrotate.conf に記載があっても logrotate.d で個別の記載があればそれが優先されると
もともとの logrotate.conf の内容
$ cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly
# use the adm group by default, since this is the owning group
# of /var/log/syslog.
su root adm
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
#dateext
# uncomment this if you want your log files compressed
#compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# system-specific logs may be also be configured here.
に maxsizeの記載を加え
$ cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly
# size matters, I hope it work
maxsize 10M <ー 加えた
# use the adm group by default, since this is the owning group
# of /var/log/syslog.
su root adm
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
#dateext
# uncomment this if you want your log files compressed
#compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# system-specific logs may be also be configured here.
としました。
試しに
$ sudo logrotate -d /etc/logrotate.conf とすると
WARNING: logrotate in debug mode does nothing except printing debug messages! Consider using verbose mode (-v) instead if this is not what you want.
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file alternatives
reading config file apport
reading config file apt
reading config file bootlog
reading config file btmp
reading config file cups-daemon
reading config file dpkg
reading config file ppp
reading config file rsyslog
reading config file speech-dispatcher
reading config file ubuntu-advantage-tools
reading config file ufw
reading config file unattended-upgrades
reading config file wtmp
Reading state from file: /var/lib/logrotate/status
Allocating hash table for state file, size 64 entries
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Handling 17 logs
rotating pattern: /var/log/alternatives.log monthly (12 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/alternatives.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not month ago yet)
switching euid to 0 and egid to 0
rotating pattern: /var/log/apport.log after 1 days (7 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/apport.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-21 08:01
log does not need rotating (log has been rotated at 2020-10-21 8:1, that is not day ago yet)
switching euid to 0 and egid to 0
rotating pattern: /var/log/apt/term.log monthly (12 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/apt/term.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not month ago yet)
switching euid to 0 and egid to 0
rotating pattern: /var/log/apt/history.log monthly (12 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/apt/history.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not month ago yet)
switching euid to 0 and egid to 0
rotating pattern: /var/log/boot.log
after 1 days (7 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/boot.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-21 08:01
log does not need rotating (log has been rotated at 2020-10-21 8:1, that is not day ago yet)
switching euid to 0 and egid to 0
rotating pattern: /var/log/btmp monthly (1 rotations)
empty log files are rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/btmp
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not month ago yet)
switching euid to 0 and egid to 0
rotating pattern: /var/log/cups/*log after 1 days (7 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/cups/access_log
Now: 2020-10-21 09:30
Last rotated at 2020-10-21 08:01
log does not need rotating (log has been rotated at 2020-10-21 8:1, that is not day ago yet)
considering log /var/log/cups/error_log
Now: 2020-10-21 09:30
Last rotated at 2020-10-21 08:01
log does not need rotating (log has been rotated at 2020-10-21 8:1, that is not day ago yet)
not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0
rotating pattern: /var/log/dpkg.log monthly (12 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/dpkg.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not month ago yet)
switching euid to 0 and egid to 0
rotating pattern: /var/log/ppp-connect-errors weekly (4 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/ppp-connect-errors
log /var/log/ppp-connect-errors does not exist -- skipping
switching euid to 0 and egid to 0
rotating pattern: /var/log/syslog
after 1 days (7 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/syslog
Now: 2020-10-21 09:30
Last rotated at 2020-10-21 08:01
log needs rotating
rotating log /var/log/syslog, log->rotateCount is 7
dateext suffix '-20201021'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
renaming /var/log/syslog.7.gz to /var/log/syslog.8.gz (rotatecount 7, logstart 1, i 7),
renaming /var/log/syslog.6.gz to /var/log/syslog.7.gz (rotatecount 7, logstart 1, i 6),
renaming /var/log/syslog.5.gz to /var/log/syslog.6.gz (rotatecount 7, logstart 1, i 5),
renaming /var/log/syslog.4.gz to /var/log/syslog.5.gz (rotatecount 7, logstart 1, i 4),
renaming /var/log/syslog.3.gz to /var/log/syslog.4.gz (rotatecount 7, logstart 1, i 3),
renaming /var/log/syslog.2.gz to /var/log/syslog.3.gz (rotatecount 7, logstart 1, i 2),
renaming /var/log/syslog.1.gz to /var/log/syslog.2.gz (rotatecount 7, logstart 1, i 1),
renaming /var/log/syslog.0.gz to /var/log/syslog.1.gz (rotatecount 7, logstart 1, i 0),
log /var/log/syslog.8.gz doesn't exist -- won't try to dispose of it
renaming /var/log/syslog to /var/log/syslog.1
creating new /var/log/syslog mode = 0640 uid = 104 gid = 4
running postrotate script
running script with arg /var/log/syslog: "
/usr/lib/rsyslog/rsyslog-rotate
"
switching euid to 0 and egid to 0
rotating pattern: /var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
weekly (4 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/mail.info
log /var/log/mail.info does not exist -- skipping
considering log /var/log/mail.warn
log /var/log/mail.warn does not exist -- skipping
considering log /var/log/mail.err
log /var/log/mail.err does not exist -- skipping
considering log /var/log/mail.log
log /var/log/mail.log does not exist -- skipping
considering log /var/log/daemon.log
log /var/log/daemon.log does not exist -- skipping
considering log /var/log/kern.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log needs rotating
considering log /var/log/auth.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not week ago yet)
considering log /var/log/user.log
log /var/log/user.log does not exist -- skipping
considering log /var/log/lpr.log
log /var/log/lpr.log does not exist -- skipping
considering log /var/log/cron.log
log /var/log/cron.log does not exist -- skipping
considering log /var/log/debug
log /var/log/debug does not exist -- skipping
considering log /var/log/messages
log /var/log/messages does not exist -- skipping
rotating log /var/log/kern.log, log->rotateCount is 4
dateext suffix '-20201021'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/kern.log.1 does not exist
renaming /var/log/kern.log.4.gz to /var/log/kern.log.5.gz (rotatecount 4, logstart 1, i 4),
renaming /var/log/kern.log.3.gz to /var/log/kern.log.4.gz (rotatecount 4, logstart 1, i 3),
renaming /var/log/kern.log.2.gz to /var/log/kern.log.3.gz (rotatecount 4, logstart 1, i 2),
renaming /var/log/kern.log.1.gz to /var/log/kern.log.2.gz (rotatecount 4, logstart 1, i 1),
renaming /var/log/kern.log.0.gz to /var/log/kern.log.1.gz (rotatecount 4, logstart 1, i 0),
log /var/log/kern.log.5.gz doesn't exist -- won't try to dispose of it
renaming /var/log/kern.log to /var/log/kern.log.1
creating new /var/log/kern.log mode = 0640 uid = 104 gid = 4
running postrotate script
running script with arg /var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
: "
/usr/lib/rsyslog/rsyslog-rotate
"
switching euid to 0 and egid to 0
rotating pattern: /var/log/speech-dispatcher/speech-dispatcher.log /var/log/speech-dispatcher/speech-dispatcher-protocol.log after 1 days (7 rotations)
empty log files are rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/speech-dispatcher/speech-dispatcher.log
log /var/log/speech-dispatcher/speech-dispatcher.log does not exist -- skipping
considering log /var/log/speech-dispatcher/speech-dispatcher-protocol.log
log /var/log/speech-dispatcher/speech-dispatcher-protocol.log does not exist -- skipping
not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0
rotating pattern: /var/log/speech-dispatcher/debug-epos-generic /var/log/speech-dispatcher/debug-festival /var/log/speech-dispatcher/debug-flite after 1 days (2 rotations)
empty log files are rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/speech-dispatcher/debug-epos-generic
log /var/log/speech-dispatcher/debug-epos-generic does not exist -- skipping
considering log /var/log/speech-dispatcher/debug-festival
log /var/log/speech-dispatcher/debug-festival does not exist -- skipping
considering log /var/log/speech-dispatcher/debug-flite
log /var/log/speech-dispatcher/debug-flite does not exist -- skipping
not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0
rotating pattern: /var/log/ubuntu-advantage.log monthly (6 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/ubuntu-advantage.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not month ago yet)
switching euid to 0 and egid to 0
rotating pattern: /var/log/ufw.log
weekly (4 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/ufw.log
log /var/log/ufw.log does not exist -- skipping
not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0
rotating pattern: /var/log/unattended-upgrades/unattended-upgrades.log
/var/log/unattended-upgrades/unattended-upgrades-dpkg.log
/var/log/unattended-upgrades/unattended-upgrades-shutdown.log
monthly (6 rotations)
empty log files are not rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/unattended-upgrades/unattended-upgrades.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not month ago yet)
considering log /var/log/unattended-upgrades/unattended-upgrades-dpkg.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not month ago yet)
considering log /var/log/unattended-upgrades/unattended-upgrades-shutdown.log
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not month ago yet)
switching euid to 0 and egid to 0
rotating pattern: /var/log/wtmp monthly (1 rotations)
empty log files are rotated, only log files >= 1048576 bytes are rotated, log files >= 10485760 are rotated earlier, old logs are removed
switching euid to 0 and egid to 4
considering log /var/log/wtmp
Now: 2020-10-21 09:30
Last rotated at 2020-10-19 08:00
log does not need rotating (log has been rotated at 2020-10-19 8:0, that is not month ago yet)
log does not need rotating ('minsize' directive is used and the log size is smaller than the minsize value)
switching euid to 0 and egid to 0
上記の表記からは maxsizeが効いてるのかどうか自分では判断できませんでした。
logrotate.conf に maxsize をこんな感じで記載してOKなのか
あるいは logrotate.d のなかに個別の記載をしなければいけないのか
おわかりの方 お教え下さい
オフライン
tshiihara による投稿:
/var/log/ の容量が大きくなっていた >数十ギガ
で logroteteでファイルサイズの容量を制限しようと思い立ちました
「端末」で
sudo du /var/log
を実行してどこがディスク使用量が大きいかを確認して下さい。
(または
sudo baobab /var/log
で「ディスク使用量アナライザ」により GUI表示することもできます。)
使用量がかさんでいるのは /var/log/journal フォルダではありませんか?
ここは logrotateではなく systemd-journaldが管理しています。
journal のサイズ制限 - systemd/ジャーナル - ArchWiki
https://wiki.archlinux.jp/index.php/Systemd/%E3%82%B8%E3%83%A3%E3%83%BC%E3%83%8A%E3%83%AB#journal_.E3.81.AE.E3.82.B5.E3.82.A4.E3.82.BA.E5.88.B6.E9.99.90
/etc/systemd/journald.conf の SystemMaxUse を変更すれば、最大サイズを変更できます。例えば制限を 50Mib にする場合、適切な行を次のようにアンコメント・編集します:
SystemMaxUse=50M
使用ディスク容量が 100M 以下になるまで journal ファイルを削除する:
# journalctl --vacuum-size=100M
2週間以上前のデータを含んでいる journal ファイルを削除する:
# journalctl --vacuum-time=2weeks
man journald.conf の訳 - kandamotohiro
https://sites.google.com/site/kandamotohiro/systemd/man-journald-conf-no-yi
オフライン
コメントありがとうございます。
$ sudo du -h /var/log/*
0 /var/log/alternatives.log
36K /var/log/alternatives.log.1
0 /var/log/apport.log
4.0K /var/log/apport.log.1
128K /var/log/apt
12K /var/log/auth.log
96K /var/log/auth.log.1
0 /var/log/boot.log
4.0K /var/log/boot.log.1
76K /var/log/boot.log.2
104K /var/log/bootstrap.log
0 /var/log/btmp
0 /var/log/btmp.1
108K /var/log/cups
4.0K /var/log/dist-upgrade
1.4M /var/log/dmesg
2.9M /var/log/dmesg.0
68K /var/log/dmesg.1.gz
20K /var/log/dmesg.2.gz
20K /var/log/dmesg.3.gz
20K /var/log/dmesg.4.gz
0 /var/log/dpkg.log
1.3M /var/log/dpkg.log.1
8.0K /var/log/faillog
12K /var/log/fontconfig.log
4.0K /var/log/gdm3
4.0K /var/log/gpu-manager.log
4.0K /var/log/hp/tmp
8.0K /var/log/hp
1.3M /var/log/installer
113M /var/log/journal/9fe192152c6e4711bca41af12612421c
113M /var/log/journal
8.2G /var/log/kern.log
11G /var/log/kern.log.1
44K /var/log/lastlog
4.0K /var/log/openvpn
4.0K /var/log/private
4.0K /var/log/speech-dispatcher
8.2G /var/log/syslog
2.4G /var/log/syslog.1
286M /var/log/syslog.2.gz
0 /var/log/ubuntu-advantage.log
16K /var/log/unattended-upgrades
0 /var/log/wtmp
16K /var/log/wtmp.1
journalも大きかったのですが、コメントに書いてもらったような方法で対処しました。
kern.log と syslogが大きくて、中身は
$ tail -n20 /var/log/syslog
Oct 21 16:09:17 takashi-desktop kernel: [29270.774780] ACPI BIOS Error (bug): Could not resolve symbol [\_GPE._L6F.PGRT], AE_NOT_FOUND (20190816/psargs-330)
Oct 21 16:09:17 takashi-desktop kernel: [29270.774783] No Local Variables are initialized for Method [_L6F]
Oct 21 16:09:17 takashi-desktop kernel: [29270.774784] No Arguments are initialized for method [_L6F]
Oct 21 16:09:17 takashi-desktop kernel: [29270.774785] ACPI Error: Aborting method \_GPE._L6F due to previous error (AE_NOT_FOUND) (20190816/psparse-529)
Oct 21 16:09:17 takashi-desktop kernel: [29270.774789] ACPI Error: AE_NOT_FOUND, while evaluating GPE method [_L6F] (20190816/evgpe-511)
Oct 21 16:09:17 takashi-desktop kernel: [29270.776366] ACPI BIOS Error (bug): Could not resolve symbol [\_GPE._L6F.PGRT], AE_NOT_FOUND (20190816/psargs-330)
Oct 21 16:09:17 takashi-desktop kernel: [29270.776370] No Local Variables are initialized for Method [_L6F]
Oct 21 16:09:17 takashi-desktop kernel: [29270.776371] No Arguments are initialized for method [_L6F]
Oct 21 16:09:17 takashi-desktop kernel: [29270.776372] ACPI Error: Aborting method \_GPE._L6F due to previous error (AE_NOT_FOUND) (20190816/psparse-529)
Oct 21 16:09:17 takashi-desktop kernel: [29270.776375] ACPI Error: AE_NOT_FOUND, while evaluating GPE method [_L6F] (20190816/evgpe-511)
Oct 21 16:09:17 takashi-desktop kernel: [29270.777999] ACPI BIOS Error (bug): Could not resolve symbol [\_GPE._L6F.PGRT], AE_NOT_FOUND (20190816/psargs-330)
Oct 21 16:09:17 takashi-desktop kernel: [29270.778003] No Local Variables are initialized for Method [_L6F]
Oct 21 16:09:17 takashi-desktop kernel: [29270.778004] No Arguments are initialized for method [_L6F]
Oct 21 16:09:17 takashi-desktop kernel: [29270.778005] ACPI Error: Aborting method \_GPE._L6F due to previous error (AE_NOT_FOUND) (20190816/psparse-529)
Oct 21 16:09:17 takashi-desktop kernel: [29270.778008] ACPI Error: AE_NOT_FOUND, while evaluating GPE method [_L6F] (20190816/evgpe-511)
Oct 21 16:09:17 takashi-desktop kernel: [29270.779583] ACPI BIOS Error (bug): Could not resolve symbol [\_GPE._L6F.PGRT], AE_NOT_FOUND (20190816/psargs-330)
Oct 21 16:09:17 takashi-desktop kernel: [29270.779587] No Local Variables are initialized for Method [_L6F]
Oct 21 16:09:17 takashi-desktop kernel: [29270.779588] No Arguments are initialized for method [_L6F]
Oct 21 16:09:17 takashi-desktop kernel: [29270.779589] ACPI Error: Aborting method \_GPE._L6F due to previous error (AE_NOT_FOUND) (20190816/psparse-529)
Oct 21 16:09:17 takashi-desktop kernel: [29270.779592] ACPI Error: AE_NOT_FOUND, while evaluating GPE method [_L6F] (20190816/evgpe-511)
ACPI error自体は 出てても表面的には問題なく動いてるので、
/var/log/ の肥大化を押さえたいなと思っております。
journalは対処したので、 logrotate.conf にmaxsizeの記載で上手く行くのか知識・経験のある方に
お伺いできると幸いです。
オフライン
似たようなログのトラブルの記事がありました。
これに近いマザーボードをお使いでしょうか?
Ubuntu:ACPIエラー - Qiita
https://qiita.com/kannkyo/items/c1bc70a1856ce140120e
原因
詳しい原因はわからなかったが、どうもAsRock マザーボードの Z170シリーズのBIOSバグとの説が有力らしい。(未確定情報)
対策
Ubuntuの起動時にGPEL6の割り込みをdisableに設定するようにする。
まず、以下のコマンドで起動シェルスを開く。コード:
sudo vim /etc/rc.localファイルにecho ....のコマンドを追記する。
コード:
echo "disable" > /sys/firmware/acpi/interrupts/gpe6F exit 0最後にPCを再起動するとlogの増殖が止まっていることが確認できる。
要するに、ファームウェアの割り込み設定を無理やり変更して、ログを吐かないようにする荒技。
オフライン
自己レス
ACPI error に関しては自分で過去に投稿してました。
https://forums.ubuntulinux.jp/viewtopic.php?id=18472
16.04で問題あって、 18.04はupdate 20.04クリーンインスツールして問題再発
で過去のことはすっかり忘れてました。
投稿しててよかった>過去の自分
オフライン
ありがとうございます。
Intel H170
(mATX / Intel H170 Express)
Intel Core i3-6100T/2コア
でした。
でも 20.04 だと /etc/rc.local
って無いんですね。さてどうしよう。
elliptic による投稿:
似たようなログのトラブルの記事がありました。
これに近いマザーボードをお使いでしょうか?
Ubuntu:ACPIエラー - Qiita
https://qiita.com/kannkyo/items/c1bc70a1856ce140120e原因
詳しい原因はわからなかったが、どうもAsRock マザーボードの Z170シリーズのBIOSバグとの説が有力らしい。(未確定情報)
対策
Ubuntuの起動時にGPEL6の割り込みをdisableに設定するようにする。
まず、以下のコマンドで起動シェルスを開く。コード:
sudo vim /etc/rc.localファイルにecho ....のコマンドを追記する。
コード:
echo "disable" > /sys/firmware/acpi/interrupts/gpe6F exit 0最後にPCを再起動するとlogの増殖が止まっていることが確認できる。
要するに、ファームウェアの割り込み設定を無理やり変更して、ログを吐かないようにする荒技。
オフライン
#6
tshiihara による投稿:
でも 20.04 だと /etc/rc.local
って無いんですね。さてどうしよう。
/etc/rc.local を新規作成すれば Ubuntuが見つけて使ってくれます。
オフライン
elliptic による投稿:
#6
tshiihara による投稿:
でも 20.04 だと /etc/rc.local
って無いんですね。さてどうしよう。/etc/rc.local を新規作成すれば Ubuntuが見つけて使ってくれます。
ありがとうございます。
https://linuxmedium.com/how-to-enable-etc-rc-local-with-systemd-on-ubuntu-20-04/
を見ると
/etc/systemd/system/rc-local.service
を作って
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
を記載
それから
/etc/rc.local を作って
#!/bin/bash
echo "disable" > /sys/firmware/acpi/interrupts/gpe6F
exit 0
を記載
で
chmod +x /etc/rc.local
systemctl enable rc-local
reboot
と書いてありますが、それで良いのでしょうか?
オフライン
rc-local.serviceファイルは作らずに
#8
tshiihara による投稿:
/etc/rc.local を作って
#!/bin/bash
echo "disable" > /sys/firmware/acpi/interrupts/gpe6F
exit 0
を記載
で
chmod +x /etc/rc.local
systemctl enable rc-local
reboot
だけを実行してみて下さい。
Ubuntuにはもともと
/usr/lib/systemd/system/rc-local.service
が存在します。
普通は動いていませんが systemd-rc-local-generator が 実行可能な /etc/rc.local
を検出すると rc-local.serviceをスタートさせ、 rc-local.service が /etc/rc.local
を実行します。
man systemd-rc-local-generator
を参照して下さい。
オフライン
elliptic による投稿:
rc-local.serviceファイルは作らずに
#8tshiihara による投稿:
/etc/rc.local を作って
#!/bin/bash
echo "disable" > /sys/firmware/acpi/interrupts/gpe6F
exit 0
を記載
で
chmod +x /etc/rc.local
systemctl enable rc-local
rebootだけを実行してみて下さい。
Ubuntuにはもともと
/usr/lib/systemd/system/rc-local.service
が存在します。
普通は動いていませんが systemd-rc-local-generator が 実行可能な /etc/rc.local
を検出すると rc-local.serviceをスタートさせ、 rc-local.service が /etc/rc.local
を実行します。
man systemd-rc-local-generator
を参照して下さい。
ありがとうございます。職場のPCは 20.04クリーンインスツール
今は自宅で 18.04からアップデートした20.04 なのですが
$ cd /usr/lib/systemd/
takashi@takashi-H110M-S03:/usr/lib/systemd$ ls
boot system-environment-generators user-generators
catalog user user-preset
logind.conf.d user-environment-generators
/usr/lib/systemd/system/ というディレクトリがありませんでした。
オフライン
tshiihara による投稿:
elliptic による投稿:
rc-local.serviceファイルは作らずに
#8tshiihara による投稿:
/etc/rc.local を作って
#!/bin/bash
echo "disable" > /sys/firmware/acpi/interrupts/gpe6F
exit 0
を記載
で
chmod +x /etc/rc.local
systemctl enable rc-local
rebootだけを実行してみて下さい。
Ubuntuにはもともと
/usr/lib/systemd/system/rc-local.service
が存在します。
普通は動いていませんが systemd-rc-local-generator が 実行可能な /etc/rc.local
を検出すると rc-local.serviceをスタートさせ、 rc-local.service が /etc/rc.local
を実行します。
man systemd-rc-local-generator
を参照して下さい。ありがとうございます。職場のPCは 20.04クリーンインスツール
今は自宅で 18.04からアップデートした20.04 なのですが
$ cd /usr/lib/systemd/
takashi@takashi-H110M-S03:/usr/lib/systemd$ ls
boot system-environment-generators user-generators
catalog user user-preset
logind.conf.d user-environment-generators
/usr/lib/systemd/system/ というディレクトリがありませんでした。
$ man systemd-rc-local-generator
SYSTEMD-RC-LOCAL-GENERATORsystemd-rc-local-generaSYSTEMD-RC-LOCAL-GENERATOR(8)
NAME
systemd-rc-local-generator - Compatibility generator for starting
/etc/rc.local during boot
SYNOPSIS
/lib/systemd/system-generators/systemd-rc-local-generator
DESCRIPTION
systemd-rc-local-generator is a generator that checks whether
/etc/rc.local exists and is executable, and if it is pulls the
rc-local.service unit into the boot process. This unit is responsible
for running this script during late boot. Note that the script will be
run with slightly different semantics than the original System V
version, which was run "last" in the boot process, which is a concept
that does not translate to systemd. The script is run after
network.target, but in parallel with most other regular system
services.
以下略
/lib/systemd/system-generators/systemd-rc-local-generator
があれば大丈夫ということでしょうか?
オフライン
#10
tshiihara による投稿:
/usr/lib/systemd/system/ というディレクトリがありませんでした。
迷わせてしまってすみません。
そのPCでは
/lib/systemd/system/rc-local.service
として存在すると思います。 こちらが本来の位置でした。(忘れてた)
* Ubuntuでは 19.04のときに Merged-usr というシステム変更が行われ
/bin は /usr/bin へ
/lib は /usr/lib へ
/sbin は /usr/sbin への
シンボリックリンクになりました。
* 新規インストールした 20.04 LTSもこのスタイルになっているはずです。
* ただし 18.04 LTS から 20.04 LTS へ アップグレードした場合は この統合は
行われず /lib と /usr/lib は 別々にディレクトリのままです。
#11
tshiihara による投稿:
/lib/systemd/system-generators/systemd-rc-local-generator
があれば大丈夫ということでしょうか?
はい。
* 本来 systemdで管理されたlinuxは rc.local を使わない。
かわりに実行順や依存関係を定義したユニットを配置することで起動処理を行う。
* しかしUbuntuは 過去のシステムとの互換性を維持するための仕組みを用意してある。
これらが働けば、 /etc/rc.local を見つけたら システム起動時に実行してくれる。
と私は理解してます。
オフライン
elliptic による投稿:
#10
tshiihara による投稿:
/usr/lib/systemd/system/ というディレクトリがありませんでした。
迷わせてしまってすみません。
そのPCでは
/lib/systemd/system/rc-local.service
として存在すると思います。 こちらが本来の位置でした。(忘れてた)
* Ubuntuでは 19.04のときに Merged-usr というシステム変更が行われ
/bin は /usr/bin へ
/lib は /usr/lib へ
/sbin は /usr/sbin への
シンボリックリンクになりました。
* 新規インストールした 20.04 LTSもこのスタイルになっているはずです。
* ただし 18.04 LTS から 20.04 LTS へ アップグレードした場合は この統合は
行われず /lib と /usr/lib は 別々にディレクトリのままです。
#11tshiihara による投稿:
/lib/systemd/system-generators/systemd-rc-local-generator
があれば大丈夫ということでしょうか?はい。
* 本来 systemdで管理されたlinuxは rc.local を使わない。
かわりに実行順や依存関係を定義したユニットを配置することで起動処理を行う。
* しかしUbuntuは 過去のシステムとの互換性を維持するための仕組みを用意してある。
これらが働けば、 /etc/rc.local を見つけたら システム起動時に実行してくれる。
と私は理解してます。
丁寧にありがとうございます。
$ grep . -r /sys/firmware/acpi/interrupts/
の一部
/sys/firmware/acpi/interrupts/gpe6F: 460570 STS enabled unmasked
を確認
$ sudo gedit /etc/systemd/journald.conf
$ sudo gedit /etc/logrotate.conf
上記の変更した部分をもとに戻してから
$ cat /etc/rc.local
#!/bin/bash
echo "disable" > /sys/firmware/acpi/interrupts/gpe6F
exit 0
のように rc.local 作って
$ ls -l /etc/rc.local
-rw-r--r-- 1 root root 72 10月 22 08:51 /etc/rc.local
$ sudo chmod +x /etc/rc.local
$ ls -l /etc/rc.local
-rwxr-xr-x 1 root root 72 10月 22 08:51 /etc/rc.local
$ sudo systemctl enable rc-local
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
instance name specified.
のあと再起動
$ grep . -r /sys/firmware/acpi/interrupts/
/sys/firmware/acpi/interrupts/gpe6F: 0 disabled unmasked
となってたので、意図通りに動いてそうです。
詳しく教えていただいて、ありがとうございました。
オフライン