2016/09/06

UP board:查詢系統狀態的Linux指令

安裝好Linux系統(Ubilinux)之後,簡單試用一些查詢系統狀態的Linux指令吧。

首先,看看Linux核心版本吧。
$ uname -a
Linux ubilinux 4.4.0-ubi3-amd64 #1 SMP Debian 4.4.13-1 (2016-06-17) x86_64 GNU/Linux
$ cat /proc/version
Linux version 4.4.0-ubi3-amd64 (ubilinux@emutex.com) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 SMP Debian 4.4.13-1 (2016-06-17)

哦,4.4啊,跟官方說的一樣

接著,查詢UP board的BIOS版本,
$ cat /sys/devices/virtual/dmi/id/bios_version
UPC1BM0S


看來是目前最新的,以後有機會的話,再嘗試更新囉。順帶一提,若要重置BIOS設定值,可拔掉RTC電池,等待10~15分鐘後再裝回去。

然後,查詢UP board板子本身的版本,
$ cat /sys/devices/virtual/dmi/id/board_version
V0.4

嗯,不知道代表什麼意義。

看看有多少記憶體:
$ free -h
             total       used       free     shared    buffers     cached
Mem:          3.3G       516M       2.8G        44M        21M       284M
-/+ buffers/cache:       209M       3.1G
Swap:           0B         0B         0B


嗯,總共應該有4 G才對,其他的,應該是分給GPU繪圖處理器了,可到BIOS調整;除此之外,也有些許部分被BIOS保留作為其他用途。

查詢儲存媒體eMMC的用量:
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             10M     0   10M   0% /dev
tmpfs           673M  8.9M  664M   2% /run
/dev/mmcblk0p3   29G  2.5G   25G   9% /
tmpfs           1.7G     0  1.7G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           1.7G     0  1.7G   0% /sys/fs/cgroup
/dev/mmcblk0p2   48M  119K   48M   1% /boot/efi
tmpfs           337M  4.0K  337M   1% /run/user/110
tmpfs           337M  4.0K  337M   1% /run/user/1000


嗯, 看來我手上這塊板子內建32 GB地eMMC。

查看網路卡取得的IP。我的UP board位於路由器之後,會從DHCP自動取得IP位址。
$ sudo ifconfig
eth0      Link encap:Ethernet  HWaddr 00:07:32:3d:2d:7d
          inet addr:192.168.1.71  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::207:32ff:fe3d:2d7d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1019 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1094 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:206884 (202.0 KiB)  TX bytes:138338 (135.0 KiB)


Ubilinux源自Debian,通樣採用DEB/APT套件管理系統,讓我們更新套件清單,並且升級原已安裝的套件吧,指令如下:
$ sudo apt-get update
$ sudo apt-get dist-upgrade
...省略輸出...

試試安裝新套件吧,例如可查詢CPU狀態的cpufrequtils:
$ sudo apt-get install cpufrequtils

然後執行指令cpufreq-info:
$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 0.97 ms.
  hardware limits: 480 MHz - 1.92 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 480 MHz and 1.92 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 940 MHz.
analyzing CPU 1:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 0.97 ms.
  hardware limits: 480 MHz - 1.92 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 480 MHz and 1.92 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 1.20 GHz.
analyzing CPU 2:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 2
  CPUs which need to have their frequency coordinated by software: 2
  maximum transition latency: 0.97 ms.
  hardware limits: 480 MHz - 1.92 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 480 MHz and 1.92 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 1.68 GHz.
analyzing CPU 3:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 3
  CPUs which need to have their frequency coordinated by software: 3
  maximum transition latency: 0.97 ms.
  hardware limits: 480 MHz - 1.92 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 480 MHz and 1.92 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 1.68 GHz.


可看到有4個CPU核心,時脈為480 MHz到1.92 GH,動態調整。

嗯,那麼CPU溫度呢,先安裝套件Linux Monitoring Sensors:
$ sudo apt-get install lm-sensors

然後,執行指令sensors-detect設定該載入那些模組,如果不知道的話,最好通通使用預設值,直接按Enter就對了:
$ sudo sensors-detect
# sensors-detect revision 6209 (2014-01-14 22:51:58 +0100)
# System: AAEON UP-CHT01 [V1.0]

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no):
Module cpuid loaded successfully.
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD Family 10h thermal sensors...                           No
AMD Family 11h thermal sensors...                           No
AMD Family 12h and 14h thermal sensors...                   No
AMD Family 15h thermal sensors...                           No
AMD Family 15h power sensors...                             No
AMD Family 16h power sensors...                             No
Intel digital thermal sensor...                             Success!
    (driver `coretemp')
Intel AMB FB-DIMM thermal sensor...                         No
VIA C7 thermal sensor...                                    No
VIA Nano thermal sensor...                                  No

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no):
...省略...

Now follows a summary of the probes I have just done.
Just press ENTER to continue:

Driver `coretemp':
  * Chip `Intel digital thermal sensor' (confidence: 9)

Driver `to-be-written':
  * ISA bus, address 0xca0
    Chip `IPMI BMC KCS' (confidence: 4)
  * ISA bus, address 0xca8
    Chip `IPMI BMC SMIC' (confidence: 4)

Note: there is no driver for IPMI BMC KCS yet.
Check http://www.lm-sensors.org/wiki/Devices for updates.

To load everything that is needed, add this to /etc/modules:
#----cut here----
# Chip drivers
coretemp
#----cut here----
If you have some drivers built into your kernel, the list above will
contain too many modules. Skip the appropriate ones!

Do you want to add these lines automatically to /etc/modules? (yes/NO)

Unloading cpuid... OK

然後執行指令sensors觀看:
$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:         +0.0°C  (crit = +90.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +37.0°C  (high = +90.0°C, crit = +90.0°C)
Core 1:       +36.0°C  (high = +90.0°C, crit = +90.0°C)
Core 2:       +40.0°C  (high = +90.0°C, crit = +90.0°C)
Core 3:       +36.0°C  (high = +90.0°C, crit = +90.0°C)

哎呀,好煩,上批踢踢跟網友鄉民大戰吧,咦,怎麼出現亂碼?
$ telnet ptt.cc

安裝中文字型:
$ sudo apt-get install ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy scim scim-tables-zh scim-chewing scim-pinyin fonts-inconsolata ttf-anonymous-pro ttf-dejavu ttf-bitstream-vera 

也安裝PCMan這套圖形化BBS客戶端軟體:
$ sudo apt-get install pcmanx-gtk2    

啊哈,OK囉。

No comments:

Post a Comment