Wednesday 12 May 2021

UNIX System Information - Linux

OS Version

A more complete operating system version string can be found in /proc/version. For example, on a Mandrake Linux 9.1 system:

$ cat /proc/version
Linux version 2.4.21-0.33mdkenterprise (qateam@updates.mandrakesoft.com) (gcc version 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)) #1 SMP Wed Aug 11 10:09:17 MDT 2004

On many distributions the name and version of the distribution can be found in a file under /etc/:

  • Generic: /etc/os-release
  • Red Hat and derivatives: /etc/redhat-release
  • Debian and derivatives: /etc/debian_version
  • SuSE: /etc/SuSE-release

For example, on a Mandrake Linux 9.1 system:

$ cat /etc/redhat-release
Mandrake Linux release 9.1 (Bamboo) for i586

Another possibility is to look at /etc/issue. For example for a Ubuntu 8.04 (Hardy) system:

$ cat /etc/issue
Ubuntu 8.04.1 \n \l

Generally the most portable method to get distribution information is to use one of the Linux Standard Base tools: lsb_release.

For example for a Mandrake Linux 9.0 system:

$ lsb_release -a
LSB Version:    1.2
Distributor ID: Mandrake
Description:    Mandrake Linux
Release:        9.0
Codename:       dolphin

Or for a Ubuntu 8.04 (Hardy) system:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 8.04.1
Release:	8.04
Codename:	hardy

If the lsb_release tool is not installed, equivalent information may be available in /etc/lsb-release.

Installed Packages

For deb/apt based distributions (e.g. Debian and Ubuntu) dpkg is used to list the installed packages. For example, on a Ubuntu 8.04 (Hardy) system:

$ dpkg --list
 Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name                                Version                             Description
+++-===================================-===================================-======================================================================================
ii  acl                                 2.2.45-1                            Access control list utilities
ii  acpi                                0.09-3ubuntu1                       displays information on ACPI devices
ii  acpi-support                        0.109                               a collection of useful events for acpi
ii  acpid                               1.0.4-5ubuntu9                      Utilities for using ACPI power management
...
ii  zip                                 2.32-1                              Archiver for .zip files
ii  zlib1g                              1:1.2.3.3.dfsg-7ubuntu1             compression library - runtime
ii  zlib1g-dev                          1:1.2.3.3.dfsg-7ubuntu1             compression library - development

For RPM based distributions (e.g. RedHat, CentOS and Mandriva) the rpm command is used. For example, on a CentOS 4.7 system:

$ rpm -q -a
basesystem-8.0-4
pyxf86config-0.3.19-1
prelink-0.3.3-0.EL4
dump-0.4b39-3.EL4.2
finger-0.17-26.EL4.1
...
xorg-x11-xdm-6.8.2-1.EL.52
gnome-utils-2.8.0-7.el4
mod_ssl-2.0.52-41.ent.centos4
kdebase-devel-3.3.1-11.el4.centos
kernel-2.6.9-78.0.5.EL

CPU

Details of the installed processors can be found in /proc/cpuinfo:

$ cat /proc/cpuinfo
processor       : 0
vendor_id       : CentaurHauls
cpu family      : 6
model           : 7
model name      : VIA Samuel 2
stepping        : 3
cpu MHz         : 599.723
cache size      : 64 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu de tsc msr cx8 mtrr pge mmx 3dnow
bogomips        : 1196.03

On SMP kernels (the default in most distributions) each processor and logical core is reported, which can make the output a bit large and repetitive. For example an Intel Atom N270 reports two logical cores due to hyper-threading:

$ cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
microcode	: 0x212
cpu MHz		: 1600.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fdiv_bug	: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts aperfmperf eagerfpu pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm dtherm
bugs		:
bogomips	: 3199.95
clflush size	: 64
cache_alignment	: 64
address sizes	: 32 bits physical, 32 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
microcode	: 0x212
cpu MHz		: 1600.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 1
initial apicid	: 1
fdiv_bug	: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts aperfmperf eagerfpu pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm dtherm
bugs		:
bogomips	: 3199.95
clflush size	: 64
cache_alignment	: 64
address sizes	: 32 bits physical, 32 bits virtual
power management:

