hardware discovery commands

44
Hardware Discovery Kevin B. O'Brien Washtenaw Linux Users Group

Upload: kevin-obrien

Post on 25-May-2015

291 views

Category:

Technology


4 download

DESCRIPTION

This is a presentation that looks ta some of the Linux commands you could use to identify the hardware on your system. This can be useful for troubleshooting, or just for figuring out which motherboard is in which box.

TRANSCRIPT

Page 1: Hardware Discovery Commands

Hardware Discovery

Kevin B. O'BrienWashtenaw Linux Users Group

Page 2: Hardware Discovery Commands

Why You Need To Know

Problem solving – Maybe the graphics driver you are using does not match the video card you have.

Upgrading – What is the older hardware on your system?

Just figuring out what you have in various boxes if you have a home network with multiple machines, or if you support a network with multiple machines

Page 3: Hardware Discovery Commands

Linux Has Solutions

Not just one, but many possible solutions Different commands can be used to extract

different information There are more possible commands you might

use than we can cover in a single presentation, so take this as a jumping-off point

Page 4: Hardware Discovery Commands

lshw 1

This is a good starting point for exploration ls = list, hw= hardware, so lshw = list my

hardware Many of these commands start with ls Most of these work better with root privileges,

so either su to the root account or prefix the command with sudo

Note that sections in the output are noted by *- at the beginning of the line

Page 5: Hardware Discovery Commands

lshw 2

kimballdescription: Desktop Computerproduct: GA-MA785GT-UD3Hvendor: Gigabyte Technology Co., Ltd.width: 64 bitscapabilities: smbios-2.4 dmi-2.4 vsyscall64 vsyscall32configuration: boot=normal chassis=desktop uuid=30303234-3144-3846-4339-4232FFFFFFFF*-coredescription: Motherboardproduct: GA-MA785GT-UD3Hvendor: Gigabyte Technology Co., Ltd.physical id: 0version: x.x

Page 6: Hardware Discovery Commands

lshw 3

We can see from this section that the motherboard is a Gigabyte GA-MA785GT-UD3H

We can see that it is a 64-bit motherboard So if I wanted to put more than 4GB of RAM

into this box, I could probably do it And since I know which one it is, I know which

manual to pick up ☺

Page 7: Hardware Discovery Commands

lshw 4

*-firmwaredescription: BIOSvendor: Award Software International, Inc.physical id: 0version: F1 (07/03/2009)size: 128KiBcapacity: 960KiB

Page 8: Hardware Discovery Commands

lshw 5

I see that the BIOS is from Award, version F1, dated 7/3/2009

Now I can go to the Award site and see if I have the latest BIOS

Don't upgrade the BIOS unless you have a good reason, like you are having a problem that is known to be fixed by the upgrade

Page 9: Hardware Discovery Commands

lshw 6

*-cpudescription: CPUproduct: AMD Athlon(tm) II X2 240 Processorvendor: Advanced Micro Devices [AMD]physical id: 4bus info: cpu@0version: AMD Athlon(tm) II X2 240 Processorslot: Socket M2size: 800MHzcapacity: 3GHzwidth: 64 bitsclock: 200MHz

Page 10: Hardware Discovery Commands

lshw 7

In this section I can see my CPU is an AMD Athlon II, and it is 64-bit

That is probably a good thing since I already know my motherboard is 64-bit ☺

I also see it is an 800 Mz processor. Maybe I want to upgrade it.

Looking at the motherboard I can see what my options are if I keep the motherboard

Page 11: Hardware Discovery Commands

lscpu 1

If I want just info on my CPU I could also use lscpu

This info is in lshw as well, but that is a very large amount of output

Using lscpu gets just this if I need it

Page 12: Hardware Discovery Commands

lscpu 2

Architecture: x86_64CPU op-mode(s): 64-bitCPU(s): 2Thread(s) per core: 1Core(s) per socket: 2CPU socket(s): 1NUMA node(s): 1Vendor ID: AuthenticAMDCPU family: 16Model: 6Stepping: 2CPU MHz: 800.000Virtualization: AMD-VL1d cache: 64KL1i cache: 64KL2 cache: 1024K

