Common Commands
Here are guides on how and when to run some of the most-used commands.
Some of the file paths to commonly used files are found in the Viewing and Editing Files section.
Running Apps
Section titled “Running Apps”These commands allow you to stop and start the app directly from the terminal without using the ignition.
NOTE: if the Buildroot command doesn’t work, make sure the file /usr/bin/startup-app.sh is configured correctly.
Stop the app
Section titled “Stop the app”This will kill the currently running app. It will still be displayed onscreen, but it will be frozen and uninteractive.
- Yocto, regular:
systemctl stop startup-app@bam - Yocto, power pack:
systemctl stop startup-app@powerpack - Buildroot, all:
systemctl stop startup-app
Start/Restart the app
Section titled “Start/Restart the app”This will start the app if it is stopped, or restart it if it is already running.
- Yocto, regular:
systemctl restart startup-app@bam - Yocto, power pack:
systemctl restart startup-app@powerpack - Buildroot, all:
systemctl restart startup-app
Check the status of the app
Section titled “Check the status of the app”This will display some status info about the app process: how long it’s been running, the process ID, the last 10 lines of the journal, etc.
To see more journal output, add --lines=<num-lines> after status.
- Yocto, regular:
systemctl status startup-app@bam - Yocto, power pack:
systemctl status startup-app@powerpack - Buildroot, all:
systemctl status startup-app
You can also run the top command to see the status of all processes. On Yocto, the app will be normal.app.bam, and on Buildroot, it will be /opt/BambauerPump/bin/BambauerPump -plugin tslib.
Run the app manually
Section titled “Run the app manually”This can be used to test the co-processor fail-safe (versions 2.1.0 and later). Run manually, then press Ctrl + C to kill. After a few seconds, the display should reset.
- Yocto, regular:
bash /usr/bin/startup-app.sh bam - Yocto, power pack:
bash /usr/bin/startup-app.sh powerpack - Buildroot, all:
bash /usr/bin/startup-app.sh
Filesystems
Section titled “Filesystems”There are a few commands that can be used to work with the filesystems on the display.
Check memory usage
Section titled “Check memory usage”Run the df command to see how much space is available in memory.
Memory is divided into partitions, so we need only to look at the partition that has app-specific files in it.
The Use% column represents how much space in that partition is being used, not the entire disk.
- Buildroot: filesystem
/dev/root, mounted on/ - Yocto: filesystem
/dev/mmcblk3p2, mounted on/rw_data- The root filesystem (
/dev/root) contains only files needed by the OS
- The root filesystem (
Check mountpoints
Section titled “Check mountpoints”Run the lsblk command to check the mountpoints of all memory partitions.
This command shows similar output to df, but without the memory usage stats. It provides a better representation of partition mountpoints.
This is useful when checking the status of a USB drive: lsblk will show where the USB’s files are mounted/located at.
Make filesystems read-write
Section titled “Make filesystems read-write”NOTE: this is only used with Yocto, where the root partition is read-only by default. See here for help getting a Buildroot display out of read-only mode.
Run mount -o remount,rw / to enable read-write access for the root filesystem. This is necessary for updating the app on Yocto.
Setting the System Time
Section titled “Setting the System Time”You can use the hwclock command to set the system time on the display. Note that the steps required are slightly different from Buildroot to Yocto.
Yocto steps:
-
Run
hwclock --set --date "M/D/YYYY hh:mm:ss"to set the hardware time. Use the current UTC time.- Example: if the current date is 8/21/24 3:19:07 PM EST, you will put “8/21/2024 20:19:07”
-
Run
hwclock --hctosysto update the system time to match.
Buildroot steps:
- Run
hwclock --set --date "YYYY-MM-DD hh:mm:ss"to set the hardware time. Use the current UTC time.- Example: if the current date is 8/21/24 3:19:07 PM EST, you will put “2024-08-21 20:19:07”
- Run
hwclock --hctosysto update the system time to match.
Update Management
Section titled “Update Management”App updates can be done from a USB using only the command line.
Manually mounting USBs
Section titled “Manually mounting USBs”If for some reason your USB drive is not mounted correctly, then you may have to mount it yourself.
-
Check for the location of the USB partition by running
ls /dev/sd*. Look for ansda1orsdb1entry. -
Then, run the following based on OS:
Terminal window # Buildrootmount <usb-loc> /media/usb0# Yoctomount <usb-loc> /run/media/sda1
Find USB packages
Section titled “Find USB packages”When a USB drive is plugged into the display, it is mounted to a particular location on the display’s filesystem.
- Yocto:
/run/media/sda1and/run/media/sdb1- You can use
lsblkto figure out what mountpoint is being used
- You can use
- Buildroot:
/media/usb0
Run ls <path-to-usb>/updates/all to see what all packages are on the USB.
Install new app packages
Section titled “Install new app packages”You can use the following commands to install a new version of an app once you have found the package’s location on the USB.
NOTE: this only works for apps that run on the display. Modules cannot be updated with these commands!!
- Buildroot: run
opkg install --force-downgrade --force-reinstall <path-to-package> - Yocto: run
dpkg --install <path-to-package>- You will need to run
mount -o remount,rw /if you have not done so already. See here for more info.
- You will need to run
It is best to cycle power after updating the app to ensure everything is reset correctly.
If you want to skip this step, run the following:
# Tell the OS to reload the service that runs the app, since you installed a new appsystemctl daemon-reload# Restart the app: Buildrootsystemctl restart startup-app# Restart the app: Yoctosystemctl restart startup-app@bamSee here for more info on restarting the app.
Networking
Section titled “Networking”Various network configurations and data can be accessed from the command line.
Getting IP Addresses
Section titled “Getting IP Addresses”You can use the ip a command on both Yocto and Buildroot to get the IP address of a display.
Look for the entry eth0 in the output. One of the lines underneath it will start with inet. That is where you’ll find the IP address.
Viewing and Editing Files
Section titled “Viewing and Editing Files”There are some simple commands for viewing and editing the contents of files and directories.
Here are the OS-specific locations of the files most used by the app, in case you need to view or edit them directly from the command line:
- Debug file:
telematics.log- Yocto location:
/rw_data/opt/BambauerPump/bin/logs/ - Buildroot location:
/root/
- Yocto location:
- App settings file:
settings.ini- Yocto location:
/rw_data/opt/BambauerPump/bin/ - Buildroot location:
/opt/
- Yocto location:
- Spoke.Zone config files:
spoke-zone-system.ini(required),spoke-zone-config.ini(optional)- Yocto location:
/rw_data/etc/spoke-zone/ - Buildroot location:
/etc/spoke-zone/
- Yocto location:
View contents of a file or directory
Section titled “View contents of a file or directory”- To view the contents of a file, run
cat <path-to-file> - To view the contents of a directory, run
ls -a <path-to-directory>- Use
ls -awithout a path to view the contents of the current directory
- Use
- To move to a different directory, run
cd <path-to-directory> - To print the current directory, run
pwd
Create and remove files
Section titled “Create and remove files”- To create a new empty file, run
touch <path-to-file> - To create a new file with contents in it, run
echo -e "<contents>" > <path-to-file>, where the contents contain\ncharacters for new lines - To remove a file, run
rm -f <path-to-file> - To remove a directory, run
rm -rf <path-to-directory>
Edit files
Section titled “Edit files”Buildroot and Yocto have some differences in text editors, but they both include the vi editor, so we’ll explain how to use that one.
- Run
vi <path-to-file>to open the text editor. It defaults to view-only. - Press
ito enable editing. - Make all changes you need to.
- Press
Escto go back to view-only. - Type
:wqto save your changes, then pressEnterto exit the editor.
Find files
Section titled “Find files”If you want to search for a file by name, run find / -name "<file-name>".
This will search the entire filesystem for the file in question. It will output nothing if it can’t find the file you requested.
Viewing System Output
Section titled “Viewing System Output”There are a few commands that can be used to view output from the app and/or OS when trying to debug issues.
All of these command will output a lot of text to the terminal. There are a couple commands that can be used to control this:
- Pipe output into
tail --lines=<num-lines>to see the lastnum-lineslines of output - Pipe output into
head --lines=<num-lines>to see the firstnum-lineslines of output
Examples:
# First 25 lines of the dmesgdmesg --time-format iso | head --lines=25# Last 300 lines of the log filecat <path-to-file>/telematics.log | tail --lines=300Kernel output from dmesg
Section titled “Kernel output from dmesg”The output from this command will contain kernel-related messages, mostly logged on startup by the kernel itself.
Run dmesg --time-format iso to see the output with human-readable timestamps.
This is part of the output sent up to Spoke.Zone during a log upload.
System logging from journalctl
Section titled “System logging from journalctl”The journal is the central location for all messages logged by various parts of the system, including the app’s console output and other services.
Run journalctl --boot=0 to see all the output from the current run (since the last power cycle).
App logging output
Section titled “App logging output”The app writes all of its debug messages to the telematics.log file (the file’s location changes from Buildroot to Yocto).
Simply run cat <path-to-file>/telematics.log to see the app’s output.