For more compact output use lscpu instead:

$ lscpu
Architecture:        i686
CPU op-mode(s):      32-bit
Byte Order:          Little Endian
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  2
Core(s) per socket:  1
Socket(s):           1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               28
Model name:          Intel(R) Atom(TM) CPU N270   @ 1.60GHz
Stepping:            2
CPU MHz:             1600.000
CPU max MHz:         1600.0000
CPU min MHz:         800.0000
BogoMIPS:            3199.95
L1d cache:           24K
L1i cache:           32K
L2 cache:            512K
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts aperfmperf eagerfpu pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm dtherm

Update: recent versions of lscpu have explicit reporting on processor vulnerabilities. For example for an Intel i7-860:

$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   36 bits physical, 48 bits virtual
CPU(s):                          2
On-line CPU(s) list:             0,1
Thread(s) per core:              1
Core(s) per socket:              2
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           30
Model name:                      Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz
Stepping:                        5
CPU MHz:                         2808.710
BogoMIPS:                        5617.42
Hypervisor vendor:               KVM
Virtualization type:             full
L1d cache:                       64 KiB
L1i cache:                       64 KiB
L2 cache:                        512 KiB
L3 cache:                        16 MiB
NUMA node0 CPU(s):               0,1
Vulnerability Itlb multihit:     KVM: Mitigation: VMX unsupported
Vulnerability L1tf:              Mitigation; PTE Inversion
Vulnerability Mds:               Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Retpolines, STIBP disabled, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni ssse3 cx16 sse4_1 sse4_2 x2apic hypervisor lahf_lm pti flush_l1d

Since this is on a VirtualBox VM some of the reported information is a different from running native (e.g. 'Thread(s) per core' would normally be '2').

Memory

Details of the memory configuration can be found in /proc/meminfo:

$ cat /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
Mem:  489811968 410542080 79269888        0 56160256 177897472
Swap: 1069244416 21245952 1047998464
MemTotal:       478332 kB
MemFree:         77412 kB
MemShared:           0 kB
Buffers:         54844 kB
Cached:         168512 kB
SwapCached:       5216 kB
Active:          78072 kB
Inactive:       229604 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       478332 kB
LowFree:         77412 kB
SwapTotal:     1044184 kB
SwapFree:      1023436 kB

Showing the physical memory (512 MiB minus shared and reserved regions) and swap (approx. 1 GB).

Update: on modern kernels the /proc/meminfo information has gotten much larger as more details have been added:

$ cat /proc/meminfo
MemTotal:        4023648 kB
MemFree:          972316 kB
MemAvailable:    3173592 kB
Buffers:           72604 kB
Cached:          2289744 kB
SwapCached:            0 kB
Active:           318200 kB
Inactive:        2504312 kB
Active(anon):       1132 kB
Inactive(anon):   471544 kB
Active(file):     317068 kB
Inactive(file):  2032768 kB
Unevictable:          96 kB
Mlocked:              96 kB
SwapTotal:        999420 kB
SwapFree:         999420 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:        458244 kB
Mapped:           208872 kB
Shmem:             12512 kB
KReclaimable:     109196 kB
Slab:             154320 kB
SReclaimable:     109196 kB
SUnreclaim:        45124 kB
KernelStack:        6080 kB
PageTables:        12388 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     3011244 kB
Committed_AS:    3011364 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       37844 kB
VmallocChunk:          0 kB
Percpu:             1416 kB
HardwareCorrupted:     0 kB
AnonHugePages:    206848 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      137152 kB
DirectMap2M:     4057088 kB

So lsmem has been introduced to give a simpler summary:

$ lsmem
RANGE                                  SIZE  STATE REMOVABLE BLOCK
0x0000000000000000-0x00000000dfffffff  3.5G online       yes  0-27
0x0000000100000000-0x0000000127ffffff  640M online       yes 32-36

Memory block size:       128M
Total online memory:     4.1G
Total offline memory:      0B

Although this is a little brief when looking for installed RAM and configured swap.

Devices

The /proc file system contains various files that can be used to obtain information about the hardware present in a system.

PCI Devices

On Linux 2.4 and earlier kernels examining /proc/pci will provide all the information on the PCI bus you could ever want:

