[Discussion] Proposals for getinfo.sh

A 5 star hangout for overworked and underpaid system admins.
User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: [Discussion] Proposals for getinfo.sh

Post by AlanBartlett » 2012/04/24 00:58:51

I certainly could test with the latest distro kernel but that will have to be later this week.

The only part of the output that is of concern, to me, is --

[code]
== BEGIN parted -l ==

Model: ATA WDC WD800JB-00JJ (scsi)
Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 115MB 115MB primary ext3 boot
2 115MB 79.2GB 79.1GB primary ext3
3 79.2GB 80.0GB 806MB primary linux-swap
4 80.0GB 80.0GB 49.4MB primary fat16


Error: Error opening /dev/md0: No such file or directory
Retry/Cancel? ./zxc.sh: line 102: 27141 Terminated parted -l
== END parted -l ==
[/code]
Rhetorical question. Why should "parted" attempt to open a non-existent device?

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: [Discussion] Proposals for getinfo.sh

Post by AlanBartlett » 2012/04/24 01:27:20

[img]http://www.centos.toracat.org/ajb/tmp/hmmm.gif[/img] Hmm . . . Someone needs to carefully check the manual page for [b]parted[/b] that is shipped with [i]EL5[/i] and [i]EL6[/i].

It won't be me, as I hear the call of my bed. [img]http://www.centos.toracat.org/ajb/tmp/bed.gif[/img]

User avatar
jlehtone
Posts: 4531
Joined: 2007/12/11 08:17:33
Location: Finland

Re: [Discussion] Proposals for getinfo.sh

Post by jlehtone » 2012/04/24 06:20:16

One pedantic note on the command availability check:
[code]# program="foo | bar"
# echo $program | cut -d ' ' -f 1
foo[/code]
It checks for only the first command of a pipe. Current list of commands has both 'sort' and 'grep' in the bar.

Second
[code]sysctl -a | grep "\.rp_filter"[/code]
matches "arp_filter" in addition to ".rp_filter". So within scripts this is not the way to protect a dot.
[code]sysctl -a | grep -F .rpfilter[/code]
might be more strict. But does it really matter?


Alan, your /dev/md0 does not have a partition table. You have made it a LVM physical volume directly. Both fdisk and parted tell that in their own ways.

