From 94a77360bf8687d26c5f4598f219e0accb67248e Mon Sep 17 00:00:00 2001 From: Chris Iverach-Brereton Date: Tue, 26 Aug 2025 16:25:15 -0400 Subject: [PATCH 1/3] Add a new section to install & configure the realtime linux kernel --- clearpath_computer_installer.sh | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/clearpath_computer_installer.sh b/clearpath_computer_installer.sh index 8e3004e..a3fb559 100644 --- a/clearpath_computer_installer.sh +++ b/clearpath_computer_installer.sh @@ -404,6 +404,39 @@ step_install_cuda() { fi } +step_setup_realtime() { + # create the realtime group if needed + if [ $(getent group realtime) ]; then + log_info "realtime group already exists"; + else + log_info "Adding realtime group"; + sudo addgroup realtime; + fi + if id -nGz "$(whoami)" | grep -qzxF "realtime"; then + log_info "User:$(whoami) is already in realtime group"; + else + log_info "Adding user:$(whoami) to realtime group"; + sudo usermod -a -G realtime $(whoami); + fi + + # install the realtime kernel + sudo apt -y install linux-image-realtime + + # configure realtime limits + LIMITS="@realtime soft rtprio 99 + @realtime soft priority 99 + @realtime soft memlock unlimited + @realtime hard rtprio 99 + @realtime hard priority 99 + @realtime hard memlock unlimited" + + for limit in ${LIMITS}; do + if ! [ -z "$(cat /etc/security/limits.conf) | grep \"$limit\"" ]; then + sudo bash -e "cat \"$limit\" >> /etc/security/limits.conf" + fi + done +} + log_space log_info "Starting Clearpath Robotics Computer Installer" log_space @@ -450,6 +483,11 @@ if [ ! "$EUID" -eq 0 ]; then rosdep -q update log_done "Updating rosdep" + prompt_YESno configure_realtime "Would you like to install the realtime linux kernel (recommended)?" + if [[ "$configure_realtime" == "y" ]]; then + step_setup_realtime + fi + # Check if Clearpath folder exists if [ -d /etc/clearpath/ ]; then log_warn "Clearpath folder exist, skipping" From ed8302299239f06aa94072cf8e9f44504014289c Mon Sep 17 00:00:00 2001 From: Chris Iverach-Brereton Date: Tue, 26 Aug 2025 16:44:23 -0400 Subject: [PATCH 2/3] Use an explicit array for limits --- clearpath_computer_installer.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/clearpath_computer_installer.sh b/clearpath_computer_installer.sh index a3fb559..d305bd9 100644 --- a/clearpath_computer_installer.sh +++ b/clearpath_computer_installer.sh @@ -423,16 +423,16 @@ step_setup_realtime() { sudo apt -y install linux-image-realtime # configure realtime limits - LIMITS="@realtime soft rtprio 99 - @realtime soft priority 99 - @realtime soft memlock unlimited - @realtime hard rtprio 99 - @realtime hard priority 99 - @realtime hard memlock unlimited" - - for limit in ${LIMITS}; do + declare -a limits=("@realtime soft rtprio 99" + "@realtime soft priority 99" + "@realtime soft memlock unlimited" + "@realtime hard rtprio 99" + "@realtime hard priority 99" + "@realtime hard memlock unlimited") + + for limit in "${limits[@]}"; do if ! [ -z "$(cat /etc/security/limits.conf) | grep \"$limit\"" ]; then - sudo bash -e "cat \"$limit\" >> /etc/security/limits.conf" + sudo bash -e "echo \"$limit\" >> /etc/security/limits.conf" fi done } From 390346104341592b3008277edf4bd8d038514e9f Mon Sep 17 00:00:00 2001 From: Chris Iverach-Brereton Date: Tue, 26 Aug 2025 17:17:40 -0400 Subject: [PATCH 3/3] Fix backwards logic --- clearpath_computer_installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clearpath_computer_installer.sh b/clearpath_computer_installer.sh index d305bd9..0cc3e3c 100644 --- a/clearpath_computer_installer.sh +++ b/clearpath_computer_installer.sh @@ -431,7 +431,7 @@ step_setup_realtime() { "@realtime hard memlock unlimited") for limit in "${limits[@]}"; do - if ! [ -z "$(cat /etc/security/limits.conf) | grep \"$limit\"" ]; then + if [ -z "$(cat /etc/security/limits.conf) | grep \"$limit\"" ]; then sudo bash -e "echo \"$limit\" >> /etc/security/limits.conf" fi done