$ cat /proc/pci
PCI devices found:
  Bus  0, device   0, function  0:
    Host bridge: PCI device 1106:3123 (VIA Technologies, Inc.) (rev 0).
      Master Capable.  Latency=8.  
      Prefetchable 32 bit memory at 0xd0000000 [0xd7ffffff].
  Bus  0, device   1, function  0:
    PCI bridge: VIA Technologies, Inc. VT8633 [Apollo Pro266 AGP] (rev 0).
      Master Capable.  No bursts.  Min Gnt=12.
  Bus  0, device  13, function  0:
    FireWire (IEEE 1394): VIA Technologies, Inc. IEEE 1394 Host Controller (rev 128).
      IRQ 12.
      Master Capable.  Latency=32.  Max Lat=32.
      Non-prefetchable 32 bit memory at 0xde000000 [0xde0007ff].
      I/O at 0xd000 [0xd07f].
  Bus  0, device  16, function  0:
    USB Controller: VIA Technologies, Inc. USB (rev 128).
      IRQ 11.
      Master Capable.  Latency=32.  
      I/O at 0xd400 [0xd41f].
  Bus  0, device  16, function  1:
    USB Controller: VIA Technologies, Inc. USB (#2) (rev 128).
      IRQ 12.
      Master Capable.  Latency=32.  
      I/O at 0xd800 [0xd81f].
  Bus  0, device  16, function  2:
    USB Controller: VIA Technologies, Inc. USB (#3) (rev 128).
      IRQ 10.
      Master Capable.  Latency=32.  
      I/O at 0xdc00 [0xdc1f].
  Bus  0, device  16, function  3:
    USB Controller: VIA Technologies, Inc. USB 2.0 (rev 130).
      IRQ 5.
      Master Capable.  Latency=32.  
      Non-prefetchable 32 bit memory at 0xde001000 [0xde0010ff].
  Bus  0, device  17, function  0:
    ISA bridge: VIA Technologies, Inc. VT8233A ISA Bridge (rev 0).
  Bus  0, device  17, function  1:
    IDE interface: VIA Technologies, Inc. VT82C586B PIPC Bus Master IDE (rev 6).
      Master Capable.  Latency=32.  
      I/O at 0xe000 [0xe00f].
  Bus  0, device  17, function  5:
    Multimedia audio controller: VIA Technologies, Inc. VT8233 AC97 Audio Controller (rev 80).
      IRQ 10.
      I/O at 0xe400 [0xe4ff].
  Bus  0, device  18, function  0:
    Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 116).
      IRQ 11.
      Master Capable.  Latency=32.  Min Gnt=3.Max Lat=8.
      I/O at 0xec00 [0xecff].
      Non-prefetchable 32 bit memory at 0xde002000 [0xde0020ff].
  Bus  1, device   0, function  0:
    VGA compatible controller: PCI device 1106:3122 (VIA Technologies, Inc.) (rev 3).
      IRQ 11.
      Master Capable.  Latency=32.  Min Gnt=2.
      Prefetchable 32 bit memory at 0xd8000000 [0xdbffffff].
      Non-prefetchable 32 bit memory at 0xdc000000 [0xdcffffff].

On Linux 2.6 kernel systems the PCI device descriptions are no longer compiled into the kernel by default. So to get the descriptions use the lspci command:

$ lspci
00:00.0 Host bridge: VIA Technologies, Inc. VT8623 [Apollo CLE266]
00:01.0 PCI bridge: VIA Technologies, Inc. VT8633 [Apollo Pro266 AGP]
00:0d.0 FireWire (IEEE 1394): VIA Technologies, Inc. IEEE 1394 Host Controller (rev 80)
00:10.0 USB Controller: VIA Technologies, Inc. USB (rev 80)
00:10.1 USB Controller: VIA Technologies, Inc. USB (rev 80)
00:10.2 USB Controller: VIA Technologies, Inc. USB (rev 80)
00:10.3 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 82)
00:11.0 ISA bridge: VIA Technologies, Inc. VT8235 ISA Bridge
00:11.1 IDE interface: VIA Technologies, Inc. VT82C586/B/686A/B PIPC Bus Master IDE (rev 06)
00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233 AC97 Audio Controller (rev 50)
00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 74)
01:00.0 VGA compatible controller: VIA Technologies, Inc. VT8623 [Apollo CLE266] integrated CastleRock graphics (rev 03)