Page 13: Hardware Discovery Commands

lscpu 3

Here we can easily see that it is a dual-core processor

This is useful to know when interpreting things like the top command, since it will tend to show a percent of the individual core used for each process

I can also see my cache capacity

Page 14: Hardware Discovery Commands

lshw 8

Back to lshw, there is more to see here RAM is something you might want to know

about

Page 15: Hardware Discovery Commands

lshw 9

*-memory description: System Memory physical id: 29 slot: System board or motherboard size: 16GiB *-bank:0 description: DIMM 1066 MHz (0.9 ns) product: None vendor: None physical id: 0 serial: None slot: A0 size: 4GiB width: 64 bits clock: 1066MHz (0.9ns)

Page 16: Hardware Discovery Commands

lshw 10

We can see that this system has 16 GB of RAM We can see that the first bank, which is Bank 0,

has a 4GB stick of RAM, with a clock speed of 1066 MHz, and a 64-bit data path

I left out the other three banks of RAM, which are identical to Bank 0

Page 17: Hardware Discovery Commands

lshw 11

*-pci:0 description: Host bridge product: RS880 Host Bridge vendor: Hynix Semiconductor (Hyundai Electronics) physical id: 100 bus info: pci@0000:00:00.0 version: 00 width: 64 bits clock: 66MHz configuration: latency=32 resources: memory:0-1fffffff

Page 18: Hardware Discovery Commands

lshw 12

*-display description: VGA compatible controller product: RS880 [Radeon HD 4200] vendor: ATI Technologies Inc physical id: 5 bus info: pci@0000:01:05.0 version: 00 width: 32 bits clock: 33MHz capabilities: pm msi vga_controller bus_master cap_list rom configuration: driver=radeon latency=0 resources: irq:18 memory:d0000000-dfffffff ioport:ee00(size=256) memory:fdfe0000-fdfeffff memory:fde00000-fdefffff

Page 19: Hardware Discovery Commands

lshw 13

*-multimedia description: Audio device product: RS880 Audio Device [Radeon HD 4200] vendor: ATI Technologies Inc physical id: 5.1 bus info: pci@0000:01:05.1 version: 00 width: 32 bits clock: 33MHz capabilities: pm msi bus_master cap_list configuration: driver=HDA Intel latency=0 resources: irq:19 memory:fdffc000-fdffffff

Page 20: Hardware Discovery Commands

lshw 14

The next section gets into PCI devices The host device uses a chipset from Hynix

Semiconductor The video and audio are both using ATI chips Both video and audio are onboard devices on

this machine, not separate add-on cards

Page 21: Hardware Discovery Commands

lspci 1

Again, if you wanted to go there more directly you could use lspci

This gives you more compact information than lshw

Page 22: Hardware Discovery Commands

lspci 2

00:00.0 Host bridge: Advanced Micro Devices [AMD] RS880 Host Bridge00:01.0 PCI bridge: Advanced Micro Devices [AMD] RS780/RS880 PCI to PCI bridge (int gfx)00:0a.0 PCI bridge: Advanced Micro Devices [AMD] RS780/RS880 PCI to PCI bridge (PCIE port 5)00:11.0 SATA controller: ATI Technologies Inc SB7x0/SB8x0/SB9x0 SATA Controller [IDE mode]00:12.0 USB Controller: ATI Technologies Inc SB7x0/SB8x0/SB9x0 USB OHCI0 Controller00:12.1 USB Controller: ATI Technologies Inc SB7x0 USB OHCI1 Controller00:12.2 USB Controller: ATI Technologies Inc SB7x0/SB8x0/SB9x0 USB EHCI Controller00:13.0 USB Controller: ATI Technologies Inc SB7x0/SB8x0/SB9x0 USB OHCI0 Controller00:13.1 USB Controller: ATI Technologies Inc SB7x0 USB OHCI1 Controller00:13.2 USB Controller: ATI Technologies Inc SB7x0/SB8x0/SB9x0 USB EHCI Controller00:14.0 SMBus: ATI Technologies Inc SBx00 SMBus Controller (rev 3c)00:14.1 IDE interface: ATI Technologies Inc SB7x0/SB8x0/SB9x0 IDE Controller00:14.2 Audio device: ATI Technologies Inc SBx00 Azalia (Intel HDA)

