Commit Graph

776 Commits

Author SHA1 Message Date
Dave Young
579e1725d0 Update kdump addon
Moving isys.total_memory() call to class method to avoid installation hangs.
It is possible because totoal_memory will call log.info which need log lock.
but some loging function need import gettext module which need import lock.
Thus deadlock could happen.

Moved isys.total_memory callback to class method instead.
2015-08-04 13:28:53 +08:00
Dave Young
87d25d54e5 Release 2.0.10-4 2015-07-28 12:47:50 +08:00
Minfei Huang
ea13e7ab98 dracut-module-setup: Enhance ISCSI to support ipv6 protocol
Due to the different format between ipv4 and ipv6 protocol, quote the
ipv6 address with bracket "[]" to make dracut notify.

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2015-07-28 12:42:17 +08:00
Minfei Huang
2ba32c6ccf dracut-module-setup: Prefer ipv4 address as the hostname address
Kdump will parse the hostname to get the ip address, if hostname is
specfied in /etc/kdump.conf. We will get the ip address(ipv4 or ipv6,
according to the DNS server) by using "getent hosts".

For now, it is more reasonable that we shall get all of the ip
address(including ipv4 and ipv6 address) which point to the hostname by
using "getent ahosts". And we will prefer to use the ipv4 address, if
both ipv4 and ipv6 address work.

The reason why we choose the ipv4 as preferred address is to solve the
issue kdump will fail to connect the hostname machine(parsed as ipv6
address), due to the DNS server is ipv4 address in 2nd kernel.

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2015-07-28 12:42:17 +08:00
Minfei Huang
c994a80698 dracut-module-setup: Support the network for ipv6 protocol
Previously, Kdump will save route to setup the network route in the 2nd
kernel for ipv4 protocol. To support ipv6 protocol, make Kdump fetch
correct nexthop, since the ruturning format is different.

In order to enhance kdump to support ipv6, support the static ip for
ipv6 protocol, which ipv4 has supported already.

Introduce a new lib function get_remote_host which is used to factor out
the ip address(ipv4 or ipv6) and hostname in /etc/kdump.conf.

Introduce a new lib function is_ipv6_address which is used to make sure
whether the passed ip address is ipv4 or ipv6.

Introduce a new lib function is_hostname which is used to confirm
whether the passed parameter is hostname, not the ip address.

Introduce a new function get_ip_route_field which is used to factor out
the specified string in ip route info.

Due to the different format between ipv4 and ipv6 protocol, quote the
ipv6 address with bracket "[]" to make dracut notify.

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2015-07-28 12:42:17 +08:00
Minfei Huang
edec8a8266 dracut-kdump: Use the first filtered ip address as dump directory
For now, Kdump will use ipv4 address as dump directory, and it works, if
ipv4 is enabled.

Once Kdump start to support ipv6 protocol, we may only setup the ipv6
address exclusively. Modify the code to make Kdump work in either ipv4
and ipv6 protocol.

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2015-07-28 12:42:17 +08:00
Minfei Huang
51cfe4f81c dracut-module-setup: Apply the manual DNS to the 2nd kernel
Now Kdump will ingore the DNS config in /etc/resolv.conf, when it
generates the initram. And most users do not concern about this issue,
because they never use deployment tools to configure machines
environment, like puppet.

It is more convenient to add the DNS config to /etc/resolv.conf for
people who use deployment tools to configure machines concurrently.

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2015-07-28 12:41:45 +08:00
Dave Young
a75b17ef91 watchdog: load iTCO_wdt early in cmdline hook
We have added *wdt in kdump initramfs, but to improve it more we can do below
(1) load wdt drivers as early as possible so that we can save time before wdt timeout
    some drivers like iTCO_wdt can stop the watchdog while driver initialization, so
    it can give more chance for kdump.
    It can save time especially in case some drivers take long time to init, like
    some storage and networking cards.
(2) add only used wdt drivers in kdump initrd instead of add *wdt
    wdt driver layer need a change so that we can get the proper driver name from
    /dev/watchdog. Question to this is are we sure 1st kernel use /dev/watchdog
    instead of /dev/watchdog1? It need more investigation.
(3) in case a driver can not stop (nowayout?) during module_init, we need load it
    as early as possible and kick the watchdog. Likely we can use systemd default
    watchdog functionality.

This patch is about to address (1), and specially for iTCO_wdt, we only tested
iTCO_wdt, thus in this patch only add this driver, need investigate on other drivers
later to see if other drivers works in this way.

Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Minfei Huang <mhuang@redhat.com>
2015-07-28 12:35:54 +08:00
Dave Young
970cb6124f Release 2.0.10-3 2015-07-23 10:56:36 +08:00
Dave Young
67b4f6ba91 Update kdump addon
Updated kdump addon icon again, Máirín Duffy designed a better icon,
it shows a little blip in a heart beat with a magnifying class examining
it, it uses components of the gnome-symbolic-theme so it would match the
other icons in the hub.
2015-07-23 10:51:47 +08:00
Dave Young
70a4c96523 Revert "save exact route to remote target"
This reverts commit a68bb200f8.

Conflicts:
	dracut-module-setup.sh

Manually remove get_route function
2015-07-13 17:17:32 +08:00
Dave Young
6b7df5b0b3 Revert "module-setup: Use proper ethernet device name in 2nd kernel"
This reverts commit 08809fb0c7.
2015-07-13 17:15:46 +08:00
Dave Young
5380af665d Release 2.0.10-2
Update kdump addon icon
2015-07-13 11:08:55 +08:00
Dave Young
35dd19e611 Release 2.0.10-1
Rebase kexec-tools to 2.0.10
Drop unused 2.0.7 patches in git tree
2015-07-09 09:38:30 +08:00
Dave Young
2b76613fc9 Rebase eppic library to upstream 050615
Upstream tree: https://code.google.com/p/eppic/
There's below changes vs previous version:
1) fix compile issues with gdb 7.6
2) fix compile warnings
3) Support for ARM64

Tested by Pratyush.

Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Pratyush Anand <panand@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2015-07-09 09:29:10 +08:00
Qiao Zhao
daccbbe3af Enhance kdump.conf "default" parameters check.
According to man page, default option can only use reboot, halt, poweroff,
shell and dump_to_rootfs as parameter.
Currently, if configuration kdump.conf is:
------
path /var/crash
core_collector makedumpfile -nosuchfile
default no_such_option
------
kdump service still can be started.

Adding function "check_default_config" to kdumpctl file can solve
this problem.

I have tested this patch in my test machine(Fedora-21).

v1 --> v2
Baoquan He point "check_default_config" function should be call in
"check_config" function.
Wang Li point if kdump.conf donesn't configure the "default" option,
kdump serivce will fail.

Signed-off-by: Qiao Zhao <qzhao@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
Acked-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2015-07-07 16:11:19 +08:00
Dave Young
e9ee834802 Release 2.0.9-2
Koji build add extra cflags automaticlly, this cause wrong kexec purgatory
Pre Peter Robinson's suggestion, add below in spec file:
%undefine _hardened_build

Also removes extra -FPIC ldflags since there's no such options in upstream makedumpfile.

Resolves: bz1236456

Signed-off-by: Dave Young <dyoung@redhat.com>
2015-07-02 10:27:48 +08:00
Dave Young
d74d13c425 Release 2.0.9-1
Rebase kexec-tools 2.0.9
2015-06-26 10:15:57 +08:00
Dave Young
8219fcf725 Rebase makedumpfile 1.5.8 2015-06-26 10:14:52 +08:00
Dave Young
977d20cd50 Revert commit 63476302
The ipv6 patchset is still under review, previously the commit was mistakenly
merged, thus let's revert it.

Revert "dracut-kdump: Use proper the known hosts entry in the file known_hosts"

This reverts commit 63476302aa.

Conflicts:
	kdump-lib.sh

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Signed-off-by: Dave Young <dyoung@redhat.com>
2015-06-26 10:14:14 +08:00
Dennis Gilmore
3ac7dddb2b - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-17 13:07:57 +00:00
Dave Young
f58228adba Release 2.0.8-13
Update kdump icon again, Xiaoxue created a new one with different color
so that we have similar color theme with other components.

Also add kdump.svg to rpm %files section

Otherwise rpmbuild will not package it in rpm
2015-06-11 14:19:36 +08:00
Dave Young
ed6b29ede9 Fix bogus date in last commit for 2.0.8-12 2015-06-10 10:56:01 +08:00
Dave Young
99f580dffd Release 2.0.8-12 2015-06-10 10:50:31 +08:00
Dave Young
507abc9e30 Update kdump addon
changes: update kdump spoke icon
several fixes from M4rtinK
2015-06-10 10:48:49 +08:00
Baoquan He
115092ef8e Release 2.0.8-11 2015-06-03 21:13:05 +08:00
Chao Fan
86b251765e make kdump work when kernel crash after shutdown
In RHEL6, vmcore file was created if panic occurred during shutdown. This was
very useful for analyzing problems during the shutdown sequence.

However, in RHEL7, vmcore will not be created after kdump service is stopped.
This will make it very difficult to solve problems during shutodwn.

The reason why kdump fails to dump vmcore is kdump is stopped too early during
the power is off.

If add "DefaultDependencies=no" to the [Unit] of kdump.service , kdump will
not be stopped by systemd after shutdown command.

The manpage of systemd.unit about the DefaultDependencies:
If true, (the default), a few default dependencies will implicitly be created
for the unit. The actual dependencies created depend on the unit type. For
example, for service units, these dependencies ensure that the service is
started only after basic system initialization is completed and is properly
terminated on system shutdown.

The manpage about basic.target:
A special target unit covering basic boot-up.
systemd automatically adds dependencies of the types Requires= and After= for
this target unit to all services (except for those with DefaultDependencies=no).
Usually this should pull-in all mount points, swap devices, sockets, timers,
and path units and other basic initialization necessary for general purpose
daemons.

So "DefaultDependencies=no" can keep kdump not stopped too early. But to make
it start when power on, add After=basic.target will be better.
The systemd-devel mailed to me:  using DefaultDependencies=no but also
After=basic.target will make sure the service isn't started too early (but kept
until systemd's final process killing spree).

Signed-off-by: Chao Fan <cfan@redhat.com>
Acked-by: Minfei Huang <mhuang@redhat.com>
2015-06-03 21:10:34 +08:00
Li Wang
0aada50b66 Disable transparent hugepages in second kernel
Transparent hugepages are on by default. Disable it in kdump kernel by
adding the parameter 'transparent_hugepage=never'. This might help us
with some of the memory issues we are facing.

From my test on two arch, not only there are no any bad effect on saving vmcore
after turn off THP, but also we can get more 'MemAvailable:' in the kdump kernel.

1)x86_64
without the parameter
=====================
kdump:/# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/rhel_ibm--x3250m4--01-root ro rd.lvm.lv=rhel_ibm-x3250m4-01/swap console=ttyS0,115200n8 rd.lvm.lv=rhel_ibm-x3250m4-01/root LANG=en_US.UTF-8 irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug disable_cpu_apicid=0 elfcorehdr=869764K

kdump:/# cat /proc/meminfo
MemTotal:         145492 kB
MemFree:           68284 kB
MemAvailable:     111632 kB  <<------
Buffers:              36 kB
Cached:            48184 kB
...

added the parameter
=====================
kdump:/# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/rhel_ibm--x3250m4--01-root ro rd.lvm.lv=rhel_ibm-x3250m4-01/swap console=ttyS0,115200n8 rd.lvm.lv=rhel_ibm-x3250m4-01/root LANG=en_US.UTF-8 irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never disable_cpu_apicid=0 elfcorehdr=869764K

kdump:/# cat /proc/meminfo
MemTotal:         145492 kB
MemFree:           68388 kB
MemAvailable:     111728 kB  <<-------
...
VmallocChunk:   34359659520 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
...

2)ppc64
without the parameter
====================
kdump:/# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-229.el7.ppc64 root=/dev/mapper/rhel_ibm--p8--05--lp6-root ro rd.lvm.lv=rhel_ibm-p8-05-lp6/root rd.lvm.lv=rhel_ibm-p8-05-lp6/swap LANG=en_US.UTF-8 irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 rootflags=nofail kvm_cma_resv_ratio=0 elfcorehdr=154880K

kdump:/# cat /proc/meminfo
MemTotal:         480832 kB
MemFree:          293952 kB
MemAvailable:     427840 kB  <<--------
mallocUsed:       23680 kB
VmallocChunk:   8589901824 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
...

added the parameter
===================
kdump:/# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-229.el7.ppc64 root=/dev/mapper/rhel_ibm--p8--05--lp6-root ro rd.lvm.lv=rhel_ibm-p8-05-lp6/root rd.lvm.lv=rhel_ibm-p8-05-lp6/swap LANG=en_US.UTF-8 irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 rootflags=nofail kvm_cma_resv_ratio=0 transparent_hugepage=never elfcorehdr=154880K

kdump:/# cat /proc/meminfo
MemTotal:         480832 kB
MemFree:          294592 kB
MemAvailable:     428480 kB  <<-------
...
HugePages_Total:       0

Signed-off-by: Li Wang <liwang@redhat.com>
Acked-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Baoquan He <bhe@redaht.com>
2015-06-03 21:07:22 +08:00
Qiao Zhao
e4a99f7523 Filtered out "noauto" options in 2nd kernel fstab
Customer found when specify "noauto" option in fstab for nfs mount,
dump failed.

The reason is if "noauto" option is specified in fstab, the mount entry
in fstab related to dump target will passed to dracut and stored in
kdump initrd. Then during kdump kernel boots this entry containing
"noauto" will be ignored by mount service. This cause dump failing.
In fact with "noauto" not only nfs dump will fail, non-root disk dump
will fail too. root disk dump can dump successfully since root disk can
always be mounted by systemd.

So now "noauto" need be filtered out when the fstab entry corresponding
to dump target contains "noauto".

Changelog:
v4 -> v5
code comment is not clear enough. supplement it.

Signed-off-by: Qiao Zhao <qzhao@redhat.com>
Acked-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2015-06-03 21:05:56 +08:00
Baoquan He
0a9851e2fc Release 2.0.8-10 2015-04-21 11:15:50 +08:00
Baoquan He
eb8034e067 add fPIC to makefumpfile CFLAGS to support hardening
Beginning from f23 program hardening become the defaults for all packages.
Details can be checked from below link:
https://fedoraproject.org/wiki/Changes/Harden_All_Packages

Adding this to makedumpfile CFLAGS, otherwise makedumpfile building will
fail on koji.

Signed-off-by: Baoquan He <bhe@redhat.com>
2015-04-21 11:13:33 +08:00
Minfei Huang
25afa6ee5f dracut-module-setup: Enhance kdump to support the bind mounted feature in Atomic
Kdump will dump the vmcore in incorrect target directory, if the target
is bind mounted.

As commented in the previous patch, we can construct the real path in
Atomic, which contains two part, one bind mounted path, the other
specified dump path. Then replace the path as the real path in
/etc/kdump.conf.

findmnt can find the real path for nfs, although the path is in bind
mode. So nfs can work well with the path in bind mode.

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2015-04-21 10:58:30 +08:00
Minfei Huang
7acaa304f6 Fix the warning if the target path is bind mount in Atomic
kdump will raise the warning in Atomic, if the path is bind mounted
directory. The reason why causes this issue is kdump cannt parse the
bind mounted directory.

To correct dumping target, we can construct the real dumping path in
Atomic, which contains two part, one bind mounted path, the other
specified dump target.

Following is an example:
    -bash-4.2# cat /etc/kdump.conf | grep ^path
    path /var/crash

    -bash-4.2# findmnt /var | tail -n 1 | awk '{print $2}'
    /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var]

    -bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}'
    /dev/mapper/atomicos-root

Then we can found it that the real path of dumping vmcore is
/ostree/deploy/rhel-atomic-host/var/crash.

To fix this issue, we can replace the target path as the real path which
is from above parsing.

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2015-04-21 10:58:00 +08:00
Minfei Huang
c82a453c67 Get the mount point correctly, if the device has several mount point
Any block device can be mounted multiply on the different mount point.
Once a mount point is mounted in bind mode, the general mount point can
be unmounted. Thus kdump would not find the general mount point[1] to
handle the path.

The mount point, which is as general mount point, will be got by
"fintmnt" previously. But the mntpoint may be incorrect, if the mntpoint
is bind mount.

In order to fix it to support bind mounted in atomic, we will add a
judgement to comfirm the mntpoint is bind mounted, or not.

For general mount, returning path is like following, if we use
"findmnt". The returning is same as "findmnt -v".

    -bash-4.2# findmnt /var | tail -n 1 | awk '{print $2}'
    /dev/mapper/atomicos-root

But for bind mount, returning path is like following, if we use
"fintmnt".
    -bash-4.2# findmnt /var | tail -n 1 | awk '{print $2}'
    /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var]

Use "findmnt -v" is like this:
    -bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}'
    /dev/mapper/atomicos-root

So we can determine the bind mount, if the returning is different
between "findmnt" and "findmnt -v".

[1] general mount point is a directory without being in bind mounted
mode, just a normal directory.

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2015-04-21 10:57:44 +08:00
Minfei Huang
4a468829e7 kdump-lib: Add new function to judge the system is Atomic or not
For Atomic system, the cmdline will contain the specific string
"ostree". So we can filter out the "ostree" to judge the system is
Atomic or not.

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2015-04-21 10:57:28 +08:00
Minfei Huang
ef94190ce5 kdump-lib: Add the new function to enhance bind mounted judgement
findmnt uses the option "-v, --nofsroot" to exclude the [/dir] in the
SOURCE column for bind-mounts, then if $_mntpoint equals to
$_mntpoint_nofsroot, the mountpoint is not bind mounted directory.

the value of $_mntpoint may be like
/dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var], if the
directory is bind mounted. The former part represents the device path, the
rest part is the bind mounted directory which quotes by bracket "[]".

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2015-04-21 10:57:12 +08:00
Minfei Huang
fedeba5e4b Remove duplicate slash in save path
Now kdump cannt parse the path correctly, if the path contains
duplicated "/". Following is an example to explain it detail. (the
directory /mnt is a mount point which is mounted a block device)

path //mnt/var/crash

Then the warning will raise.

Force rebuild /boot/initramfs-3.19.1kdump.img
Rebuilding /boot/initramfs-3.19.1kdump.img
df: ‘/mnt///mnt/var/crash’: No such file or directory
/sbin/mkdumprd: line 239: [: -lt: unary operator expected
kexec: loaded kdump kernel
Starting kdump: [OK]

For above case, kdump fails to check the fs size, due to the incorrect
path.

In kdump code flow, we will cut out the mount point(/mnt) from the
path(//mnt/var/crash). But the mount point cannt match the path, because
of the duplicated "/".

To fix it, we will strip the duplicated "/" firstly.

Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2015-04-21 10:56:03 +08:00
Baoquan He
2c443617bc Release 2.0.8-9 2015-04-09 16:04:27 +08:00
Baoquan He
6f4940f198 Revert "execute kdump_post after do_default_action"
This reverts commit f4c45236bf.
Since that commit will change the behaviour of kdump_post. That is not
good.

Signed-off-by: Baoquan He <bhe@redhat.com>
2015-04-08 15:50:16 +08:00
Baoquan He
374d8b628b dracut-module-setup.sh: change the insecure use of /tmp/*$$* filenames
Harald warned it's dangerous to use /tmp/*$$* in shell scripts of dracut
modules.

Quote his saying as below:
***************************
This can be exploited so easily and used to overwrite e.g. /etc/shadow.
The only thing you have to do is waiting until the next time the kdump
initramfs is generated on a kernel update.

If at all, please use "$initdir/tmp/" because $initdir is a mktemp generated
directory with a non-guessable name!
**************************

So make a clean up in this patch.

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2015-02-25 16:52:14 +08:00
WANG Chao
84f94be90b make kdump saving directory name consistent with RHEL6
Now we use the pattern:
  <machine/ipaddr>-YYYY.MM.DD-HH:MM:SS

while rhel6 uses the following:
  <machine/ipaddr>-YYYY-MM-DD-HH:MM:SS

This change may break someone's script and we should change it back to
keep consistent between releases.

Signed-off-by: WANG Chao <chaowang@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
Acked-by: Minfei Huang <mhuang@redhat.com>
2015-02-25 16:52:05 +08:00
Dave Young
dcad90ac4f Release 2.0.8-8 2015-02-15 14:39:31 +08:00
Baoquan He
f4c45236bf execute kdump_post after do_default_action
User complains that kdump_post script doesn't execute after mount
failed. This happened since mount failure will trigger
kdump-error-handler.service, and then start kdump-error-handler.sh.
However in kdump-error-handler.sh it doesn't execute kdump_post.
Hence add it in this patch.

Surely the function do_kdump_post need be moved into kdump-lib-initramfs.sh
to be a common function.

v1->v2:
    Add a return value to do_kdump_post when invoked in kdump_error-handler.sh.
    And call do_kdump_post earlier than do_default_action, otherwise
    it may not execute if reboot/poweroff/halt.

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Meifei Huang <mhuang@redhat.com>
2015-02-11 17:11:02 +08:00
Baoquan He
17b86f7fce Release 2.0.8-7 2015-01-30 14:59:46 +08:00
Baoquan He
cad991814e kdumpctl: adjust the boot dir if kernel is put in sub dir of /boot
Previously /boot is asumed as the default dir where kernel and initrd
is put. However, the directory containing the running kernel image
on Atomic systems differs in each installation. Usually something like:

/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72

This means that kdump will not find vmlinuz when installed on an
Atomic host, and thus the kdump service will fail to start.

In this patch, the kdump boot dir finding behaviour is a little changed.
Firstly check whether user has specify a directory explicitly in
/etc/sysconfig/kdump. If yes that is respected. Otherwise we assume
1st kernel and kdump kernel are put in the same place under /boot.
Then find it according /proc/cmdline and append it to /boot/

Note:
So now the KDUMP_BOOTDIR in /etc/sysconfig/kdump is set as empty
by default. If user set KDUMP_BOOTDIR to a directory, then he need to
take care of all related things himself. otherwise kdump script handle
it automatically.

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Minfei Huang <mhuang@redhat.com>
2015-01-30 14:53:34 +08:00
WANG Chao
a9b30d9e79 Release 2.0.8-6
Signed-off-by: WANG Chao <chaowang@redhat.com>
2015-01-13 13:16:45 +08:00
Baoquan He
1a8a39aa9c adding the parsed path to etc/kdump.conf of kdump initrd
Steve found a bug. When mount a disk in /var and not specify path
in /etc/kdump.conf, the vmcore will be dumped into /var/crash of
that disk, but not /crash on that disk.

This is because when write the parsed path into /tmp/$$-kdump.conf
in default_dump_target_install_conf() of mkdumprd, it uses below
sed command. So if no path specified at all, this sed command won't
add it to /tmp/$$-kdump.conf. Then in 2nd kernel it will take default
path, namely "/var/crash" as path if no path in /etc/kdump.conf in
2nd kernel.

    sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf

According to Dave Young's suggestion, erase the old path line and then
insert the parsed path. This can fix it.

v2->v3:
    erase the old path line and then insert the parsed path.

    sed -i -e "s#^path[[:space:]]\+$_save_path##" /tmp/$$-kdump.conf
    echo "path $_path" >> /tmp/$$-kdump.conf

v3->v4:
    Change the sed pattern, erase lines starting with "path" and then
    insert the parsed path.

    sed -i -e "s#^path.*##" /tmp/$$-kdump.conf
    echo "path $_path" >> /tmp/$$-kdump.conf

v4->v5:
    Chaowang suggested using sed command d to remove the whole line
    like below:
    sed -i "/^path/d" /tmp/$$-kdump.conf
    echo "path $_path" >> /tmp/$$-kdump.conf

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: WANG Chao <chaowang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2015-01-13 13:16:25 +08:00
Baoquan He
1c9362c10d dracut-module-setup.sh: make some clean up
Chao pointed out that it's better to use get_option_value to get
get a specific config_val.

And also there's a potential risk when use below sed command to
do the replacement.

sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf

Say user configure kdump.conf like the following. Then sed may
replace "/var/crash/post.sh" with something else, depanding on
mount point.

kdump_post /var/crash/post.sh
path /var/crash

So in this patch clean them up.

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: WANG Chao <chaowang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2015-01-13 13:16:13 +08:00
Jerry Hoemann
d2f87357e8 Rebuild initrd dependency during kdump restart
kdumpctl now parses mount points in determining the partition to
save the dump to.  So /etc/fstab can be considered a configuration
file for kdump.

Change adds an additional depenedency check on /etc/fstab when
kdump is restarted.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hp.com>
Acked-by: WANG Chao <chaowang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2015-01-13 12:34:01 +08:00
Baoquan He
e08ef78a56 mount fail if its mount point doesn't exist in /sysroot
Jerry Hoemann reported a bug that a mount will fail when he installed
a system with separate "/" "/var" and "/var/crash". That means root
disk /dev/a mounted on /, and another disk /dev/b is mounted on /var,
then the 3rd disk /dev/c mounted on /var/crash. Then kdump will fail
since mount will fail.

This is because the mount information will be written into
/$mntimage/etc/fstab like below. And the dump target is /dev/c. However
/dev/b is not related in kdump, its mount info is not necessary and not
saved. So when go into kdump kernel, it will find there's not a crash
dir under /sysroot/var. And in current implementation, if not a root
disk dump, sysroot is a read-only mount, no dir can be created in this
situation.

/dev/disk/by-uuid/cdcf007a-b623-45ee-8d73-a8be0d372440 /sysroot/var/crash xfs rw,relatime,...,x-initrd.mount 0 2

So in this patch, change the mount behavior to fix this bug. If dump
target is a root disk, mount point is /sysroot. If dump target is not
root, just mount it to /kdumproot/$_target. Now it works.

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: WANG Chao <chaowang@redhat.com>
Tested-by: Jerry Hoemann <jerry.hoemann@hp.com>
2015-01-13 12:33:02 +08:00