The -v option can be used to get more detailed output similar to the old /proc/pci information.

USB Devices

On Linux 2.4 and earlier kernels examining /proc/bus/usb/devices will provide all the information on the USB devices you could ever want:

$ cat /proc/bus/usb/devices 
T:  Bus=04 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 6
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.04
S:  Manufacturer=Linux 2.4.21-0.33mdk ehci-hcd
S:  Product=VIA Technologies, Inc. USB 2.0
S:  SerialNumber=00:10.3
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=256ms
T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=067b ProdID=3507 Rev= 1.00
S:  Manufacturer=Prolific Technology Inc.
S:  Product=Mass Storage Device
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
T:  Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 0.00
S:  Product=USB UHCI Root Hub
S:  SerialNumber=dc00
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms
T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 0.00
S:  Product=USB UHCI Root Hub
S:  SerialNumber=d800
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 0.00
S:  Product=USB UHCI Root Hub
S:  SerialNumber=d400
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms

On 2.6 kernels use the lsusb command instead:

$ lsusb
Bus 010 Device 002: ID 2040:9950 Hauppauge 
Bus 010 Device 001: ID 0000:0000  
Bus 011 Device 002: ID 2040:9950 Hauppauge 
Bus 011 Device 001: ID 0000:0000  
Bus 009 Device 001: ID 0000:0000  
Bus 008 Device 001: ID 0000:0000  
Bus 004 Device 001: ID 0000:0000  
Bus 007 Device 001: ID 0000:0000  
Bus 006 Device 001: ID 0000:0000  
Bus 005 Device 001: ID 0000:0000  
Bus 003 Device 001: ID 0000:0000  
Bus 002 Device 001: ID 0000:0000  
Bus 001 Device 001: ID 0000:0000  

In this version the root hub devices provided by the driver don't display a name. In more recent versions the root hubs are named and the USB version stated:

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

For more detailed information about the devices use lsusb -v (this generates a lot of output), for a summary giving a connection tree use lsusb -t:

$ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/8p, 480M
    |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M

This loses the device names, however the verbose tree (lsusb -tv) addresses that problem:

$ lsusb -tv
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/8p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        ID 80ee:0021 VirtualBox USB Tablet

Giving a topology for the USB devices.

Firewire Devices

To get details of Firewire (IEEE-1394) devices see /proc/bus/ieee1394/devices:

$ cat /proc/bus/ieee1394/devices 
Node[01:1023]  GUID[0040635000009d72]:
  Vendor ID: `Linux OHCI-1394' [0x004063]
  Capabilities: 0x0083c0
  Bus Options:
    IRMC(1) CMC(1) ISC(1) BMC(0) PMC(0) GEN(0)
    LSPD(2) MAX_REC(2048) CYC_CLK_ACC(0)
  Host Node Status:
    Host Driver     : ohci1394
    Nodes connected : 2
    Nodes active    : 2
    SelfIDs received: 2
    Irm ID          : [01:1023]
    BusMgr ID       : [01:1023]
    In Bus Reset    : no
    Root            : yes
    Cycle Master    : yes
    IRM             : yes
    Bus Manager     : yes
Node[00:1023]  GUID[0050770e00071002]:
  Vendor ID: `Prolific PL3507 Combo Device' [0x005077]
  Capabilities: 0x0083c0
  Bus Options:
    IRMC(0) CMC(0) ISC(0) BMC(0) PMC(0) GEN(0)
    LSPD(0) MAX_REC(64) CYC_CLK_ACC(255)
  Unit Directory 0:
    Vendor/Model ID: Prolific PL3507 Combo Device [005077] / (1394-ATAPI rev1.10) [000001]
    Software Specifier ID: 00609e
    Software Version: 010483
    Length (in quads): 8

From Linux 2.6.33 a "new" Firewire stack is used, which changes the kernel modules used (see LKML: Linus Torvalds: Linux 2.6.33-rc3). This also moves the Firewire files into the /sys/ tree. For simple cases the contents of the vendor_name and model_name files may be enough:

$ cat /sys/bus/firewire/devices/fw*/vendor_name 
Linux Firewire
Shecom
Prolific PL3507 Combo Device
$ cat /sys/bus/firewire/devices/fw*/model_name 
Juju
ikebana
(1394 ATAPI,Rev 1.00)

When more information is required the lsfirewire script from cladisch/linux-firewire-utils: Linux FireWire bus inspection and configuration tools will help:

$ lsfirewire
fw0: Linux Firewire Juju
fw1: Shecom ikebana
fw2: Prolific PL3507 Combo Device (1394 ATAPI,Rev 1.00)
$ lsfirewire -v
device fw0:
  vendor ID: 0x001f11
  model ID: 0x023901
  vendor: Linux Firewire
  model: Juju
  guid: 0x0011060000007427
device fw1:
  vendor ID: 0x00d04b
  hardware version ID: 0x00f911
  vendor: Shecom
  hardware version: OXFW911
  guid: 0x00d04b0000003382
  units: 0x00609e:0x010483
  unit fw1.0:
    model ID: 0x000001
    model: ikebana
    specifier ID: 0x00609e
    version: 0x010483
device fw2:
  vendor ID: 0x005077
  vendor: Prolific PL3507 Combo Device
  guid: 0x0050770e00000001
  units: 0x00609e:0x010483
  unit fw2.0:
    model ID: 0x000001
    model: (1394 ATAPI,Rev 1.00)
    specifier ID: 0x00609e
    version: 0x010483

In this case 'fw0' is the system generated device for the Firewire interface. In this case that is being provided by a PCI card, and so lspci provides more information about that device.

Virtual Machine

Using a Virtual Machine (VM) to host the operating system will often be evident by the presence of unusual hardware or configurations that would not be possible when running on native hardware.

VMware

Various devices are handled as virtual devices by VMware and are named accordingly.

For example: running the lspci command on a Linux guest system running under VMware will report various virtual devices with names containing "VMware":

00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.7 PCI bridge: VMware PCI Express Root Port (rev 01)
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)

Similar indications can be found in the boot messages, available via dmesg:

> dmesg | grep 'VMware'
DMI: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 02/22/2012
hda: VMware Virtual IDE CDROM Drive, ATAPI CD/DVD-ROM drive
  Vendor: VMware    Model: Virtual disk      Rev: 1.0 
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware memory control driver initialized
VMware memory control driver unloaded
VMware PVSCSI driver - version 1.0.2.0
VMware memory control driver initialized

VirtualBox

Various devices are handled as virtual devices by VirtualBox and are named accordingly.

For example: running the lspci or lshal commands on a Linux guest system running under VirtualBox will report various virtual devices with names containing "VirtualBox" or "VBOX":

$ lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter
00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
00:04.0 System peripheral: InnoTek Systemberatung GmbH VirtualBox Guest Service
00:05.0 Multimedia audio controller: Intel Corporation 82801AA AC'97 Audio Controller (rev 01)
00:06.0 USB Controller: Apple Computer Inc. KeyLargo/Intrepid USB
00:07.0 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:0d.0 SATA controller: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller (rev 02)
$ lshal | grep -iE '(VBOX)|(VirtualBox)'
  system.firmware.version = 'VirtualBox'  (string)
  system.hardware.product = 'VirtualBox'  (string)
  info.product = 'VirtualBox mouse integration'  (string)
  input.product = 'VirtualBox mouse integration'  (string)
  scsi.model = 'VBOX HARDDISK'  (string)
