/usr/sbin
NameSizeModeActions
accessdb157920755editdlrm
addgnupghome30790755editdlrm
addpart155200755editdlrm
adduser1411440755editdlrm
agetty580720755editdlrm
alternatives405440755editdlrm
anacron404640755editdlrm
apachectl48080755editdlrm
applygnupgdefaults22210755editdlrm
arp647280755editdlrm
arping279040755editdlrm
arptables2369600755editdlrm
arptables-nft2369600755editdlrm
arptables-nft-restore2369600755editdlrm
arptables-nft-save2369600755editdlrm
arptables-restore2369600755editdlrm
arptables-save2369600755editdlrm
atd320080755editdlrm
atrun700755editdlrm
auditctl528240755editdlrm
auditd1403360755editdlrm
augenrules41460755editdlrm
aureport1231920755editdlrm
ausearch1231600755editdlrm
autrace196320750editdlrm
avcstat157200755editdlrm
badblocks362000755editdlrm
blkdeactivate163550555editdlrm
blkdiscard237600755editdlrm
blkid528480755editdlrm
blkmapd403600755editdlrm
blkzone363040755editdlrm
blockdev321680755editdlrm
bridge1340880755editdlrm
cache_check30462960755editdlrm
cache_dump30462960755editdlrm
cache_metadata_size30462960755editdlrm
cache_repair30462960755editdlrm
cache_restore30462960755editdlrm
cache_writeback30462960755editdlrm
capsh319600755editdlrm
cfdisk986560755editdlrm
chcpu321760755editdlrm
chgpasswd612000755editdlrm
chkconfig448320755editdlrm
chpasswd569680755editdlrm
chronyd3825440755editdlrm
chroot405040755editdlrm
clock612000755editdlrm
consoletype156480755editdlrm
convertquota706640755editdlrm
cracklib-check154720755editdlrm
cracklib-format2550755editdlrm
cracklib-packer154720755editdlrm
cracklib-unpacker154640755editdlrm
create-cracklib-dict9940755editdlrm
crond779920755editdlrm
ctrlaltdel155520755editdlrm
ctstat241600755editdlrm
dcb969600755editdlrm
ddns-confgen279120755editdlrm
debugfs2386240755editdlrm
delpart154800755editdlrm
depmod1695440755editdlrm
devlink1698160755editdlrm
dmeventd530320555editdlrm
dmfilemapd238560555editdlrm
dmsetup1605360555editdlrm
dmstats1605360555editdlrm
dnssec-cds488160755editdlrm
dnssec-checkds9240755editdlrm
dnssec-coverage9260755editdlrm
dnssec-dsfromkey403840755editdlrm
dnssec-importkey362880755editdlrm
dnssec-keyfromlabel403680755editdlrm
dnssec-keygen485840755editdlrm
dnssec-keymgr9220755editdlrm
dnssec-revoke321680755editdlrm
dnssec-settime485760755editdlrm
dnssec-signzone981840755editdlrm
dnssec-verify322000755editdlrm
dosfsck865920755editdlrm
dosfslabel409760755editdlrm
dovecot1474800755editdlrm
dovecot_cpshutdown33440755editdlrm
dpll493120755editdlrm
dumpe2fs320400755editdlrm
e2freefrag155520755editdlrm
e2fsck3646320755editdlrm
e2image444560755editdlrm
e2label1069680755editdlrm
e2mmpstatus320400755editdlrm
e2undo237120755editdlrm
e4crypt320480755editdlrm
e4defrag320080755editdlrm
ebtables2369600755editdlrm
ebtables-nft2369600755editdlrm
ebtables-nft-restore2369600755editdlrm
ebtables-nft-save2369600755editdlrm
ebtables-restore2369600755editdlrm
ebtables-save2369600755editdlrm
ebtables-translate2369600755editdlrm
edquota916480755editdlrm
efibootdump244400755editdlrm
efibootmgr462640755editdlrm
era_check30462960755editdlrm
era_dump30462960755editdlrm
era_invalidate30462960755editdlrm
era_restore30462960755editdlrm
ether-wake514480755editdlrm
ethtool10126960755editdlrm
exicyclog113650755editdlrm
exigrep117100755editdlrm
exim17288484755editdlrm
eximstats1525460755editdlrm
exim_checkaccess49430755editdlrm
exim_dbmbuild230400755editdlrm
exim_dumpdb418720755editdlrm
exim_fixdb463600755editdlrm
exim_lock233280755editdlrm
exim_tidydb334720755editdlrm
exinext82170755editdlrm
exiqgrep67390755editdlrm
exiqsumm64430755editdlrm
exiwhat45240755editdlrm
exportfs701120755editdlrm
faillock237360755editdlrm
fatlabel409760755editdlrm
fcgistarter253040755editdlrm
fdformat237440755editdlrm
fdisk1147600755editdlrm
filefrag196800755editdlrm
findfs155200755editdlrm
firewalld99890755editdlrm
fix-info-dir80370755editdlrm
fixfiles123870755editdlrm
fsadm246020555editdlrm
fsck445920755editdlrm
fsck.cramfs321280755editdlrm
fsck.ext23646320755editdlrm
fsck.ext33646320755editdlrm
fsck.ext43646320755editdlrm
fsck.fat865920755editdlrm
fsck.minix570480755editdlrm
fsck.msdos865920755editdlrm
fsck.vfat865920755editdlrm
fsck.xfs25980755editdlrm
fsfreeze155120755editdlrm
fstrim445440755editdlrm
fuser420720755editdlrm
g13-syshelp907280755editdlrm
genhomedircon328080755editdlrm
genhostid156480755editdlrm
genl1332720755editdlrm
getcap154960755editdlrm
getenforce156400755editdlrm
getpcaps154880755editdlrm
getpidprevcon156560755editdlrm
getpolicyload156480755editdlrm
getsebool156640755editdlrm
groupadd704240755editdlrm
groupdel660800755editdlrm
groupmems571120755editdlrm
groupmod745040755editdlrm
grpck611920755editdlrm
grpconv528000755editdlrm
grpunconv527680755editdlrm
grub2-bios-setup17499040755editdlrm
grub2-get-kernel-settings27460755editdlrm
grub2-install20685200755editdlrm
grub2-macbless17288720755editdlrm
grub2-mkconfig94310755editdlrm
grub2-probe17459840755editdlrm
grub2-reboot48140755editdlrm
grub2-set-bootflag154564755editdlrm
grub2-set-default35380755editdlrm
grub2-set-password28090755editdlrm
grub2-setpassword28090755editdlrm
grub2-switch-to-blscfg90240755editdlrm
grubby2600755editdlrm
gssproxy1278880755editdlrm
halt3055760755editdlrm
htcacheclean540720755editdlrm
httpd11397200755editdlrm
hwclock612000755editdlrm
iconvconfig324320755editdlrm
ifconfig808800755editdlrm
ifdown10970755editdlrm
ifenslave243040755editdlrm
ifstat405520755editdlrm
ifup10660755editdlrm
imunify-notifier103256160755editdlrm
init980400755editdlrm
insmod1695440755editdlrm
install-info1092560755editdlrm
installkernel3230755editdlrm
intel_sdsi229680755editdlrm
ip7929040755editdlrm
ip6tables2369600755editdlrm
ip6tables-nft2369600755editdlrm
ip6tables-nft-restore2369600755editdlrm
ip6tables-nft-save2369600755editdlrm
ip6tables-restore2369600755editdlrm
ip6tables-restore-translate2369600755editdlrm
ip6tables-save2369600755editdlrm
ip6tables-translate2369600755editdlrm
ipmaddr199120755editdlrm
ipset156400755editdlrm
ipset-translate156400755editdlrm
iptables2369600755editdlrm
iptables-nft2369600755editdlrm
iptables-nft-restore2369600755editdlrm
iptables-nft-save2369600755editdlrm
iptables-restore2369600755editdlrm
iptables-restore-translate2369600755editdlrm
iptables-save2369600755editdlrm
iptables-translate2369600755editdlrm
iptunnel199680755editdlrm
irqbalance659920755editdlrm
irqbalance-ui405360755editdlrm
kexec1972160755editdlrm
key.dns_resolver321040755editdlrm
kpartx486640755editdlrm
lchage237200755editdlrm
ldattach278800755editdlrm
ldconfig11764640755editdlrm
lgroupadd154800755editdlrm
lgroupdel154720755editdlrm
lgroupmod236800755editdlrm
lid195920755editdlrm
lnewusers236800755editdlrm
lnstat241600755editdlrm
load_policy154800755editdlrm
logrotate979600755editdlrm
logsave155520755editdlrm
losetup738160755editdlrm
lpasswd236800755editdlrm
lshw8740640755editdlrm
lsmod1695440755editdlrm
lspci999120755editdlrm
luseradd236800755editdlrm
luserdel154800755editdlrm
lusermod236880755editdlrm
lvchange28310720555editdlrm
lvconvert28310720555editdlrm
lvcreate28310720555editdlrm
lvdisplay28310720555editdlrm
lvextend28310720555editdlrm
lvm28310720555editdlrm
lvmconfig28310720555editdlrm
lvmdevices28310720555editdlrm
lvmdiskscan28310720555editdlrm
lvmdump103780555editdlrm
lvmpolld2153440555editdlrm
lvmsadc28310720555editdlrm
lvmsar28310720555editdlrm
lvm_import_vdo237080555editdlrm
lvreduce28310720555editdlrm
lvremove28310720555editdlrm
lvrename28310720555editdlrm
lvresize28310720555editdlrm
lvs28310720555editdlrm
lvscan28310720555editdlrm
makedumpfile4422080755editdlrm
matchpathcon156800755editdlrm
mii-diag247760755editdlrm
mii-tool284480755editdlrm
mkdict2550755editdlrm
mkdosfs537680755editdlrm
mkdumprd124180755editdlrm
mke2fs1357120755editdlrm
mkfs155360755editdlrm
mkfs.cramfs362240755editdlrm
mkfs.ext21357120755editdlrm
mkfs.ext31357120755editdlrm
mkfs.ext41357120755editdlrm
mkfs.fat537680755editdlrm
mkfs.minix446000755editdlrm
mkfs.msdos537680755editdlrm
mkfs.vfat537680755editdlrm
mkfs.xfs4615920755editdlrm
mkhomedir_helper237680755editdlrm
mklost+found154800755editdlrm
mksquashfs2023600755editdlrm
mkswap486400755editdlrm
modinfo1695440755editdlrm
modprobe1695440755editdlrm
modsec-sdbm-util343680750editdlrm
mount.fuse157040755editdlrm
mount.fuse3198320755editdlrm
mount.nfs1029364755editdlrm
mount.nfs41029364755editdlrm
mountstats435190755editdlrm
mysqld566875760755editdlrm
named5581040755editdlrm
named-checkconf403440755editdlrm
named-checkzone402880755editdlrm
named-compilezone402880755editdlrm
named-journalprint154960755editdlrm
named-nzd2nzf154800755editdlrm
nameif159520755editdlrm
NetworkManager38939280755editdlrm
newusers908320755editdlrm
nfsconf408160755editdlrm
nfsdcld572080755editdlrm
nfsdclddb102300755editdlrm
nfsdclnts92710755editdlrm
nfsdcltrack408720755editdlrm
nfsidmap238560755editdlrm
nfsiostat239100755editdlrm
nfsref445600755editdlrm
nfsstat391920755editdlrm
nft278240755editdlrm
nologin155200755editdlrm
nscd1668560755editdlrm
nsec3hash155600755editdlrm
nstat320880755editdlrm
packer154720755editdlrm
pam_console_apply445520755editdlrm
pam_namespace_helper4710755editdlrm
pam_timestamp_check154964755editdlrm
paperconfig41730755editdlrm
parted987040755editdlrm
partprobe157040755editdlrm
partx612000755editdlrm
pdata_tools30462960755editdlrm
pdns_server61628000755editdlrm
pidof238880755editdlrm
ping914720755editdlrm
ping6914720755editdlrm
pivot_root155200755editdlrm
plipconfig157200755editdlrm
poweroff3055760755editdlrm
pure-authd235680755editdlrm
pure-certd234720755editdlrm
pure-config.pl47550755editdlrm
pure-ftpd1813760755editdlrm
pure-ftpwho272160755editdlrm
pure-mrtginfo148960755editdlrm
pure-quotacheck231040755editdlrm
pure-uploadscript233760755editdlrm
pvchange28310720555editdlrm
pvck28310720555editdlrm
pvcreate28310720555editdlrm
pvdisplay28310720555editdlrm
pvmove28310720555editdlrm
pvremove28310720555editdlrm
pvresize28310720555editdlrm
pvs28310720555editdlrm
pvscan28310720555editdlrm
pwck569360755editdlrm
pwconv485840755editdlrm
pwhistory_helper196560755editdlrm
pwunconv485440755editdlrm
quotacheck958640755editdlrm
quotaoff580320755editdlrm
quotaon580320755editdlrm
quotastats157040755editdlrm
rdisc321120755editdlrm
rdma1198720755editdlrm
readprofile238240755editdlrm
reboot3055760755editdlrm
repquota794160755editdlrm
request-key279440755editdlrm
resize2fs692640755editdlrm
resizepart239600755editdlrm
restorecon237440755editdlrm
restorecon_xattr154880755editdlrm
rfkill320960755editdlrm
rmmod1695440755editdlrm
rndc442880755editdlrm
rndc-confgen238160755editdlrm
rotatelogs390480755editdlrm
route673520755editdlrm
rpc.gssd902240755editdlrm
rpc.idmapd488800755editdlrm
rpc.mountd1357360755editdlrm
rpc.nfsd409600755editdlrm
rpc.statd827280755editdlrm
rpcbind613280755editdlrm
rpcctl96450755editdlrm
rpcdebug191040755editdlrm
rpcinfo364320755editdlrm
rsyslogd8262400755editdlrm
rtacct300480755editdlrm
rtcwake361040755editdlrm
rtkitctl156080755editdlrm
rtmon1290800755editdlrm
rtstat241600755editdlrm
runlevel3055760755editdlrm
runq17288484755editdlrm
runuser569440755editdlrm
sasldblistusers2156400755editdlrm
saslpasswd2156080755editdlrm
sefcontext_compile741200755editdlrm
selabel_digest156800755editdlrm
selabel_get_digests_all_partial_matches156960755editdlrm
selabel_lookup156720755editdlrm
selabel_lookup_best_match156800755editdlrm
selabel_partial_match156720755editdlrm
selinuxconlist156720755editdlrm
selinuxdefcon156720755editdlrm
selinuxenabled156400755editdlrm
selinuxexeccon156560755editdlrm
selinux_check_access156800755editdlrm
semanage416140755editdlrm
semodule328080755editdlrm
sendmail185122755editdlrm
service46230755editdlrm
sestatus236800755editdlrm
setcap154880755editdlrm
setenforce156640755editdlrm
setfiles237440755editdlrm
setpci321040755editdlrm
setquota835360755editdlrm
setsebool196080755editdlrm
sfdisk1064800755editdlrm
showmount158480755editdlrm
shutdown3055760755editdlrm
slattach384720755editdlrm
sm-notify530160755editdlrm
smartctl8743280755editdlrm
smartd6302400755editdlrm
ss1344720755editdlrm
sshd4166640755editdlrm
sssd733280755editdlrm
sss_cache360960755editdlrm
start-statd10270755editdlrm
start-stop-daemon498160755editdlrm
suexec385044755editdlrm
sulogin444400755editdlrm
sw-engine-fpm253146800755editdlrm
swaplabel196480755editdlrm
swapoff238240755editdlrm
swapon443520755editdlrm
switch_root237600755editdlrm
sysctl322480755editdlrm
tc6554560755editdlrm
tcpdump13402560755editdlrm
tcpslice280480755editdlrm
telinit3055760755editdlrm
thin_check30462960755editdlrm
thin_delta30462960755editdlrm
thin_dump30462960755editdlrm
thin_ls30462960755editdlrm
thin_metadata_pack30462960755editdlrm
thin_metadata_size30462960755editdlrm
thin_metadata_unpack30462960755editdlrm
thin_migrate30462960755editdlrm
thin_repair30462960755editdlrm
thin_restore30462960755editdlrm
thin_rmap30462960755editdlrm
thin_trim30462960755editdlrm
tipc950240755editdlrm
tmpwatch368960755editdlrm
tracepath196800755editdlrm
tracepath6196800755editdlrm
tsig-keygen279120755editdlrm
tune2fs1069680755editdlrm
udevadm6019600755editdlrm
umount.nfs1029364755editdlrm
umount.nfs41029364755editdlrm
unix_chkpwd238484755editdlrm
unix_update320800700editdlrm
unsquashfs1165360755editdlrm
update-alternatives405440755editdlrm
update-pciids17570755editdlrm
update-smart-drivedb238850755editdlrm
useradd1411440755editdlrm
userdel909680755editdlrm
usermod1327760755editdlrm
validatetrans156560755editdlrm
vdpa367360755editdlrm
vgcfgbackup28310720555editdlrm
vgcfgrestore28310720555editdlrm
vgchange28310720555editdlrm
vgck28310720555editdlrm
vgconvert28310720555editdlrm
vgcreate28310720555editdlrm
vgdisplay28310720555editdlrm
vgexport28310720555editdlrm
vgextend28310720555editdlrm
vgimport28310720555editdlrm
vgimportclone28310720555editdlrm
vgimportdevices28310720555editdlrm
vgmerge28310720555editdlrm
vgmknodes28310720555editdlrm
vgreduce28310720555editdlrm
vgremove28310720555editdlrm
vgrename28310720555editdlrm
vgs28310720555editdlrm
vgscan28310720555editdlrm
vgsplit28310720555editdlrm
vigr595520755editdlrm
vipw595520755editdlrm
visudo2736800755editdlrm
vmcore-dmesg279520755editdlrm
weak-modules343840755editdlrm
whmapi034781120755editdlrm
whmapi134781120755editdlrm
whmlogin23900755editdlrm
wipefs402240755editdlrm
xfs_admin21780755editdlrm
xfs_bmap6990755editdlrm
xfs_copy948400755editdlrm
xfs_db7250720755editdlrm
xfs_estimate155280755editdlrm
xfs_freeze8040755editdlrm
xfs_fsr445520755editdlrm
xfs_growfs446800755editdlrm
xfs_info12980755editdlrm
xfs_io2074560755editdlrm
xfs_logprint903760755editdlrm
xfs_mdrestore279360755editdlrm
xfs_metadump7860755editdlrm
xfs_mkfile10440755editdlrm
xfs_ncheck6890755editdlrm
xfs_quota943120755editdlrm
xfs_repair7027040755editdlrm
xfs_rtcp196000755editdlrm
xfs_spaceman448320755editdlrm
xqmstats156960755editdlrm
xtables-monitor2369600755editdlrm
xtables-nft-multi2369600755editdlrm
zic610560755editdlrm
zramctl572080755editdlrm
Edit: /usr/sbin/mkdumprd (12418B)
#!/usr/bin/bash --norc # New mkdumprd # # Copyright 2011 Red Hat, Inc. # # Written by Cong Wang # if [[ -f /etc/sysconfig/kdump ]]; then . /etc/sysconfig/kdump fi [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut . $dracutbasedir/dracut-functions.sh . /lib/kdump/kdump-lib.sh . /lib/kdump/kdump-logger.sh export IN_KDUMP=1 #initiate the kdump logger if ! dlog_init; then echo "failed to initiate the kdump logger." exit 1 fi SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" SAVE_PATH=$(get_save_path) OVERRIDE_RESETTABLE=0 extra_modules="" dracut_args=(--quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict --hostonly-nics '') MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)" [ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed." MKDUMPRD_TMPMNT="$MKDUMPRD_TMPDIR/target" trap ' ret=$?; is_mounted $MKDUMPRD_TMPMNT && umount -f $MKDUMPRD_TMPMNT; [[ -d $MKDUMPRD_TMPDIR ]] && rm --one-file-system -rf -- "$MKDUMPRD_TMPDIR"; exit $ret; ' EXIT # clean up after ourselves no matter how we die. trap 'exit 1;' SIGINT add_dracut_arg() { dracut_args+=("$@") } add_dracut_mount() { add_dracut_arg "--mount" "$1" } add_dracut_sshkey() { add_dracut_arg "--sshkey" "$1" } # caller should ensure $1 is valid and mounted in 1st kernel to_mount() { local _target=$1 _fstype=$2 _options=$3 _sed_cmd _new_mntpoint _pdev _new_mntpoint=$(get_kdump_mntpoint_from_target "$_target") _fstype="${_fstype:-$(get_fs_type_from_target "$_target")}" _options="${_options:-$(get_mntopt_from_target "$_target")}" _options="${_options:-defaults}" if [[ $_fstype == "nfs"* ]]; then _pdev=$_target _sed_cmd+='s/,\(mount\)\?addr=[^,]*//g;' _sed_cmd+='s/,\(mount\)\?proto=[^,]*//g;' _sed_cmd+='s/,clientaddr=[^,]*//;' else # for non-nfs _target converting to use udev persistent name _pdev="$(kdump_get_persistent_dev "$_target")" if [[ -z $_pdev ]]; then return 1 fi fi # mount fs target as rw in 2nd kernel _sed_cmd+='s/\(^\|,\)ro\($\|,\)/\1rw\2/g;' # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd # kernel, filter it out here. _sed_cmd+='s/\(^\|,\)noauto\($\|,\)/\1/g;' # drop nofail or nobootwait _sed_cmd+='s/\(^\|,\)nofail\($\|,\)/\1/g;' _sed_cmd+='s/\(^\|,\)nobootwait\($\|,\)/\1/g;' _options=$(echo "$_options" | sed "$_sed_cmd") echo "$_pdev $_new_mntpoint $_fstype $_options" } #Function: get_ssh_size #$1=dump target #called from while loop and shouldn't read from stdin, so we're using "ssh -n" get_ssh_size() { local _out local _opt=("-i" "$SSH_KEY_LOCATION" "-o" "BatchMode=yes" "-o" "StrictHostKeyChecking=yes") if ! _out=$(ssh -q -n "${_opt[@]}" "$1" "df" "--output=avail" "$SAVE_PATH"); then perror_exit "checking remote ssh server available size failed." fi echo -n "$_out" | tail -1 } #mkdir if save path does not exist on ssh dump target #$1=ssh dump target #caller should ensure write permission on $1:$SAVE_PATH #called from while loop and shouldn't read from stdin, so we're using "ssh -n" mkdir_save_path_ssh() { local _opt _dir _opt=(-i "$SSH_KEY_LOCATION" -o BatchMode=yes -o StrictHostKeyChecking=yes) ssh -qn "${_opt[@]}" "$1" mkdir -p "$SAVE_PATH" &> /dev/null || perror_exit "mkdir failed on $1:$SAVE_PATH" # check whether user has write permission on $1:$SAVE_PATH _dir=$(ssh -qn "${_opt[@]}" "$1" mktemp -dqp "$SAVE_PATH" 2> /dev/null) || perror_exit "Could not create temporary directory on $1:$SAVE_PATH. Make sure user has write permission on destination" ssh -qn "${_opt[@]}" "$1" rmdir "$_dir" return 0 } #Function: get_fs_size #$1=dump target get_fs_size() { df --output=avail "$(get_mntpoint_from_target "$1")/$SAVE_PATH" | tail -1 } #Function: get_raw_size #$1=dump target get_raw_size() { fdisk -s "$1" } #Function: check_size #$1: dump type string ('raw', 'fs', 'ssh') #$2: dump target check_size() { local avail memtotal memtotal=$(awk '/MemTotal/{print $2}' /proc/meminfo) case "$1" in raw) avail=$(get_raw_size "$2") ;; ssh) avail=$(get_ssh_size "$2") ;; fs) avail=$(get_fs_size "$2") ;; *) return ;; esac || perror_exit "Check dump target size failed" if [[ $avail -lt $memtotal ]]; then dwarn "Warning: There might not be enough space to save a vmcore." dwarn " The size of $2 should be greater than $memtotal kilo bytes." fi } check_save_path_fs() { local _path=$1 if [[ ! -d $_path ]]; then perror_exit "Dump path $_path does not exist." fi } mount_failure() { local _target=$1 local _mnt=$2 local _fstype=$3 local msg="Failed to mount $_target" if [[ -n $_mnt ]]; then msg="$msg on $_mnt" fi msg="$msg for kdump preflight check." if [[ $_fstype == "nfs" ]]; then msg="$msg Please make sure nfs-utils has been installed." fi perror_exit "$msg" } check_user_configured_target() { local _target=$1 _cfg_fs_type=$2 _mounted local _mnt _opt _fstype _mnt=$(get_mntpoint_from_target "$_target") _opt=$(get_mntopt_from_target "$_target") _fstype=$(get_fs_type_from_target "$_target") if [[ -n $_fstype ]]; then # In case of nfs4, nfs should be used instead, nfs* options is deprecated in kdump.conf [[ $_fstype == "nfs"* ]] && _fstype=nfs if [[ -n $_cfg_fs_type ]] && [[ $_fstype != "$_cfg_fs_type" ]]; then perror_exit "\"$_target\" have a wrong type config \"$_cfg_fs_type\", expected \"$_fstype\"" fi else _fstype="$_cfg_fs_type" _fstype="$_cfg_fs_type" fi # For noauto mount, mount it inplace with default value. # Else use the temporary target directory if [[ -n $_mnt ]]; then if ! is_mounted "$_mnt"; then if [[ $_opt == *",noauto"* ]]; then mount "$_mnt" || mount_failure "$_target" "$_mnt" "$_fstype" _mounted=$_mnt else perror_exit "Dump target \"$_target\" is neither mounted nor configured as \"noauto\"" fi fi else _mnt=$MKDUMPRD_TMPMNT mkdir -p "$_mnt" mount "$_target" "$_mnt" -t "$_fstype" -o defaults || mount_failure "$_target" "" "$_fstype" _mounted=$_mnt fi # For user configured target, use $SAVE_PATH as the dump path within the target if [[ ! -d "$_mnt/$SAVE_PATH" ]]; then perror_exit "Dump path \"$SAVE_PATH\" does not exist in dump target \"$_target\"" fi check_size fs "$_target" # Unmount it early, if function is interrupted and didn't reach here, the shell trap will clear it up anyway if [[ -n $_mounted ]]; then umount -f -- "$_mounted" fi } # $1: core_collector config value verify_core_collector() { local _cmd="${1%% *}" local _params="${1#${_cmd}}" if [[ $_cmd != "makedumpfile" ]]; then if is_raw_dump_target; then dwarn "Warning: specifying a non-makedumpfile core collector, you will have to recover the vmcore manually." fi return fi if is_ssh_dump_target || is_raw_dump_target; then if ! strstr "$_params" "-F"; then perror_exit 'The specified dump target needs makedumpfile "-F" option.' fi _params="$_params vmcore" else _params="$_params vmcore dumpfile" fi # shellcheck disable=SC2086 if ! $_cmd --check-params $_params; then perror_exit "makedumpfile parameter check failed." fi } add_mount() { local _mnt _mnt=$(to_mount "$@") || exit 1 add_dracut_mount "$_mnt" } #handle the case user does not specify the dump target explicitly handle_default_dump_target() { local _target local _mntpoint is_user_configured_dump_target && return check_save_path_fs "$SAVE_PATH" _save_path=$(get_bind_mount_source "$SAVE_PATH") _target=$(get_target_from_path "$_save_path") _mntpoint=$(get_mntpoint_from_target "$_target") SAVE_PATH=${_save_path##"$_mntpoint"} add_mount "$_target" check_size fs "$_target" } # $1: function name for_each_block_target() { local dev majmin for dev in $(get_kdump_targets); do [[ -b $dev ]] || continue majmin=$(get_maj_min "$dev") check_block_and_slaves "$1" "$majmin" && return 1 done return 0 } #judge if a specific device with $1 is unresettable #return false if unresettable. is_unresettable() { local path device resettable=1 path="/sys/$(udevadm info --query=all --path="/sys/dev/block/$1" | awk '/^P:/ {print $2}' | sed -e 's/\(cciss[0-9]\+\/\).*/\1/g' -e 's/\/block\/.*$//')/resettable" if [[ -f $path ]]; then resettable="$(< "$path")" [[ $resettable -eq 0 ]] && [[ $OVERRIDE_RESETTABLE -eq 0 ]] && { device=$(udevadm info --query=all --path="/sys/dev/block/$1" | awk -F= '/DEVNAME/{print $2}') derror "Error: Can not save vmcore because device $device is unresettable" return 0 } fi return 1 } #check if machine is resettable. #return true if resettable check_resettable() { local _target _override_resettable _override_resettable=$(kdump_get_conf_val override_resettable) OVERRIDE_RESETTABLE=${_override_resettable:-$OVERRIDE_RESETTABLE} if [ "$OVERRIDE_RESETTABLE" != "0" ] && [ "$OVERRIDE_RESETTABLE" != "1" ]; then perror_exit "override_resettable value '$OVERRIDE_RESETTABLE' is invalid" fi for_each_block_target is_unresettable && return return 1 } if ! check_resettable; then exit 1 fi # firstly get right SSH_KEY_LOCATION keyfile=$(kdump_get_conf_val sshkey) if [[ -f $keyfile ]]; then # canonicalize the path SSH_KEY_LOCATION=$(/usr/bin/readlink -m "$keyfile") fi while read -r config_opt config_val; do # remove inline comments after the end of a directive. case "$config_opt" in extra_modules) extra_modules="$extra_modules $config_val" ;; ext[234] | xfs | btrfs | minix | nfs | virtiofs) check_user_configured_target "$config_val" "$config_opt" add_mount "$config_val" "$config_opt" ;; raw) # checking raw disk writable dd if="$config_val" count=1 of=/dev/null > /dev/null 2>&1 || { perror_exit "Bad raw disk $config_val" } _praw=$(persistent_policy="by-id" kdump_get_persistent_dev "$config_val") if [[ -z $_praw ]]; then exit 1 fi add_dracut_arg "--device" "$_praw" check_size raw "$config_val" ;; ssh) if strstr "$config_val" "@"; then mkdir_save_path_ssh "$config_val" check_size ssh "$config_val" add_dracut_sshkey "$SSH_KEY_LOCATION" else perror_exit "Bad ssh dump target $config_val" fi ;; core_collector) verify_core_collector "$config_val" ;; dracut_args) # When users specify nfs dumping via dracut_args, kexec-tools won't # mount nfs fs beforehand thus nfsv4-related drivers won't be installed # because we call dracut with --hostonly-mode strict. So manually install # nfsv4-related drivers. if [[ $(get_dracut_args_fstype "$config_val") == nfs* ]]; then add_dracut_arg "--add-drivers" nfs_layout_nfsv41_files fi while read -r dracut_arg; do add_dracut_arg "$dracut_arg" done <<< "$(echo "$config_val" | xargs -n 1 echo)" ;; *) ;; esac done <<< "$(kdump_read_conf)" handle_default_dump_target if ! have_compression_in_dracut_args; then if is_squash_available && dracut_have_option "--squash-compressor"; then add_dracut_arg "--squash-compressor" "zstd" elif is_zstd_command_available; then add_dracut_arg "--compress" "zstd" fi fi if [[ -n $extra_modules ]]; then add_dracut_arg "--add-drivers" "$extra_modules" fi # TODO: The below check is not needed anymore with the introduction of # 'zz-fadumpinit' module, that isolates fadump's capture kernel initrd, # but still sysroot.mount unit gets generated based on 'root=' kernel # parameter available in fadump case. So, find a way to fix that first # before removing this check. if ! is_fadump_capable; then # The 2nd rootfs mount stays behind the normal dump target mount, # so it doesn't affect the logic of check_dump_fs_modified(). is_dump_to_rootfs && add_mount "$(to_dev_name "$(get_root_fs_device)")" add_dracut_arg "--no-hostonly-default-device" if fips-mode-setup --is-enabled 2> /dev/null; then add_dracut_arg --add-device "$(findmnt -n -o SOURCE --target /boot)" fi fi # This is RHEL-only to work around nvme problem, then real fix should go to dracut if [[ -d /sys/module/nvme ]]; then add_dracut_arg "--add-drivers" "nvme" fi # Use kdump managed dracut profile. [[ $kdump_dracut_confdir ]] || kdump_dracut_confdir=/lib/kdump/dracut.conf.d if [[ "$(dracut --help)" == *--add-confdir* ]] && [[ -d "$kdump_dracut_confdir" ]]; then dracut_args+=("--add-confdir" "$kdump_dracut_confdir") else dracut_args+=(--add kdumpbase) dracut_args+=(--omit "plymouth resume ifcfg earlykdump") fi dracut "${dracut_args[@]}" "$@" _rc=$? sync exit $_rc