Intense I/O: found pkg and find running at night

Last night at about 3am I noticed my server doing a lot of I/O. Top showed first pkg then find being run by root (not in a jail). After several minutes they stopped. Is there a periodic task that is supposed to run those processes? All my services run inside jails. Root has no crontab. Running FreeBSD 13.1-RELEASE-p5.
 
I just disabled the security stuff in /etc/periodic.conf
Code:
daily_status_security_enable="NO"            # Security check
monthly_status_security_enable="NO"            # Security check
security_status_logincheck_enable="NO"
weekly_status_security_enable="NO"            # Security check
 
Several other people already hinted at this:

All my services run inside jails. Root has no crontab.

Periodic is not a service, it is run from the crontab in /etc/crontab. It is not vital (the system won't crash without it), but everything in there is a good idea and there for a reason, even the security audits. You might want to think about re-enabling it.
 
So you removed the default /etc/crontab ?
I take the "root has no crontab" to mean that /etc/crontab simply doesn't have entries for tasks to be run by user root. And it probably shouldn't, it's not a good practice to have root run much of anything from crontab. There are special daemon accounts for that.

Having pkg process run by root, esp. not in a jail, in the middle of the night - that's a cause for concern, even if it were done deliberately by OP (and it's definitely not deliberate). Such things should be programmed with intent, and monitored to make sure they don't have an un-intended effect... in short, some paranoia is justifiable here.
 
I take the "root has no crontab" to mean that /etc/crontab simply doesn't have entries for tasks to be run by user root.
Yes, that was badly worded. I meant that I haven't added anything to root's crontab. My `/etc/crontab` is pristine.

Thanks for pointing to the security audits—it was probably setuid checks. Where do I find when those tasks are run? Well, I think I can do some homework and find it myself ?.

This community never disappoints!
 
Where do I find when those tasks are run?
periodic(8):
Code:
# Perform daily/weekly/monthly maintenance.
1       3       *       *       *       root    periodic daily
15      4       *       *       6       root    periodic weekly
30      5       1       *       *       root    periodic monthly

If you have a lot of jails running, it'll be a good idea to move the timing around a bit. That way they won't all start at the same time and choke the system.
 
Last night at about 3am I noticed my server doing a lot of I/O. Top showed first pkg then find being run by root (not in a jail). After several minutes they stopped. Is there a periodic task that is supposed to run those processes?
I've notice the same on my system. It was after midnight, early in the morning when I heard the laptops fan begun to spun up. top(1) showed pkg(8) using a lot of WCPU. Thereafter I saw xz(1) doing the same.

grep(1)ing "pkg" and "xz" through /etc/periodic didn't return anything, but /usr/local/etc/periodic got a hit on /usr/local/etc/periodic/daily/411.pkg-backup.

That script backs up the pkg sql database.

/var/backup
Code:
-rw-r--r--  1 root  wheel   6.5M Feb 28 03:40 pkg.sql.xz
-rw-r--r--  1 root  wheel   6.5M Feb 24 03:17 pkg.sql.xz.1
-rw-r--r--  1 root  wheel   6.1M Feb 23 03:02 pkg.sql.xz.2
-rw-r--r--  1 root  wheel   6.1M Feb 22 03:02 pkg.sql.xz.3
-rw-r--r--  1 root  wheel   6.1M Feb 21 03:18 pkg.sql.xz.4
-rw-r--r--  1 root  wheel   6.1M Feb 16 03:02 pkg.sql.xz.5
-rw-r--r--  1 root  wheel   6.1M Feb 15 03:29 pkg.sql.xz.6
-rw-r--r--  1 root  wheel   6.1M Feb 10 03:02 pkg.sql.xz.7
Note the time of the timestamps, which matches the periodic daily in /etc/crontab
Code:
1       3       *       *       *       root    periodic daily

However, the file size is to small to justify a high CPU usage. Probably all under /usr/local/etc/periodic/security pkg scripts are run as well:
Code:
405.pkg-base-audit
410.pkg-audit
460.pkg-checksum
All three have daily periods specified.
 
So you removed the default /etc/crontab ?
I consider /etc/crontab to be the system's crontab. Each user has it's own crontab; crontab -e. And root is just a user account, with its own individual crontab. Those are stored in /var/cron/tabs/. periodic(8) gets started via the system's crontab; /etc/crontab.
 
I consider /etc/crontab to be the system's crontab. Each user has it's own crontab; crontab -e. And root is just a user account, with its own individual crontab. Those are stored in /var/cron/tabs/. periodic(8) gets started via the system's crontab; /etc/crontab.
Yeah, but wouldn't that "user crontab" only run while the user is actually logged in? (Well, one workaround is to run it in a /usr/local/bin/screen session, which would be useful (but has security implications) if one has a remote VPS :P )
 
sorry. Edited. Exceptions apply, for example that insane systemd change where they killed all user processes when the user logged out. Who knows what they did to the crontabs in that version.
 
Back
Top