/
Using Console / SSH commands

Using Console / SSH commands

The SmartServer is based on the Linux operating system and many common Linux commands can be used to access the SmartServer through the SmartServer console or by using SSH. This section covers some of the most commonly used console/SSH commands for troubleshooting the SmartServer. Most commands can be issued using the apollo login. In some cases, you will need to add sudo to the beginning of the command for higher privileges. Always use the apollo user login and not root. Newer versions of the SmartServer restrict or prevent root login.

Many commands (like top) will continuously run until you exit the command, and therefore, should be run in an SSH session instead of the SmartServer console. A SSH session will disconnect when the PC is no longer able to access the SmartServer, and therefore stopping the continuous command. You can exit continuous commands by entering CTRL-C.

The table below describes and provides examples of console/SSH commands. To eliminate hidden characters, copy the commands to a text editor (e.g., notepad), and then copy the commands from the text editor and paste them into the SSH session.

For SmartServer 4.0 and higher, most log data is in /var/log/syslog. Use smartserverctl to access SmartServer services.  

For SmartServer 3.6 and prior releases, log data is distributed into specific log files, such as logs in /var/log/supervisor. Use supervisorctl to access SmartServer services.

For SmartServer 3.6 and prior, use systemctl for to check the Karaf service. 

The commands shown in the table below assume that apollo login is used.

Command

Description

Command

Description

apollo-reset

This command is used to reset the SmartServer database. If you want to keep any of the SmartServer configuration, then you should save SmartServer configuration using the CMS prior to using these commands.

When possible, you should use the SmartServer Configuration page System tab Reset to defaults button to reset the SmartServer database or to restore to factory. Otherwise, use the commands described below.

The apollo-reset commands should not be used for SmartServer versions 3.2x. Only use this command for SmartServer version 3.1 and earlier, or 3.3 and later.  Do not use this command for SmartServer versions  3.2 to 3.25 as the commands can damage the SmartServer.

Reset Database – resets the SmartServer database and re-configures MAC IDs assignment (with affects IP-852 routing and Internal device UIDs); it does not change the SmartServer IP settings.

Format: 

sudo apollo-reset normal <apollo password>

Example: Reset Database with SmartServer password = kksdafdsj
sudo apollo-reset normal kksdafdsj

Restore to Factory – resets SmartServer database, and re-configures MAC IDs assignment (with affects IP-852 routing and Internal device UIDs), sets IP address settings to default, and resets other driver configurations

Format: 

sudo apollo-reset factory <apollo password>
Example: Restore Factory Settings with SmartServer password = 432597787
sudo apollo-reset factory 432597787

cat

For SmartServer 3.6 and prior releases, this command allows you to read a file, and is most useful for reading small files. For longer files, use more.

Displays the contents of a log file
Displays the contents of a large log file

For SmartServer 4.0 and higher, use the tail and grep commands since all the logs go into /var/log/syslog, which can be very large in size.

date

Displays the SmartServer platform current local time (time changes are not propagated to CMS). The SmartServer CMS and the SmartServer platform time and timezone may differ. See also timedatectl below.

Example: date

Use timedatectl to change the time or date.

df

Displays system disk space usage. If your system disk space usage is close to 100%, then you may experience performance (e.g., slow response times) or operational (e.g., cannot access CMS web page) problems. 

Example: df
Example: df (healthy system)

A /dev/root of 85% is acceptable; however, if it shows 100%, or another item shows close to 100%, then use the du command to determine which file is using the excessive memory.

du

Allows you to determine which files are using a lot of disk space. If the df -h command shows anything close to 100% for any of the items listed, then you can use this du command to help identify which files are the cause.

Go to the directory that shows 100%, or close to 100%, and search for files over 5MB.

Example: Looks for directories over 1 MB

A large file does not mean it is a problem. You should compare the results with another working SmartServer. If you find a file on a SmartServer that is much larger than the same file on another SmartServer, then you should look at that file. 

For example, if /dev/root shows 100% usage, then change to the root directory run the du command.

If a file appears to be too large, then go to that directory and run the du command again.

You can then issue the ls -lh command to see which files use a lot of space.

echo