Page 23: Hardware Discovery Commands

lshw 15

*-storage description: SATA controller product: SB7x0/SB8x0/SB9x0 SATA Controller [IDE mode] vendor: ATI Technologies Inc physical id: 11

*-disk:0 description: ATA Disk product: SAMSUNG HD103UJ physical id: 0 bus info: scsi@2:0.0.0 logical name: /dev/sda version: 1AA0 serial: S13PJ1LS629769 size: 931GiB (1TB)

Page 24: Hardware Discovery Commands

lshw 16

*-volume:0 description: EXT4 volume vendor: Linux physical id: 1 bus info: scsi@2:0.0.0,1 logical name: /dev/sda1 logical name: / version: 1.0 serial: 5ec20315-eae8-4a00-9207-1bc29276802c size: 93GiB capacity: 93GiB

Page 25: Hardware Discovery Commands

lshw 17

Here you can see that I have a 1TB SATA drive attached for storage

It is device /dev/sda It is partitioned, and the first partition is

/dev/sda1, which has as size of 93GB And the file system on it is ext4 There is also an extended partition, etc.

Page 26: Hardware Discovery Commands

blkid 1

Hard drives are examples of what we call “block devices”

They get this name because they move data in blocks

Other examples are Optical drives, flash memory, thumb drives, and memory cards

You can use this command to get into on all of your block devices

Page 27: Hardware Discovery Commands

blkid 2

/dev/sda1: UUID="5ec20315-eae8-4a00-9207-1bc29276802c" TYPE="ext4" /dev/sda5: UUID="4ae2bbc0-2599-4613-8993-8ea37d6efad3" TYPE="ext4" /dev/sda6: UUID="5205a37e-bab5-4db8-9e75-1ce70f8059db" TYPE="ext4" /dev/sda7: UUID="1a021347-4e03-40fb-84c6-44c306e02c0c" TYPE="swap" /dev/sdb1: UUID="750d70ef-74bc-4fbd-8a3b-21fc8f1cb5a0" TYPE="ext4"

Page 28: Hardware Discovery Commands

blkid 3

You see it is a pretty simple listing Right now all you see are the hard drive

partitions CDs may not appear since they do not have a

UUID But see what happens when I plug in a thumb

drive

Page 29: Hardware Discovery Commands

blkid 4

/dev/sda1: UUID="5ec20315-eae8-4a00-9207-1bc29276802c" TYPE="ext4" /dev/sda5: UUID="4ae2bbc0-2599-4613-8993-8ea37d6efad3" TYPE="ext4" /dev/sda6: UUID="5205a37e-bab5-4db8-9e75-1ce70f8059db" TYPE="ext4" /dev/sda7: UUID="1a021347-4e03-40fb-84c6-44c306e02c0c" TYPE="swap" /dev/sdb1: UUID="750d70ef-74bc-4fbd-8a3b-21fc8f1cb5a0" TYPE="ext4" /dev/sdc1: UUID="67EA-005E" TYPE="vfat"

Page 30: Hardware Discovery Commands

blkid 5

I have also used this with an SD Memory card I needed to format it with an image for booting

using the dd command, and I needed to know what my target was

So blkid is less info than lshw, but if all you need to know is the identifier of each device and where it is mounted, this gets you there quickly

Page 31: Hardware Discovery Commands

lshw 18

The next section of lshw, and the last we will look at in this presentation, will cover USB

This will list the USB ports on your machine, and their characteristics

I am just going to show the info for one of my ports

Page 32: Hardware Discovery Commands

lshw 19

*-usb:0 description: USB Controller product: SB7x0/SB8x0/SB9x0 USB OHCI0 Controller vendor: ATI Technologies Inc physical id: 12 bus info: pci@0000:00:12.0 version: 00 width: 32 bits clock: 66MHz capabilities: ohci bus_master configuration: driver=ohci_hcd latency=32 resources: irq:16 memory:fe02e000-fe02efff

Page 33: Hardware Discovery Commands

lsusb 1

You might want to try an alternative, the lsusb command, which I find more useful

Page 34: Hardware Discovery Commands

lsusb 2

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 004 Device 002: ID 0d3d:0001 Tangtop Technology Co., Ltd HID KeyboardBus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 002 Device 002: ID 0781:5406 SanDisk Corp. Cruzer Micro U3Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 001 Device 004: ID 046d:081b Logitech, Inc. Bus 001 Device 002: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port HubBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Page 35: Hardware Discovery Commands

lsusb 3

As you can see, this just lists the devices, but sometimes that is all you want to know

I can see my keyboard and mouse here The thumb drive I plugged in to demonstrate

the blkid command is listed here as well

Page 36: Hardware Discovery Commands

dmidecode 1

This is useful for getting info from the BIOS For example, does your BIOS support booting

from a CD? Or is your BIOS upgradeable?

Page 37: Hardware Discovery Commands

dmidecode 2

Vendor: Award Software International, Inc. Version: F1 Release Date: 07/03/2009 Address: 0xE0000 Runtime Size: 128 kB ROM Size: 1024 kB Characteristics: ISA is supported PCI is supported PNP is supported APM is supported BIOS is upgradeable BIOS shadowing is allowed Boot from CD is supported Selectable boot is supported BIOS ROM is socketed

Page 38: Hardware Discovery Commands

dmidecode 3

EDD is supported5.25"/360 KB floppy services are supported (int 13h)5.25"/1.2 MB floppy services are supported (int 13h)3.5"/720 KB floppy services are supported (int 13h)3.5"/2.88 MB floppy services are supported (int 13h)Print screen service is supported (int 5h)8042 keyboard services are supported (int 9h)Serial services are supported (int 14h)Printer services are supported (int 17h)CGA/mono video services are supported (int 10h)ACPI is supportedUSB legacy is supportedAGP is supportedLS-120 boot is supportedATAPI Zip drive boot is supportedBIOS boot specification is supportedTargeted content distribution is supported

Page 39: Hardware Discovery Commands

Is it working?

Sometimes the problem is that the hardware does not seem to be working

If you cannot find the hardware using one of these commands, that could be your problem

If it does not appear, you need to do some trouble-shooting

If it is an expansion card, for instance, make sure it is securely seated in the socket

Page 40: Hardware Discovery Commands

lsmod 1

If the hardware seems to be there, but it is not working for you, you might want to check at the software level

Hardware needs drivers to work In Linux, these drivers tend to take the form of

kernel modules The lsmod command lets you see what

modules are installed in the module

Page 41: Hardware Discovery Commands

lsmod 2

Module Size Used bynls_iso8859_1 12713 1 nls_cp437 16991 1 vfat 21708 1 fat 61374 1 vfatusb_storage 53538 1 uas 17996 0 nls_utf8 12557 0 udf 93525 0 snd_hrtimer 12784 1 binfmt_misc 17565 1 vboxnetadp 13382 0 vboxnetflt 28297 0 vboxdrv 268268 2 vboxnetadp,vboxnetflt

Page 42: Hardware Discovery Commands

lsmod 3

This is a simple listing of the contents of /proc/modules

You could get essentially the same information by running cat /proc/modules, but this is easier to read

If you do not find the module loaded, that could be your problem

modprobe is a command for loading modules, but a description is beyond this presentation

Page 43: Hardware Discovery Commands

More information

Each of the commands we have discussed can do more

For each command we have covered there is a man page (man is short for manual)

To see it, use man <commandname> To read through it, use Page Up and Page

Down When you are finished reading the man page,

Ctrl+z will get you back to your terminal with a command prompt

Page 44: Hardware Discovery Commands

This and Other Presentations

All of my presentations can be found at http://www.zwilnik.com/ in the Slide Shows area

All presentation can be downloaded as LibreOffice/OpenOffice *.odp files, and are licensed under Creative Commons

They can also be run as slide shows in your browser using the links there

You can reach me at [email protected]