Bug 256253 - Issues with /etc/periodic/daily/221.backup-gpart
Summary: Issues with /etc/periodic/daily/221.backup-gpart
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Alan Somers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-30 05:04 UTC by Xin LI
Modified: 2022-01-24 00:33 UTC (History)
2 users (show)

See Also:
delphij: mfc-stable13+
delphij: mfc-stable12+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xin LI freebsd_committer freebsd_triage 2021-05-30 05:04:02 UTC
I have noticed a few issues with 221.backup-gpart and this is a note so they are not forgotten.

1) The backup is not very useful for jailed environment and should be skipped there.

2) The current implementation is quite chatty.  When there is no change to partition table, it's better to remain silent instead of printing messages in the output.
Comment 1 Alan Somers freebsd_committer freebsd_triage 2021-06-01 15:13:28 UTC
Ditto what Xin Li said about jails.  This script emails an error every night in every jail.  The command that fails is "rotate boot.vtbd0p1".  But really, the entire script should be skipped in jailed environments.  It doesn't do anything useful there.
Comment 2 Miroslav Lachman 2021-06-01 22:45:22 UTC
(In reply to Alan Somers from comment #1)
Where should it be handled? I don't think the script 221.backup-gpart is the right place to unconditionally skip something just because it is in jail. I think the better place is to change default if jailed. 
For example in /etc/defaults/periodic.conf do something like this

if [ $(sysctl -n security.jail.jailed) = 0 ]; then
	daily_backup_gpart_enable="YES"
else
	daily_backup_gpart_enable="NO"
fi
Comment 3 Alan Somers freebsd_committer freebsd_triage 2021-06-01 22:47:10 UTC
Miroslav, that could work.  It would have the advantage of allowing somebody to enable the periodic script in a jail, if he really wanted to for some weird reason.
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-06-18 14:36:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=fcf2227a557552e45646bbcf2422a98baab5c8a8

commit fcf2227a557552e45646bbcf2422a98baab5c8a8
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2021-06-18 14:33:08 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2021-06-18 14:36:09 +0000

    periodic: by default, skip 221.backup-gpart in jails

    It can still be enabled as usual in /etc/periodic.conf

    PR:             256253
    Reported by:    delphij
    Submitted by:   Miroslav Lachman <000.fbsd@quip.cz>
    MFC after:      2 weeks

 usr.sbin/periodic/periodic.conf | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2021-07-04 02:31:12 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=fd5b08977630dc8279cfa7ab955f90c4d723a1b7

commit fd5b08977630dc8279cfa7ab955f90c4d723a1b7
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2021-06-18 14:33:08 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2021-07-04 02:30:05 +0000

    periodic: by default, skip 221.backup-gpart in jails

    It can still be enabled as usual in /etc/periodic.conf

    PR:             256253
    Reported by:    delphij
    Submitted by:   Miroslav Lachman <000.fbsd@quip.cz>

    (cherry picked from commit fcf2227a557552e45646bbcf2422a98baab5c8a8)

 usr.sbin/periodic/periodic.conf | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-10-07 19:45:57 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8461b8f7efa2ea118e19e6702dd3a3f1de9b1a69

commit 8461b8f7efa2ea118e19e6702dd3a3f1de9b1a69
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2021-06-18 14:33:08 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2021-10-07 19:45:32 +0000

    periodic: by default, skip 221.backup-gpart in jails

    It can still be enabled as usual in /etc/periodic.conf

    PR:             256253
    Reported by:    delphij
    Submitted by:   Miroslav Lachman <000.fbsd@quip.cz>

    (cherry picked from commit fcf2227a557552e45646bbcf2422a98baab5c8a8)

 usr.sbin/periodic/periodic.conf | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)