This command can be used to determine the SmartServer software version.

Example: Determines SmartServer version
Example: echo

grep

Displays any line in a file that has the specified text.

Example: Searches for any indication of EMI?

history

Displays the previously issued SSH commands. This list is not cleared when the console/SSH session is terminated.

Example: Displays history
Example: Clears history

journalctl

Use this command to monitor output to syslog. Use this command instead of tail -f /var/log/syslog because this command will tolerate log rotation.  

Example: shows logged output of all the units in the SmartServer
Example: shows the logged output of the lte driver

ifconfig

Displays the SmartServer hardware interfaces, like Ethernet IP Address, U60/U70 interfaces, and IOX.

When using the ifconfig command from the console, either log in as root or enter sudo ifconfig.

Example: ifconfig
Example: eth0 is the LAN port, eth1 is the WAN port, IP70 is the SmartServer backbone, lon# (lon0) refers to a U60/U70

If all of your LON devices are down, then use ifconfig to look for lon# or check the System Configuration page LON tab to see if the U60/U70 appears.

To see traffic on a U60/U70, determine the lon# (e.g., lon0) and use the ifconfig command to look at TX and RX packets. Re-issue the command a couple of seconds later.

Example: ifconfig lon0
Example: ifconfig lon0 results

lscpu

Displays the number of CPUs that are available with the SmartServer. See CPU(s) in the command output. This information is used to determine whether you have Quad Core or Dual Core SmartServer.

Example: lscpu

lsusb

Determines if you are using a U60/U7 as indicated with Echelon Co.

Example: Device 003 indicates a U60/U70

mosquitto_sub

Subscribes to an MQTT topic (see IAP/MQ for more details). These commands should only be run using SSH and NOT using the console. Enter CTRL-C to exit. 

Example: Views all devices
Example: Views all events
Example: Views all MQTT traffic (with timestamp)
Example: Saves all MQTT traffic (with timestamp) to a file - only let run temporarily as may use up a lot of disk space

mosquitto_pub

Writes using an MQTT topic (see IAP/MQ for more details).

Example: mosquitto_pub

pmic_checker.sh

Used to determine the SmartServer PMIC version.

Older SmartServer software versions may not support newer SmartServer hardware versions since the CPU, PMIC, or memory may have changed causing the older software to not be aware of the new hardware. Using the wrong software version can cause the SmartServer to stop working and be unrecoverable

PMIC:

  • PFUZE100 – supported for all Software versions.

  • DA9063 – supported in SmartServer 3.30.057 and higher

Determine the SmartServer PMIC
Example: pmic_checker.sh

reboot

Reboots the SmartServer. You can use this method if you cannot reboot the SmartServer using the System Configuration page. Once you issue the command, there is a short delay before the SmartServer reboots.

Example: reboot

re-image.sh

Starts the re-image script. You first have to plug in a USB flash drive with the SmartServer flash drive image (unzipped files), and then run this command. See also Updating or Re-imaging the SmartServer with the SmartServer Console.

Example: re-image script

smartserver-secure

With SmartServer 3.5 and higher, this command is used to enable/disable enhanced security and is the same as using the Enable Enhanced Security setting on the System Configuration page. Enhanced security defaults to being enabled.

Enable enhanced security
Disable enhanced security

To disable only password time checking and enable all other enhanced security features:

Disable enhanced security password checking

su

Switches to higher permissions so that you do not have to add sudo before console/SSH commands.

Example: su, switches to higher permissions
Example: exit, exits higher permissions

smartserverctl

Requires SmartServer 4.0 and higher

Checks the status of SmartServer services and shows built-in services, like bacnet, which is used for BACnet, and any internal device application.

Example: smartserverctl
Example: smartserverctl status

Most services have roughly the same uptime. If the uptime for one service is very different from others, then this may mean that the service was restarted.

LTE and LTX  services may have different uptimes than the rest of the services. These services are re-started automatically each time you import or re-import an XIF or resource file set XML files. They may also get restarted due to other normal processing. The example below shows how to restart both the LTE and LTX services using a single command.

Example: Restarts both LON services (LTE and LTX)
Example: Restarts all services
Example: Disables automatic start on boot for a given services or groups

 

