V2201 Series Linux Software User’s Manual
Version 2.0, November 2020
www.moxa.com/product
© 2020 Moxa Inc. All rights reserved.
V2201 Series Linux Software User’s Manual
Moxa China (Shanghai office)
The software described in this manual is furnished under a license agreement and may be used only in accordance with
the terms of that agreement.
Copyright Notice
© 2020 Moxa Inc. All rights reserved.
Trademarks
The MOXA logo is a registered trademark of Moxa Inc.
All other trademarks or registered marks in this manual belong to their respective manufacturers.
Disclaimer
Information in this document is subject to change without notice and does not represent a commitment on the part of
Moxa.
Moxa provides this document as is, without warranty of any kind, either expressed or implied, including, but not limited
to, its particular purpose. Moxa reserves the right to make improvements and/or changes to this manual, or to the
products and/or the programs described in this manual, at any time.
Information provided in this manual is intended to be accurate and reliable. However, Moxa assumes no responsibility for
its use, or for any infringements on the rights of third parties that may result from its use.
This product might include unintentional technical or typographical errors. Changes are periodically made to the
information herein to correct such errors, and these changes are incorporated into new editions of the publication.
Technical Support Contact Information
www.moxa.com/support
-free: 1-888-669-2872
+1-714-528-6777
+1-714-528-6778
+49-89-3 70 03 99-0
: +49-89-3 70 03 99-99
+91-80-4172-9088
+91-80-4132-1045
-free: 800-820-5036
+86-21-5258-9955
+86-21-5258-5505
+886-2-8919-1230
-Pacific
+886-2-8919-1231
Table of Contents
1. Introduction ...................................................................................................................................... 1-1
Software Specifications........................................................................................................................ 1-2
2. Software Configuration ..................................................................................................................... 2-1
Account Management .......................................................................................................................... 2-2
Starting From an HDMI Console ............................................................................................................ 2-3
Connecting From an SSH Console ......................................................................................................... 2-3
Windows Users ........................................................................................................................... 2-4
Linux Users ................................................................................................................................ 2-5
Adjusting the System Time .................................................................................................................. 2-5
Setting the Time Manually ............................................................................................................ 2-5
Using the NTP Client and the systemd-timesyncd Service ................................................................. 2-6
Managing the Service Using the systemd Script............................................................................... 2-6
Cron Daemon for Executing Scheduled Commands ................................................................................. 2-8
Mounting an USB Storage Device .......................................................................................................... 2-8
Checking the Linux Version .................................................................................................................. 2-9
APT—Installing and Removing Packages .............................................................................................. 2-10
3. Managing Communications ............................................................................................................... 3-1
Detecting Network Interfaces ............................................................................................................... 3-2
Changing the Network Settings ............................................................................................................ 3-2
Changing the interfaces Configuration File ...................................................................................... 3-2
Adjusting the IP Addresses Using ifconfig ....................................................................................... 3-3
DNS Client ......................................................................................................................................... 3-4
/etc/resolv.conf ........................................................................................................................... 3-4
/etc/nsswitch.conf ....................................................................................................................... 3-4
Configuring the Cellular Connection ...................................................................................................... 3-5
Using cell_mgmt ......................................................................................................................... 3-5
Dial-up Process ........................................................................................................................... 3-7
Dial-up Commands ...................................................................................................................... 3-7
Cellular Module ........................................................................................................................... 3-9
GPS ......................................................................................................................................... 3-12
Configuring the Wi-Fi Connection ........................................................................................................ 3-12
Configuring WPA2 ...................................................................................................................... 3-12
4. System Recovery ............................................................................................................................... 4-1
Recovery Environment ........................................................................................................................ 4-2
Restoring the System From the USB Drive ............................................................................................. 4-2
5. Additional Settings ............................................................................................................................ 5-1
Getting the Product Serial Number ........................................................................................................ 5-2
RTC (Real-time Clock) ......................................................................................................................... 5-2
Serial Ports ........................................................................................................................................ 5-2
Digital I/O.......................................................................................................................................... 5-3
WDT (Watchdog Timer) ....................................................................................................................... 5-3
How the WDT Works .................................................................................................................... 5-3
1
1. Introduction
Thank you for purchasing a Moxa V2201 x86 ready-to-run Linux-based embedded computer (V2201-LX). This
manual introduces the software configuration and management of the computer, which runs on the Linux
operating system.
Linux is an open, scalable operating system that allows you to build a wide range of innovative, small-footprint
devices. Software written for desktop PCs can be easily ported to the embedded computer with a GNU cross
compiler and minimum source code modifications. A typical Linux-based device is designed for a specific use,
and is often not connected to other computers, or a number of such devices connect to a centralized, front-end
host.
The following topics are covered in this chapter:
Software Specifications
V2201 Series Linux UM Introduction
For information and documentation on Debian GNU/Linux and the free software concept, refer to the following
links:
Software Specifications
The Linux operating system preinstalled on the V2201-LX is the Debian Stretch 9.12 distribution. The Debian
project is a worldwide group of volunteers who endeavor to produce an operating system distribution that is
composed entirely of free software. The Debian GNU/Linux follows the standard Linux architecture, making it
easy to use programs that meet the POSIX standard. Program porting can be done with the GNU toolchain
provided by Moxa. In addition to Standard POSIX APIs, device drivers for Moxa UART and other special
peripherals are also included. An example software architecture is shown below:
software architecture presented above is only an example. Different product models or different build
s of the Linux operating system may include components not shown here.
2
2. Software Configuration
In this chapter, we explain how to operate the V2201-LX directly from your desktop. You can connect to your
embedded computer: using a HDMI display or via SSH over a network console from a Windows or Linux
machine. This chapter describes basic Linux operating system configurations. Advanced network management
and configuration instructions are described in the "3 Managing Communications " chapter.
The following topics are covered in this chapter:
Account Management
Starting From an HDMI Console
Connecting From an SSH Console
Windows Users
Linux Users
Adjusting the System Time
Setting the Time Manually
Using the NTP Client and the systemd-timesyncd Service
Managing the Service Using the systemd Script
Cron Daemon for Executing Scheduled Commands
Mounting an USB Storage Device
Checking the Linux Version
APT—Installing and Removing Packages
V2201 Series Linux UM Software Configuration
higher security level or disable
moxa@Moxa:~$ sudo ifconfig enp1s0 192.168.100.100
device memory 0xb1300000-b137ffff
Account Management
Connect the embedded computer to a display and turn on the computer. Enter the following information to log
in into the computer.
Login: moxa
Password: moxa
For enhanced security, we have disabled the root account. We strongly recommend that you change the
password after the first login. After successfully logging in, provide a new password.
Linux Moxa 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1 (2018-04-29) x86_64
#### #### ###### ####### ###### ##
### #### ### ### #### #### ###
### ### ### ### ### ## ###
### #### ## ## ### # ####
#### # ## ### ### ### ## ## ##
## ## # ## ### ## #### # ##
## ### ## ## ## ## #### # ###
## ## # ## ## ## ### #######
## ## # ## ### ### ##### # ##
## ### ## ### ### ## ### # ###
## ### ## ## ## ## ### ## ##
## ### ## ## ## # ### # ##
###### # ###### ######## ####### ########### ######
For further information check:
http://www.moxa.com/
You have mail.
Last login: Wed Mar 6 00:10:56 2019 from 10.144.54.91
You are using Moxa embedded computer.
Please change the default password in consideration of
the default user, moxa.
After you change the default password, remember to type sudo each time you want to run commands with the
privilege of a root account. For example, typing
to configure the IP address of the LAN 1 port.
moxa@Moxa:~$ sudo ifconfig enp1s0
enp1s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.100.100 netmask 255.255.255.0 broadcast 192.168.100.255
ether 00:90:e8:00:d7:38 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Use sudo –i to login as the root user to have more privileges.
[sudo] password for moxa:
sudo ifconfig enp1s0 192.168.100.100 will allow you
V2201 Series Linux UM Software Configuration
Starting From an HDMI Console
Connect a display to the HDMI connector of the V2201-LX and power it up by connecting the power adapter.
The system will take 30 to 60 seconds to boot up. Once the system is ready, a login screen is displayed.
Enter the login name and password. The default values are both moxa .
Login: moxa
Password: moxa
Password:
#### #### ###### ####### ###### ##
### #### ### ### #### #### ###
### ### ### ### ### ## ###
### #### ## ## ### # ####
#### # ## ### ### ### ## ## ##
## ## # ## ### ## #### # ##
## ### ## ## ## ## #### # ###
## ## # ## ## ## ### #######
## ## # ## ### ### ##### # ##
## ### ## ### ### ## ### # ###
## ### ## ## ## ## ### ## ##
## ### ## ## ## # ### # ##
###### # ###### ######## ###### ########## ######
For further information check:
http://www.moxa.com/
Connecting From an SSH Console
The V2201-LX supports the SSH console to offer better network security compared to Telnet. The default IP
addresses and netmasks of the network interfaces are as follows:
Default IP Address Netmask
LAN 1 192.168.3.127 255.255.255.0
Before using an SSH client on your development PC, you should change the IP address of the PC so that the
network ports are in the same subnet as the IP address of the LAN ports that you will connect to. For example,
if you will connect to LAN1, you could set your PC’s IP address to 192.168.3.126, and the netmask to
255.255.255.0. If you will connect to LAN2, set your PC’s IP address to 192.168.4.126, and the netmask to
255.255.255.0.
Use a cross-over Ethernet cable to connect your development PC directly to the target embedded computer, or
use a straight-through Ethernet cable to connect the computer to a LAN hub or switch. Next, use a SSH client
on your development PC to connect to the target computer. After a connection has been established, type the
login name and password as requested to log in into the computer. The default values are both moxa.
Login: moxa
Password: moxa
V2201 Series Linux UM Software Configuration
Windows Users
Download the PuTTY tool to set up an SSH console on your development PC. The tool can be downloaded free
of cost at: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
The following screens show an example of the configuration settings required to set up an SSH connection.
V2201 Series Linux UM Software Configuration
[moxa@Moxa:~$]# ssh moxa@192.168.3.127
Are you sure you want to continue connection (yes/no)? yes_
root@Moxa:/home/moxa# date
2019-03-06 19:35:34.061120+0800
Linux Users
From a Linux PC, use the ssh command to access the embedded computer’s console utility via the SSH.
Type yes to open the connection.
The authenticity of host ‘192.168.3.127 (192.168.3.127)’ can’t be established.
RSA key fingerprint is 8b:ee:ff:84:41:25:fc:cd:2a:f2:92:8f:cb:1f:6b:2f.
Adjusting the System Time
The V2201-LX has two time settings; the system time and the real-time clock (RTC) built into the hardware.
Setting the Time Manually
Use the date command to query the current system time or set a new system time. Use the hwclock
command to query the current RTC time or set a new RTC time.
Use the following command to set the system time.
moxa@Moxa:~# date MMDDhhmmYYYY
MM: Month
DD: Date
hhmm: Hour and Minute
YYYY: Year
Use the following command to write the current system time to the RTC.
# hwclock
Wed Mar 6 19:33:51 CST 2019
root@Moxa:/home/moxa# hwclock
2019-03-06 19:33:57.482903+0800
root@Moxa:/home/moxa# date 030619352019.30
Wed Mar 6 19:35:30 CST 2019
root@Moxa:/home/moxa# hwclock -w
root@Moxa:/home/moxa# date; hwclock
Wed Mar 6 19:35:34 CST 2019
V2201 Series Linux UM Software Configuration
root@Moxa:/home/moxa# ntpdate time.stdtime.gov.tw
2019-03-06 19:36:50.154796+0800
root@Moxa:/home/moxa# systemctl status systemd-timesyncd
103.18.128.60:123 (2.debian.pool.ntp.org).
ATTENTION
Before using the NTP client utility, check your IP address and network settings (gateway and DNS)
sure an Internet connection is available.
root@Moxa:~# vi /etc/systemd/system/networking-check.service
Using the NTP Client and the systemd-timesyncd Service
The computer can use a NTP (Network Time Protocol) client to initialize a time request to a remote NTP server.
Use the
network before you run the
6 Mar 19:36:21 ntpdate[1172]: adjust time server 118.163.81.61 offset -0.000877 sec
root@Moxa:/home/moxa# hwclock -w
root@Moxa:/home/moxa# date; hwclock
Wed Mar 6 19:36:50 CST 2019
For more information about NTP and the NTP server addresses, visit http://www.ntp.org.
The computer has a built-in system-timesyncd service that is used for network time synchronization. The
service is enabled by default.
systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor
preset: enabled)
Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
└─disable-with-time-daemon.conf
Active: active (running) since Wed 2019-03-06 19:30:32 CST; 7min ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 274 (systemd-timesyn)
Status: "Synchronized to time server 103.18.128.60:123 (2.debian.pool.ntp.org)."
Tasks: 2 (limit: 4915)
CGroup: /system.slice/systemd-timesyncd.service
└─274 /lib/systemd/systemd-timesyncd
Mar 06 19:30:31 Moxa systemd[1]: Starting Network Time Synchronization...
Mar 06 19:30:32 Moxa systemd[1]: Started Network Time Synchronization.
Mar 06 19:31:02 Moxa systemd-timesyncd[274]: Synchronized to time server
ntpdate command to update the system time. Make sure that the device is connected to an Ethernet
ntpdate command.
Managing the Service Using the systemd Script
Linux services can be started or stopped using systemd scripts. The systemctl command is used to enable
or disable a service.
Follow the example below to add or remove a service.
Creating a System Service Unit
This example creates a systemd service unit in /etc/systemd/system/networking-check.service.
Run the following command using the vi editor to create the networking-check.service file.
to make
V2201 Series Linux UM Software Configuration
moxa@Moxa:~# sudo vi /usr/local/bin/networking-check.sh
root@Moxa:~# chmod a+x /usr/local/bin/networking-check.sh
root@Moxa:~# systemctl start networking-check
root@Moxa:~# ps aux|grep networking-check
root 2276 0.0 0.0 12784 980 pts/0 S+ 14:49 0:00 grep networking-check
root@Moxa:~# cat /var/log/networking-check.log
root@Moxa:~# systemctl enable networking-check
root@Moxa:~# reboot
Enter the following entries into the file.
After=snmpd.service
[Service]
ExecStart=/usr/local/bin/networking-check.sh
[Install]
• After : Instructs systemd on when the script should be run. In our case the script will run after the
snmpd.service has started.
• ExecStart : Provides a full path to the script
• WantedBy : Specifies the boot target to which the systemd unit should be installed
This is a basic example of a system script. For more information, check the systemd.service script.
1. Create the /usr/local/bin/networking-check.sh script to check the network status.
This example will ping a global DNS server to check if a network is available and write the results into the
/var/log/networking-check.log .
#!/bin/sh
while [ 1 ]; do
date >> /var/log/networking-check.log
ping -q -w 1 8.8.8.8
if [ $? -eq 0 ]; then
echo "Network is available" >> /var/log/networking-check.log
else
echo "Network is not available" >> /var/log/networking-check.log
fi
sleep 1
2. Before we launch the service, we need to make the script executable using the following command:
3. Start the networking -check service.
The networking- check.sh will be launched in the background.
root 2260 0.0 0.0 4288 1500 ? Ss 14:49 0:00 /bin/sh
/usr/local/bin/networking-check.sh
A /var/log/networking-check.log file is also created.
Wed Mar 14 14:49:09 EDT 2018
Network is available
4. You can enable the service at boot time using the following command and by rebooting the system.
V2201 Series Linux UM Software Configuration
root@Moxa:~# systemctl disable networking-check
#minute hour date month week user command
* 8 * * * root /path/to/your/program
* 8 * * * root /home/fixtime.sh
[ 564.753797] sd 6:0:0:0: [sdb] Assuming drive cache: write through
To disable the service, use the systemctl disable command as follows:
Remember to stop the service to prevent the log file from occupying too much disk space.
Cron Daemon for Executing Scheduled
Commands
The Cron daemon will search /etc/crontab for crontab files. It wakes up every minute and checks each
command to see if it should be run within that minute. When executing commands, output is mailed to the
owner of the crontab (or to the user named in the MAILTO environment variable in the crontab files, if such
a user exists).
Modify the file /etc/crontab to set up your scheduled applications. Crontab files have the following format:
minute
(mm)
For example, issue the following command if you want to launch a program at 8:00 hrs every day.
The following example demonstrates how to use Cron to update the system time and RTC time every day at
8:00 hrs.
1. Write a shell script named fixtime.sh with the following content and save it to
hour
(h)
date
(dom)
Month
(mon)
Week
(dow)
User
(user)
Command
(command)
/home/.
ntpdate time.stdtime.gov.tw
hwclock –w
2. Change the mode of fixtime.sh
3. Modify the /etc/crontab file to run fixtime.sh at 8:00 every day.
Add the following line at the end of crontab file.
Mounting an USB Storage Device
The computer doesn’t support auto mounting of USB storage devices automatically; you need to manually
mount the devices. Before mounting the USB storage, check the USB storage name using the
command.
...
[ 564.751226] sd 6:0:0:0: Attached scsi generic sg1 type 0
[ 564.752400] sd 6:0:0:0: [sdb] 3973118 512-byte logical blocks: (2.03 GB/1.89 GiB)
[ 564.753008] sd 6:0:0:0: [sdb] Write Protect is off
[ 564.753013] sd 6:0:0:0: [sdb] Mode Sense: 03 00 00 00
[ 564.753674] sd 6:0:0:0: [sdb] No Caching mode page found
dmesg