#795 Issue closed: rescue/GNU/Linux/99_sysreqs.sh can hang up endlessly¶
Labels: bug, cleanup
jsmeix opened issue at 2016-03-11 12:44:¶
In rescue/GNU/Linux/99_sysreqs.sh
the following command can hang up endlessly:
BOOT_KB=$(grep `df -P /boot | grep /boot | awk '{print $1}' | sed "s#/dev/##"` /proc/partitions | awk '{print $3}')
It hangs up on my SLE12 test system,
here reproduced on command line:
# set -x
# BOOT_KB=$(grep `df -P /boot | grep /boot | awk '{print $1}' | sed "s#/dev/##"` /proc/partitions | awk '{print $3}')
++ awk '{print $3}'
+++ grep --color=auto /boot
+++ awk '{print $1}'
+++ sed s#/dev/##
+++ df -P /boot
++ grep --color=auto /proc/partitions
The reason is that a command like "grep /etc/fstab" hangs up endlessly
# grep /etc/fstab
because this means that grep should search for "/etc/fstab" in stdin
in contrast to:
# grep something /etc/fstab #
that returns immediately.
I will provide a pull request...
jsmeix commented at 2016-03-11 12:51:¶
"git blame usr/share/rear/rescue/GNU/Linux/99_sysreqs.sh"
indicates all was made by Gratien D'haese.
@gdha
please make your code according to
https://github.com/rear/rear/wiki/Coding-Style
Use $( command ) instead of backticks `command`
I get so confused with backticks because one same character backtick is used both for opening and closing.
I will clean up the whole 99_sysreqs.sh code...
jsmeix commented at 2016-03-11 15:06:¶
"git log --follow usr/share/rear/rescue/GNU/Linux/99_sysreqs.sh"
indicates that 99_sysreqs.sh really was made by @gdha
@gdha please have a look at my https://github.com/rear/rear/pull/796 and check my "FIXME comments in 99_sysreqs.sh - perhaps you could fix some of them?
Or was 99_sysreqs.sh perhaps actually created (sponsored)
by someone else because
"git log usr/share/rear/rescue/GNU/Linux/99_sysreqs.sh"
reads "(sponsored)"?
jsmeix commented at 2016-03-11 15:16:¶
FYI regarding my
"FIXME: it seems the root partition size is mising"
Excerpt from var/log/rear/rear-f197.log
++ echo
+++ awk '{tot=tot+$3} END {print tot}'
+++ grep -v -e Filename -e /dev/dm- /proc/swaps
++ SWAP_KB=1532924
++ test 1532924
+++ grep vg00
+++ awk '{print $6}'
+++ sed s/g//
+++ vgs --units=g
++ VG00_GB=
++ test ''
++ VG00_GB=0
+++ grep /boot
+++ awk '{print $1}'
+++ sed s#/dev/##
+++ df -P /boot
++ boot_partition_device_base_name=
++ test ''
++ BOOT_KB=0
+++ bc -l
+++ echo '( ( 1532924 + 0 ) / ( 1024 * 1024 ) ) + 0'
++ TOTOS=1.46191024780273437500
+++ printf %.2f 1.46191024780273437500
++ TOTOS=1.46
++ test 1.46
++ echo 'Disk space requirements:'
++ echo ' OS (vg00 + swap + /boot)'
++ echo ' size: 1.46 GiB'
++ echo ' Additional VGs'
++ size=0
+++ grep -v -e vg00 -e VFree
+++ awk '{print $6}'
+++ sed s/g//
+++ vgs --units=g
++ echo ' size: 0 GiB'
++ echo
and the actual values on that system:
# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 19G 5.3G 12G 31% / devtmpfs 490M 0 490M 0% /dev tmpfs 498M 0 498M 0% /dev/shm tmpfs 498M 7.8M 490M 2% /run tmpfs 498M 0 498M 0% /sys/fs/cgroup # parted /dev/sda print Model: ATA QEMU HARDDISK (scsi) Disk /dev/sda: 21.5GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 1571MB 1570MB primary linux-swap(v1) type=82 2 1571MB 21.5GB 19.9GB primary ext4 boot, type=83
gdha commented at 2016-03-11 15:55:¶
@jsmeix the vg00 seems to be very optimistic as it can be named
anything...(for the customer it worked fine, but they use as a standard
naming vg00).
It should be rewritten a bit to take the correct data sizes of the
boot/root disk (aka system disk).
The network part seems ok to me:
ip ::1 subnet /128 scope host DNS name localhost.
ip 192.168.122.71 subnet /24 DNS name centos7-kvm.
ip fe80::5054:ff:fe58:a2d3 subnet /64 scope link DNS name
jsmeix commented at 2016-03-15 14:44:¶
I close this one because with https://github.com/rear/rear/pull/796 it does no longer hang up.
I submitted https://github.com/rear/rear/issues/798 as follow up to fix or implement remaining issues in 99_sysreqs.sh
[Export of Github issue for rear/rear.]