supervisorctl

For SmartServer 3.6 and prior releases, this command checks the status of SmartServer services and shows built-in services, like echbacnet, which is used for BACnet, and any internal device application.

Example: supervisorctl
Example: supervisorctl status

Most services have roughly the same uptime. If the uptime for one service is very different from others, then this may mean that the service was restarted.

LTE (lon:echlte) and LTX (lon:echltx) services may have different uptimes than the rest of the services. These services are re-started automatically each time you import or re-import an XIF or resource file set XML files. They may also get restarted due to other normal processing. The example below shows how to restart both the LTE and LTX services using a single command.

Example: Restarts both LON services
Example: Restarts all services

systemctl

For SmartServer 3.6 and prior releases, this command determines if the CMS has started, even if you cannot log into the CMS.  The CMS is typically accessible within five minutes after the Change Password button becomes enabled on the System Configuration page.

If the SmartServer is been up for 15 minutes, then most likely the CMS is up. If you can access the Configuration pages and console/SSH, but not the CMS, then issue the following command.

Example: systemctl
Example: Checks if CMS (Karaf) service is up; green text is a good indicator

The following command shows whether or not Karaf service is up. If you see active (running) in green, then this means that the service is up. However, it does not guarantee that Karaf (CMS) is fully working.

If you cannot reach the SmartServer Configuration pages (nginx) and other services, then enter the following commands:

tail

Displays the end of a file and also displays all new entries. This command should only be used with SSH. Enter CTRL-C to exit. 

For SmartServer release 4.0 and higher
For SmartServer 3.6 and prior releases.

tar

Creates tape archive files (i.e., a Linux zip file). Once you tar-up a file, you can then copy it to your PC and un-tar it with an application like 7-Zip.

For SmartServer 4.0 and higher, use the SmartServer System Configuration page Logs button to download the SmartServer log files. Most of the driver logs are included in the SmartServer 4.0 and higher /var/log/syslog.

For SmartServer 3.6 and prior, use the following commands to get the SmartServer log files.

To retrieve the SmartServer log files (most, but not all, built-in log files), use the commands shown in the example below to tar and copy the /var/log and then save into /var/data//var/apollo/data/logs.tar.gz. The chown command is used to change the tar file so that you can copy the tar file with the apollo login.

Example: Retrieves SmartServer files

Use an SFTP application (like WinSCP) to save the files to your PC. You can then use 7-Zip (or a similar application) to extract the files.

timedatectl

Displays or sets the SmartServer platform time (time changes are not propagated to CMS). The SmartServer CMS and the SmartServer platform time and timezone may differ. See also date above.

Example: timedatectl
Change SmartServer time and date

Note: you will first have to disable the Smartserver time server first before changing the time or date. it is possible that the CMS and SmartServer platform may be out of sync. Reboot the SmartServer if you see an issue.

Re-enable the SmartServer time server

top

Provides a dynamic, real-time view of a running SmartServer system. Enter CTRL-C to exit. 

This command can be used to determine whether the SmartServer is performing a software update using the GLPO file. When a GLPO update is in progress, you will see wget, followed by unzip, and then mender using the most resources. The CPU will go down as the update nears completion.

Example: top

ufw

Displays which ports are open, and also opens/closes ports.

Example: Displays port status
Example: Opens a port
Example: Closes the port that was opened

uptime

The amount of time that the SmartServer has been up since last reboot

Example showing that SmartServer has been up 5 hours 21 minutes

 

 

Related content

SmartServer Troubleshooting
SmartServer Troubleshooting
Read with this
Rebooting Your SmartServer (Release 4.1 and Prior)
Rebooting Your SmartServer (Release 4.1 and Prior)
More like this
(Optional) Switch From LON Management
(Optional) Switch From LON Management
Read with this
Managing Services with smartserverctl
Managing Services with smartserverctl
More like this
Configuring the SmartServer IoT IP Address and Hostname
Configuring the SmartServer IoT IP Address and Hostname
Read with this
SmartServer IoT Configuration Page Index (Release 4.1 and Prior)
SmartServer IoT Configuration Page Index (Release 4.1 and Prior)
More like this