CentOS 6.2 [url=http://pastebin.com/50E7e7FJ]output[/url]. Some tweaks ;-)

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: [Discussion] Proposals for getinfo.sh

Post by AlanBartlett » 2012/04/24 14:50:25

[quote]
Alan, your /dev/md0 does not have a partition table. You have made it a LVM physical volume directly. Both fdisk and parted tell that in their own ways.
[/quote]
Nooo . . . :-o I neither have any [b]LVM physical volume[/b]s nor any [b]md[/b] devices!

[code]
[ajb@GX1 ~]$ sudo /sbin/fdisk -lu

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 63 224909 112423+ 83 Linux
/dev/sda2 224910 154625624 77200357+ 83 Linux
/dev/sda3 154625625 156199994 787185 82 Linux swap / Solaris
/dev/sda4 156199995 156296384 48195 b W95 FAT32
[ajb@GX1 ~]$ sudo /sbin/parted -l

Model: ATA WDC WD800JB-00JJ (scsi)
Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 115MB 115MB primary ext3 boot
2 115MB 79.2GB 79.1GB primary ext3
3 79.2GB 80.0GB 806MB primary linux-swap
4 80.0GB 80.0GB 49.4MB primary fat16


[ajb@GX1 ~]$ ll /dev/md*
ls: /dev/md*: No such file or directory
[ajb@GX1 ~]$
[/code]

User avatar
jlehtone
Posts: 4531
Joined: 2007/12/11 08:17:33
Location: Finland

Re: [Discussion] Proposals for getinfo.sh

Post by jlehtone » 2012/04/24 20:03:44

[quote]AlanBartlett wrote:
Nooo . . . :-o I neither have any [b]LVM physical volume[/b]s nor any [b]md[/b] devices![/quote]
:oops: My mistake, I was apparently staring Trevor's output.

How could plain "parted -l" behave differently, when called from the script?

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: [Discussion] Proposals for getinfo.sh

Post by AlanBartlett » 2012/04/27 01:18:13

[quote]
How could plain "parted -l" behave differently, when called from the script?
[/quote]
That is what puzzled me. (And I was hoping that [b]Phil[/b] would have been able to explain the reason. :-? )

As promised, here follows the full output generated on that "corner-case" system, this time having booted the [i]CentOS 5.8[/i] "base" kernel --

Information for general problems.
[code]
== BEGIN uname -rmi ==
2.6.18-308.el5 i686 i386
== END uname -rmi ==

== BEGIN rpm -qa \*-release\* ==
rpmforge-release-0.5.2-2.el5.rf
elrepo-release-5-3.el5.elrepo
centos-release-notes-5.8-0
centos-release-5-8.el5.centos
centos-release-cr-5-7.el5.centos
== END rpm -qa \*-release\* ==

== BEGIN cat /etc/redhat-release ==
CentOS release 5.8 (Final)
== END cat /etc/redhat-release ==

== BEGIN getenforce ==
Enforcing
== END getenforce ==

== BEGIN free -m ==
total used free shared buffers cached
Mem: 756 525 230 0 34 398
-/+ buffers/cache: 92 664
Swap: 768 0 768
== END free -m ==

== BEGIN rpm -qa yum\* rpm-\* python | sort ==
python-2.4.3-46.el5
rpm-build-4.4.2.3-28.el5_8
rpm-libs-4.4.2.3-28.el5_8
rpm-python-4.4.2.3-28.el5_8
yum-3.2.22-39.el5.centos
yum-fastestmirror-1.1.16-21.el5.centos
yum-metadata-parser-1.1.2-3.el5.centos
yum-priorities-1.1.16-21.el5.centos
yum-utils-1.1.16-21.el5.centos
== END rpm -qa yum\* rpm-\* python | sort ==

== BEGIN ls /etc/yum.repos.d ==
CentOS-Base.repo
CentOS-CR.repo
CentOS-Debuginfo.hide
CentOS-Fasttrack.repo
CentOS-Media.repo
CentOS-Vault.hide
elrepo.repo
mirrors-rpmforge
mirrors-rpmforge-extras
mirrors-rpmforge-testing
rpmforge.repo
== END ls /etc/yum.repos.d ==

== BEGIN cat /etc/yum.conf ==
[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
bugtracker_url=http://bugs.centos.org/yum5bug

# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h

# installonly_limit = 5

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

exclude = redhat-artwork redhat-logos kernel kernel-PAE kernel-debug kernel-xen kernel-devel kernel-PAE-devel \
kernel-debug-devel kernel-xen-devel kernel-doc cdda2wav cdrecord mkisofs
== END cat /etc/yum.conf ==

== BEGIN yum repolist all ==
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: mirror.ellogroup.com
* elrepo: elrepo.reloumirrors.net
* extras: mirror.ellogroup.com
* fasttrack: mirror.ellogroup.com
* rpmforge: ftp-stud.fht-esslingen.de
* updates: mirror.ellogroup.com
Excluding Packages in global exclude list
Finished
135 packages excluded due to repository priority protections
repo id repo name status
base CentOS-5 - Base enabled: 2,711+14
c5-media CentOS-5 - Media disabled
centosplus CentOS-5 - Plus disabled
contrib CentOS-5 - Contrib disabled
cr CentOS-5 - CR enabled: 0
elrepo ELRepo.org Community Enterprise Linux Repos enabled: 483+16
elrepo-extras ELRepo.org Community Enterprise Linux Repos disabled
elrepo-kernel ELRepo.org Community Enterprise Linux Kerne disabled
elrepo-testing ELRepo.org Community Enterprise Linux Testi disabled
extras CentOS-5 - Extras enabled: 276
fasttrack CentOS-5 - Fasttrack enabled: 0
rpmforge RHEL 5 - RPMforge.net - dag enabled: 11,242+119
rpmforge-extras RHEL 5 - RPMforge.net - extras disabled
rpmforge-testing RHEL 5 - RPMforge.net - testing disabled
updates CentOS-5 - Updates enabled: 244+18
repolist: 14,956
== END yum repolist all ==

== BEGIN egrep 'include|exclude' /etc/yum.repos.d/*.repo ==
/etc/yum.repos.d/CentOS-CR.repo:# should expect to see included / excluded
== END egrep 'include|exclude' /etc/yum.repos.d/*.repo ==

== BEGIN sed -n -e "/^\[/h; /priority *=/{ G; s/\n/ /; s/ity=/ity = /; p }" /etc/yum.repos.d/*.repo | sort -k3n ==
priority = 10 [base]
priority = 10 [cr]
priority = 10 [extras]
priority = 10 [fasttrack]
priority = 10 [updates]
priority = 20 [elrepo]
priority = 20 [elrepo-extras]
priority = 20 [elrepo-kernel]
priority = 20 [elrepo-testing]
priority = 30 [rpmforge]
priority = 30 [rpmforge-extras]
priority = 30 [rpmforge-testing]
priority = 40 [centosplus]
priority = 50 [contrib]
== END sed -n -e "/^\[/h; /priority *=/{ G; s/\n/ /; s/ity=/ity = /; p }" /etc/yum.repos.d/*.repo | sort -k3n ==

== BEGIN cat /etc/fstab ==
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP swap swap defaults 0 0
/dev/sda4 /dos vfat noauto,user 0 0
== END cat /etc/fstab ==

== BEGIN df -h ==
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 72G 4.7G 63G 7% /
/dev/hda1 107M 54M 48M 53% /boot
tmpfs 379M 0 379M 0% /dev/shm
== END df -h ==

== BEGIN fdisk -l ==

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 14 112423+ 83 Linux
/dev/hda2 15 9625 77200357+ 83 Linux
/dev/hda3 9626 9723 787185 82 Linux swap / Solaris
/dev/hda4 9724 9729 48195 b W95 FAT32
== END fdisk -l ==

== BEGIN parted -l ==

Model: WDC WD800JB-00JJC0 (ide)
Disk /dev/hda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 115MB 115MB primary ext3 boot
2 115MB 79.2GB 79.1GB primary ext3
3 79.2GB 80.0GB 806MB primary linux-swap
4 80.0GB 80.0GB 49.4MB primary fat16


Error: Unable to open /dev/md0 - unrecognised disk label.

== END parted -l ==

== BEGIN blkid ==
/dev/hda1: LABEL="/boot" UUID="225057c4-1352-4f4a-8d40-9deaa11678c8" TYPE="ext3"
/dev/hda2: LABEL="/" UUID="50714765-a568-45b7-b42c-daab2cafa9d4" TYPE="ext3"
/dev/hda3: LABEL="SWAP" TYPE="swap"
/dev/hda4: SEC_TYPE="msdos" UUID="4D5A-B40C" TYPE="vfat"
== END blkid ==

== BEGIN cat /proc/mdstat ==
Personalities :
unused devices: <none>
== END cat /proc/mdstat ==

== BEGIN pvs ==
== END pvs ==

== BEGIN vgs ==
No volume groups found
== END vgs ==

== BEGIN lvs ==
No volume groups found
== END lvs ==

== BEGIN rpm -qa kernel\* | sort ==
kernel-2.6.18-128.el5
kernel-2.6.18-164.el5
kernel-2.6.18-194.el5
kernel-2.6.18-238.el5
kernel-2.6.18-274.el5
kernel-2.6.18-308.el5
kernel-2.6.18-53.el5
kernel-2.6.18-8.el5
kernel-2.6.18-92.el5
kernel-devel-2.6.18-128.el5
kernel-devel-2.6.18-164.el5
kernel-devel-2.6.18-194.el5
kernel-devel-2.6.18-238.el5
kernel-devel-2.6.18-274.el5
kernel-devel-2.6.18-308.el5
kernel-devel-2.6.18-53.el5
kernel-devel-2.6.18-8.el5
kernel-devel-2.6.18-92.el5
kernel-headers-2.6.18-308.4.1.el5
kernel-ml-2.6.35-14.el5.elrepo
kernel-ml-devel-2.6.35-14.el5.elrepo
== END rpm -qa kernel\* | sort ==

== BEGIN lspci -nn ==
00:00.0 Host bridge [0600]: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge [8086:7190] (rev 03)
00:01.0 PCI bridge [0604]: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge [8086:7191] (rev 03)
00:07.0 ISA bridge [0601]: Intel Corporation 82371AB/EB/MB PIIX4 ISA [8086:7110] (rev 02)
00:07.1 IDE interface [0101]: Intel Corporation 82371AB/EB/MB PIIX4 IDE [8086:7111] (rev 01)
00:07.2 USB controller [0c03]: Intel Corporation 82371AB/EB/MB PIIX4 USB [8086:7112] (rev 01)
00:07.3 Bridge [0680]: Intel Corporation 82371AB/EB/MB PIIX4 ACPI [8086:7113] (rev 02)
00:0f.0 PCI bridge [0604]: Digital Equipment Corporation DECchip 21152 [1011:0024] (rev 03)
00:11.0 Ethernet controller [0200]: 3Com Corporation 3c905B 100BaseTX [Cyclone] [10b7:9055] (rev 24)
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices [AMD] nee ATI 3D Rage Pro AGP 1X/2X [1002:4742] (rev 5c)
== END lspci -nn ==

== BEGIN lsusb ==
Protocol spec without prior Class and Subclass spec at line 4297
Bus 001 Device 001: ID 0000:0000
== END lsusb ==

== BEGIN rpm -qa kmod\* kmdl\* ==
== END rpm -qa kmod\* kmdl\* ==

== BEGIN ifconfig -a ==
eth0 Link encap:Ethernet HWaddr 00:C0:4F:24:66:81
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2c0:4fff:fe24:6681/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1432 Metric:1
RX packets:6432 errors:0 dropped:0 overruns:0 frame:0
TX packets:5024 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7115449 (6.7 MiB) TX bytes:530463 (518.0 KiB)
Interrupt:11 Base address:0xa000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:266 errors:0 dropped:0 overruns:0 frame:0
TX packets:266 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:13300 (12.9 KiB) TX bytes:13300 (12.9 KiB)

sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

== END ifconfig -a ==

== Warning: brctl is not installed ==

== BEGIN route -n ==
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 eth0
== END route -n ==

== BEGIN sysctl -a | grep .rp_filter ==
net.ipv4.conf.eth0.arp_filter = 0
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.lo.arp_filter = 0
net.ipv4.conf.lo.rp_filter = 0
net.ipv4.conf.default.arp_filter = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.arp_filter = 0
net.ipv4.conf.all.rp_filter = 0
== END sysctl -a | grep .rp_filter ==

== BEGIN ip rule show ==
0: from all lookup 255
32766: from all lookup main
32767: from all lookup default
== END ip rule show ==

== BEGIN ip route show ==
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.1
169.254.0.0/16 dev eth0 scope link
default via 192.168.1.254 dev eth0
== END ip route show ==

== BEGIN cat /etc/resolv.conf ==
nameserver 192.168.1.254
== END cat /etc/resolv.conf ==

== BEGIN grep net /etc/nsswitch.conf ==
#networks: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files
netmasks: files
networks: files
netgroup: nisplus
== END grep net /etc/nsswitch.conf ==

== BEGIN chkconfig --list | grep -Ei 'network|wpa' ==
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
== END chkconfig --list | grep -Ei 'network|wpa' ==

[/code]
Hmm . . . The [b]lsusb[/b] output looks "odd". :-o

User avatar
jlehtone
Posts: 4531
Joined: 2007/12/11 08:17:33
Location: Finland

Re: [Discussion] Proposals for getinfo.sh

Post by jlehtone » 2012/04/27 07:59:36

@Alan:
I have two CentOS 5.8: one i686 and one x86_64. Both do have a mysterious /dev/md0.

Their /etc/rc.d/rc.sysinit contains:
[code]# RAID setup
update_boot_stage RCraid
[ -x /sbin/nash ] && echo "raidautorun /dev/md0" | nash --quiet
if [ -f /etc/mdadm.conf ]; then
/sbin/mdadm -A -s
fi[/code]
It seems that CentOS 5 can create a /dev/md0 regardless of whether there is actual device. fdisk ignores the dummy, but parted doesn't.
[code]
# ls -l /dev/md*
brw-r----- 1 root disk 9, 0 Dec 19 11:44 /dev/md0
# fdisk -l /dev/md0
#[/code]
Have things changed from 2007?
http://forum.paldo.org/index.php?action=topic&topicnr=142&pagenr=1

Just noticed:
[code]grep net /etc/nsswitch.conf[/code]
could be expanded to
[code]egrep 'net|hosts' /etc/nsswitch.conf[/code]
in the network section. Then it would tell about name resolution too.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: [Discussion] Proposals for getinfo.sh

Post by pschaff » 2012/04/27 21:10:51

Good suggestion on the egrep. I'm still hung up on the parted hang-up. I have no idea why it would act differently within the script, unless possibly it wants to see stdin, but then why would it not always hang. Perhaps parted should only be called if there is a GPT partition, but I have not worked out how to do that.

Will try to spend some time on this over the weekend. It has not gotten near the top of this week's ToDo list.

User avatar
jlehtone
Posts: 4531
Joined: 2007/12/11 08:17:33
Location: Finland

Re: [Discussion] Proposals for getinfo.sh

Post by jlehtone » 2012/05/04 07:36:18

Disk note:
[code]fdisk -l[/code]
does not show potential partition alignment issues as well as
[code]fdisk -lu[/code]
does.

Even better would be adding the "-c" flag (switch off DOS-compatible mode) but CentOS-5 does not support it and
[code]fdisk -luc 2> /dev/null || fdisk -lu[/code]
would be an overkill.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: [Discussion] Proposals for getinfo.sh

Post by pschaff » 2012/05/04 11:01:53

So "fdisk -lu" seems reasonable. Maybe [i]this[/i] weekend will see a new revision, [i]real life[/i] permitting.

Post Reply