udi = '/org/freedesktop/Hal/devices/storage_serial_VBOX_HARDDISK_VBaf369ac6_e504000b'
  block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_VBOX_HARDDISK_VBaf369ac6_e504000b'  (string)
  info.product = 'VBOX HARDDISK'  (string)
  info.udi = '/org/freedesktop/Hal/devices/storage_serial_VBOX_HARDDISK_VBaf369ac6_e504000b'  (string)
  storage.model = 'VBOX HARDDISK'  (string)
  storage.serial = 'VBOX_HARDDISK_VBaf369ac6-e504000b'  (string)
  block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_VBOX_HARDDISK_VBaf369ac6_e504000b'  (string)
  info.parent = '/org/freedesktop/Hal/devices/storage_serial_VBOX_HARDDISK_VBaf369ac6_e504000b'  (string)
  block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_VBOX_HARDDISK_VBaf369ac6_e504000b'  (string)
  info.parent = '/org/freedesktop/Hal/devices/storage_serial_VBOX_HARDDISK_VBaf369ac6_e504000b'  (string)
  block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_VBOX_HARDDISK_VBaf369ac6_e504000b'  (string)
  info.parent = '/org/freedesktop/Hal/devices/storage_serial_VBOX_HARDDISK_VBaf369ac6_e504000b'  (string)
  info.vendor = 'VirtualBox'  (string)
  usb_device.vendor = 'VirtualBox'  (string)
  usb.vendor = 'VirtualBox'  (string)
  info.product = 'VirtualBox USB Tablet'  (string)
  input.product = 'VirtualBox USB Tablet'  (string)
  info.product = 'VirtualBox Guest Service'  (string)
  pci.product = 'VirtualBox Guest Service'  (string)
  info.product = 'VirtualBox Graphics Adapter'  (string)
  pci.product = 'VirtualBox Graphics Adapter'  (string)
  scsi.vendor = 'VBOX'  (string)
  info.vendor = 'VBOX'  (string)
  storage.vendor = 'VBOX'  (string)

Similar indications can be found in the boot messages, available via dmesg:

$ dmesg | grep -iE '(VBOX)|(VirtualBox)'
[    0.000000] ACPI: RSDP 00000000000e0000 00024 (v02 VBOX  )
[    0.000000] ACPI: XSDT 00000000dfff0030 0003C (v01 VBOX   VBOXXSDT 00000001 ASL  00000061)
[    0.000000] ACPI: FACP 00000000dfff00f0 000F4 (v04 VBOX   VBOXFACP 00000001 ASL  00000061)
[    0.000000] ACPI: DSDT 00000000dfff0470 01B96 (v01 VBOX   VBOXBIOS 00000002 INTL 20100528)
[    0.000000] ACPI: APIC 00000000dfff0240 0005C (v02 VBOX   VBOXAPIC 00000001 ASL  00000061)
[    0.000000] ACPI: SSDT 00000000dfff02a0 001CC (v01 VBOX   VBOXCPUT 00000002 INTL 20100528)
[    0.521175] ata2.00: ATAPI: VBOX CD-ROM, 1.0, max UDMA/133
[    0.523518] scsi 1:0:0:0: CD-ROM            VBOX     CD-ROM           1.0  PQ: 0 ANSI: 5
[    0.962765] ata3.00: ATA-6: VBOX HARDDISK, 1.0, max UDMA/133
[    0.963028] scsi 2:0:0:0: Direct-Access     ATA      VBOX HARDDISK    1.0  PQ: 0 ANSI: 5
[    8.483161] input: VirtualBox USB Tablet as /devices/pci0000:00/0000:00:06.0/usb1/1-1/1-1:1.0/input/input5
[    8.483284] generic-usb 0003:80EE:0021.0001: input,hidraw0: USB HID v1.10 Mouse [VirtualBox USB Tablet] on usb-0000:00:06.0-1/input0
[    8.729986] vboxguest: major 0, IRQ 20, I/O port d020, MMIO at 00000000f0400000 (size 0x400000)
[    8.729989] vboxguest: Successfully loaded version 4.1.18 (interface 0x00010004)
[   10.164395] vboxsf: Successfully loaded version 4.1.18 (interface 0x00010004)
[   11.733809] [drm] Initialized vboxvideo 1.0.0 20090303 for 0000:00:02.0 on minor 0

The VirtualBox Guest Additions kernel modules show up in lsmod:

$ lsmod | grep -i vbox
vboxsf                 90112  1
vboxvideo              49152  0
vboxguest             413696  6 vboxsf
ttm                   114688  2 vmwgfx,vboxvideo
drm_kms_helper        278528  2 vmwgfx,vboxvideo
drm                   618496  7 vmwgfx,drm_kms_helper,vboxvideo,ttm

However not all VirtualBox hosted VMs have these installed.


No comments: