#1985 PR merged
: Cleaned up how KERNEL_FILE is set (issues 1851 and 1983)¶
Labels: cleanup
, fixed / solved / done
, minor bug
jsmeix opened issue at 2018-11-28 15:08:¶
-
Type: Minor Bug Fix and Cleanup
-
Impact: Normal
-
Reference to related issue (URL):
https://github.com/rear/rear/issues/1851
and
https://github.com/rear/rear/pull/1983 -
How was this pull request tested?
On my openSUSE Leap 15.0 (SLES12-like) system
the "rear -D mkrescue" debug log looks good
but I have only the simple initial case
KERNEL_FILE="/boot/vmlinuz-$KERNEL_VERSION"
in the new prep/GNU/Linux/400_guess_kernel.sh -
Brief description of the changes in this pull request:
see
https://github.com/rear/rear/issues/1851#issuecomment-442419363
and
https://github.com/rear/rear/pull/1983#issuecomment-442441235
In particular this pull request includes (and therefore obsoletes)
https://github.com/rear/rear/pull/1983
i.e. usr/share/rear/pack/GNU/Linux/400_guess_kernel.sh
is moved to usr/share/rear/prep/GNU/Linux/400_guess_kernel.sh
@gozora @gdha
I would much appreciate it if you could test whether or not the
changes in this pull request cause regressions on your systems.
Many thanks in advance!
jsmeix commented at 2018-11-28 15:40:¶
Ouch!
It seems there is no verification when actually copying $KERNEL_FILE
into the recovery system because I added to the end of
the new prep/GNU/Linux/400_guess_kernel.sh
KERNEL_FILE="/qqqq/QQQQ" # Show to the user what will actually be used as kernel in the recovery system: LogPrint "Using '$KERNEL_FILE' as kernel in the recovery system"
and "rear -D mkrescue" blindly succeeds and in its log I get
+ source /root/rear.github.master/usr/share/rear/output/ISO/Linux-i386/800_create_isofs.sh ... ++ echo '2018-11-28 16:38:10.177417576 Copying kernel and initrd' 2018-11-28 16:38:10.177417576 Copying kernel and initrd ++ cp -pL -v /qqqq/QQQQ /tmp/rear.btMb4OpRSu51xUT/tmp/isofs/isolinux/kernel cp: cannot stat '/qqqq/QQQQ': No such file or directory ++ cp -v /tmp/rear.btMb4OpRSu51xUT/tmp/initrd.cgz /tmp/rear.btMb4OpRSu51xUT/tmp/isofs/isolinux/initrd.cgz '/tmp/rear.btMb4OpRSu51xUT/tmp/initrd.cgz' -> '/tmp/rear.btMb4OpRSu51xUT/tmp/isofs/isolinux/initrd.cgz'
I will fix that too...
jsmeix commented at 2018-11-28 15:57:¶
Now it fails as it should:
# usr/sbin/rear -D mkrescue ... Using '/qqqq/QQQQ' as kernel in the recovery system ... ERROR: Failed to copy KERNEL_FILE '/qqqq/QQQQ' Some latest log messages since the last called script 800_create_isofs.sh: 2018-11-28 16:56:25.174949019 Including output/ISO/Linux-i386/800_create_isofs.sh 2018-11-28 16:56:25.175956312 Entering debugscripts mode via 'set -x'. 2018-11-28 16:56:25.181098853 Copying kernel and initrd cp: cannot stat '/qqqq/QQQQ': No such file or directory Aborting due to an error, check /root/rear.github.master/var/log/rear/rear-g243.log for details
gozora commented at 2018-11-28 17:13:¶
Hello @jsmeix,
I've found some other files where kernel is copied without further checking of the operation success:
- usr/share/rear/output/PXE/default/800_copy_to_tftp.sh
- usr/share/rear/output/RAMDISK/Linux-i386/900_copy_ramdisk.sh
- usr/share/rear/output/ISO/Linux-ppc64le/800_create_isofs.sh
- usr/share/rear/output/default/940_grub_rescue.sh
Maybe we could add to
usr/share/rear/prep/GNU/Linux/400_guess_kernel.sh check if
KERNEL_FILE contains a real kernel.
Something like:
file $KERNEL_FILE | grep -q "Linux kernel" || Error "$KERNEL_FILE is not a valid Linux kernel"
?
V.
#### <img src="https://avatars.githubusercontent.com/u/12116358?u=1c5ba9dcee5ca3082f03029a7fbe647efd30eb49&v=4" width="50">[gozora](https://github.com/gozora) commented at [2018-11-28 17:54](https://github.com/rear/rear/pull/1985#issuecomment-442542776):
There is leftover symlink _/usr/share/rear/pack/Linux-ia64_, still pointing to deleted directory (Linux-i386) .
I guess it can be removed.
V.
#### <img src="https://avatars.githubusercontent.com/u/1788608?u=925fc54e2ce01551392622446ece427f51e2f0ce&v=4" width="50">[jsmeix](https://github.com/jsmeix) commented at [2018-11-29 08:12](https://github.com/rear/rear/pull/1985#issuecomment-442743423):
@gozora
thank you for testing it!
I know about the missing things but yesterday it was too late
(after-work hours are for family and ReaR is at the rear ;-)
#### <img src="https://avatars.githubusercontent.com/u/1788608?u=925fc54e2ce01551392622446ece427f51e2f0ce&v=4" width="50">[jsmeix](https://github.com/jsmeix) commented at [2018-11-29 14:10](https://github.com/rear/rear/pull/1985#issuecomment-442846696):
@gdha
now things look good to me so far so that I would like
to merge it today unless you object soon because
I like to get that changes tested by your automated tests
and by users who use our GitHub master code.
#### <img src="https://avatars.githubusercontent.com/u/1788608?u=925fc54e2ce01551392622446ece427f51e2f0ce&v=4" width="50">[jsmeix](https://github.com/jsmeix) commented at [2018-11-29 15:53](https://github.com/rear/rear/pull/1985#issuecomment-442885108):
Hopefully it is "fixed / solved / done" - if not I will of course fix regressions.
#### <img src="https://avatars.githubusercontent.com/u/12116358?u=1c5ba9dcee5ca3082f03029a7fbe647efd30eb49&v=4" width="50">[gozora](https://github.com/gozora) commented at [2018-11-29 16:09](https://github.com/rear/rear/pull/1985#issuecomment-442891069):
Thanks @jsmeix!
V.
#### <img src="https://avatars.githubusercontent.com/u/1788608?u=925fc54e2ce01551392622446ece427f51e2f0ce&v=4" width="50">[jsmeix](https://github.com/jsmeix) commented at [2018-11-30 10:15](https://github.com/rear/rear/pull/1985#issuecomment-443157197):
Using the `file` command to verify that it is actually a kernel as in
https://github.com/rear/rear/pull/1985#discussion_r237498331
will likely cause regressions because
on my openSUSE Leap 15.0 (SLES12-like) system
I have `/boot/vmlinux-*` files, cf.
https://en.wikipedia.org/wiki/Vmlinux
where neither `file` nor `file -z` show it is a 'kernel':
<pre>
# file /boot/vmlinu*
/boot/vmlinux-4.12.14-lp150.12.22-default.gz: gzip compressed data, was "vmlinux-4.12.14-lp150.12.22-default", last modified: Sat Oct 13 14:55:30 2018, max compression, from Unix
/boot/vmlinux-4.12.14-lp150.12.25-default.gz: gzip compressed data, was "vmlinux-4.12.14-lp150.12.25-default", last modified: Fri Nov 2 07:20:36 2018, max compression, from Unix
/boot/vmlinuz: symbolic link to vmlinuz-4.12.14-lp150.12.25-default
/boot/vmlinuz-4.12.14-lp150.12.22-default: Linux/x86 Kernel, Setup Version 0x20d, bzImage, Version 4.12.14-lp150.12.22-default (geeko@buildhost) #1 SMP Sat Oct 13 05:05:16 UTC 2018 (09415e8), RO-rootFS, swap_dev 0x6, Normal VGA
/boot/vmlinuz-4.12.14-lp150.12.25-default: Linux/x86 Kernel, Setup Version 0x20d, bzImage, Version 4.12.14-lp150.12.25-default (geeko@buildhost) #1 SMP Thu Nov 1 06:14:23 UTC 2018 (3fcf457), RO-rootFS, swap_dev 0x6, Normal VGA
# file -z /boot/vmlinu*
/boot/vmlinux-4.12.14-lp150.12.22-default.gz: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) (gzip compressed data, was "vmlinux-4.12.14-lp150.12.22-default", last modified: Sat Oct 13 14:55:30 2018, max compression, from Unix)
/boot/vmlinux-4.12.14-lp150.12.25-default.gz: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) (gzip compressed data, was "vmlinux-4.12.14-lp150.12.25-default", last modified: Fri Nov 2 07:20:36 2018, max compression, from Unix)
/boot/vmlinuz: symbolic link to vmlinuz-4.12.14-lp150.12.25-default
/boot/vmlinuz-4.12.14-lp150.12.22-default: Linux/x86 Kernel, Setup Version 0x20d, bzImage, Version 4.12.14-lp150.12.22-default (geeko@buildhost) #1 SMP Sat Oct 13 05:05:16 UTC 2018 (09415e8), RO-rootFS, swap_dev 0x6, Normal VGA
/boot/vmlinuz-4.12.14-lp150.12.25-default: Linux/x86 Kernel, Setup Version 0x20d, bzImage, Version 4.12.14-lp150.12.25-default (geeko@buildhost) #1 SMP Thu Nov 1 06:14:23 UTC 2018 (3fcf457), RO-rootFS, swap_dev 0x6, Normal VGA
</pre>
I have the same on my old SLES11 system:
<pre>
# file /boot/vmlinu*
/boot/vmlinux-3.0.101-108.21-pae.gz: gzip compressed data, from Unix, max compression
/boot/vmlinuz: symbolic link to `vmlinuz-3.0.101-108.21-pae'
/boot/vmlinuz-3.0.101-108.21-pae: Linux/x86 Kernel, Setup Version 0x20b, bzImage, Version 3.0.101, RO-rootFS, swap_dev 0x3, Normal VGA
# file -z /boot/vmlinu*
/boot/vmlinux-3.0.101-108.21-pae.gz: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV) (gzip compressed data, from Unix, max compression)
/boot/vmlinuz: symbolic link to `vmlinuz-3.0.101-108.21-pae'
/boot/vmlinuz-3.0.101-108.21-pae: Linux/x86 Kernel, Setup Version 0x20b, bzImage, Version 3.0.101, RO-rootFS, swap_dev 0x3, Normal VGA
</pre>
#### <img src="https://avatars.githubusercontent.com/u/1788608?u=925fc54e2ce01551392622446ece427f51e2f0ce&v=4" width="50">[jsmeix](https://github.com/jsmeix) commented at [2018-11-30 10:45](https://github.com/rear/rear/pull/1985#issuecomment-443165122):
With https://github.com/rear/rear/pull/1988 merged
the possible regression in
https://github.com/rear/rear/pull/1985#issuecomment-443157197
can no longer happen.
#### <img src="https://avatars.githubusercontent.com/u/12116358?u=1c5ba9dcee5ca3082f03029a7fbe647efd30eb49&v=4" width="50">[gozora](https://github.com/gozora) commented at [2018-11-30 12:40](https://github.com/rear/rear/pull/1985#issuecomment-443191996):
hello @jsmeix
Your **vmlinuz** files actually show `Linux/x86 Kernel`.
**vmlinux** contains kernel image which is normally not used for booting but for debugging...
V.
#### <img src="https://avatars.githubusercontent.com/u/1788608?u=925fc54e2ce01551392622446ece427f51e2f0ce&v=4" width="50">[jsmeix](https://github.com/jsmeix) commented at [2018-11-30 13:35](https://github.com/rear/rear/pull/1985#issuecomment-443205138):
I don't know if a `vmlinux` file can never be used for booting
(I don't know about all the various possible boot methods - recently I even
learned about booting without a bootloader in between by using only the
plain firmware of the hardware to load a kernel ;-)
If `vmlinux` can never be used for booting
I can re-add the `file` test if it is actually helpful to avoid
that the user may have accidentally specified e.g.
<pre>
KERNEL_FILE="/boot/vmlinux-4.12.14-lp150.12.25-default
</pre>
instead of his actually bootable kernel
<pre>
KERNEL_FILE="/boot/vmlinuz-4.12.14-lp150.12.25-default
</pre>
and/or to avoid that somehow accidentally a `vmlinux` file
is autodetected and will be actually used as kernel.
#### <img src="https://avatars.githubusercontent.com/u/12116358?u=1c5ba9dcee5ca3082f03029a7fbe647efd30eb49&v=4" width="50">[gozora](https://github.com/gozora) commented at [2018-11-30 13:42](https://github.com/rear/rear/pull/1985#issuecomment-443206835):
I'd say, leave the code without `file` check ...
As far as I can remember no one was complaining about fact that he was not able to boot because ReaR wrongly detected kernel file. We should not poke into things that are actually not broken ...
V.
#### <img src="https://avatars.githubusercontent.com/u/1788608?u=925fc54e2ce01551392622446ece427f51e2f0ce&v=4" width="50">[jsmeix](https://github.com/jsmeix) commented at [2018-11-30 13:49](https://github.com/rear/rear/pull/1985#issuecomment-443208684):
Oh, please, let us just shout a little nice ****WARNING**** at the user ;-)
https://blog.schlomo.schapiro.org/2015/04/warning-is-waste-of-my-time.html
I agree with your https://github.com/rear/rear/pull/1985#issuecomment-443206835
Have a nice weekend!
-------------------------------------------------------------------------------
[Export of Github issue for [rear/rear](https://github.com/rear/rear).]