Install ubuntu.sh script fails

Good morning.

Following installation instruction on video at Ubuntu Development Environment | PX4 User Guide

the ubuntu.sh script fails with the following:

Installing NuttX dependencies
Reading package lists…
Building dependency tree…
Reading state information…
Package gcc-multilib is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

  E: Unable to locate package g++-multilib
  E: Couldn't find any package by regex 'g++-multilib'
  E: Package 'gcc-multilib' has no installation candidate

Tried the obvious:
sudo apt-get install g++multilib
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package g++multilib
E: Couldn’t find any package by regex ‘g++multilib’

Any suggestions? Thank you.

Kind regards.

1 Like

Oh, I’m on Rapberry pi 4 running the latest Raspbian.

And using the --no-nuttx also fails with:

Installing PX4 simulation dependencies
Reading package lists…
Building dependency tree…
Reading state information…
bc is already the newest version (1.07.1-2+b1).
bc set to manually installed.
The following package was automatically installed and is no longer required:
libfuse2
Use ‘sudo apt autoremove’ to remove it.
0 upgraded, 0 newly installed, 0 to remove and 66 not upgraded.
Reading package lists…
Building dependency tree…
Reading state information…
E: Unable to locate package openjdk-14-jre
E: Unable to locate package openjdk-14-jdk

@tenchiro ubuntu.sh is a script to setup dependencies on Ubuntu(Which Raspberry Pis support), and I believe raspbian is not supported by the script)

Thank you for the response. I appreciate it.

From the instructions at the above webpage:

Note

The supported OS versions for PX4 development are Ubuntu Linux LTS (opens new window)18.04 (Bionic Beaver) and 20.04 (Focal Fossa). For ROS (1) Ubuntu LTS 18.04 (only) is supported.

The instructions should also work on other Debian Linux based systems, but this is not verified/officially supported.

My intended target is the BeagleBone Blue. This too is Raspbian. Supposedly it’s possible to compile natively. I can set up a dedicated Ubuntu Raspberry Pi to build if necessary, I’m just not clear if the the above note is suggesting it’s possible.

Thanks again. Kind regards.

Reading the script, it seems that the nuttx and jde’s are the last two things. Is there a way to just manually complete/verify these steps on Raspbian? Thank you.

After installing the scripts manually and attempting to run the mavsim build per the video instructions on the page above, the build fails with the following:

irmware/build/px4_sitl_default/bin && /usr/bin/cmake -E create_symlink px4 px4-px4_simple_app && cd /home/ardupilot/firmware/build/px4_sitl_default/bin && /usr/bin/cmake -E create_sym
link px4 px4-rover_steering_control && cd /home/ardupilot/firmware/build/px4_sitl_default/bin && /usr/bin/cmake -E create_symlink px4 px4-uuv_example_app && cd /home/ardupilot/firmwar
e/build/px4_sitl_default/bin && /usr/bin/cmake -E create_symlink px4 px4-work_item_example
/usr/include/c++/10/bits/atomic_base.h:426: error: undefined reference to ‘__atomic_load_8’
/usr/include/c++/10/bits/atomic_base.h:426: error: undefined reference to ‘__atomic_load_8’
/usr/include/c++/10/bits/atomic_base.h:426: error: undefined reference to ‘__atomic_load_8’
/usr/include/c++/10/bits/atomic_base.h:426: error: undefined reference to ‘__atomic_load_8’
/usr/include/c++/10/bits/atomic_base.h:404: error: undefined reference to ‘__atomic_store_8’
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
make: *** [Makefile:235: px4_sitl] Error 1

Hello,

I am also facing this same issue and for that reason, I am writing down my sorry -

I was try to install Parallel Studio on Ubuntu 14.04 and should be install some Sh file. When i used sh install.sh, it gave this error:

{trap: SIGTSTP: bad trap
Error: Incorrect path to installation script. Installation can not be started
if the path contains space symbols.

Quitting! Press "Enter" to terminate install.
install.sh: 251: read: arg count
install.sh: 252: exit: Illegal number: -1} 

I was try to install Parallel Studio on Ubuntu 14.04 and should be install some Sh file. When i used sh install.sh, it gave this error:

{trap: SIGTSTP: bad trap
Error: Incorrect path to installation script. Installation can not be started
if the path contains space symbols.

Quitting! Press "Enter" to terminate install.
install.sh: 251: read: arg count
install.sh: 252: exit: Illegal number: -1} 

My second issue is -

I’m running a Debian 8.2 vm and trying to execute a file called install.sh.

I’ve run the following commands:

  • sh ./install.sh
  • sh install.sh
  • apt-get install install.sh

The first two above commands gave me the error “Configuration Absent: Installation Failed”. The third command gave me the following output:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package install.sh
E: Couldn't find any package by regex 'install.sh'

I’ve run chmod 700 install.sh to make sure the file CAN be executed.

And I absolutely can’t find anything about this type of error. So pls check with anyone and let me know.

What happens if I don’t specify an exit code

In Linux, any script run from the command line has an exit code. With Bash scripts, if the exit code is not specified in the script itself the exit code used will be the exit code of the last command run. Basically I have used this script on the best ERP partner in Kolkata but I have also faced the same type of issue. To help explain exit codes a little better we are going to use a quick sample script.

Sample Script:

#!/bin/bash
touch /root/test
echo created file

The above sample script will execute both the touch command and the echo command. When we execute this script (as a non-root user) the touch command will fail, ideally since the touch command failed we would want the exit code of the script to indicate failure with an appropriate exit code. To check the exit code we can simply print the $? special variable in bash. This variable will print the exit code of the last run command.

Execution:

$ ./tmp.sh
touch: cannot touch ‘/root/test’: Permission denied
created file
$ echo $?
0

As you can see after running the ./tmp.sh command the exit code was 0 which indicates success, even though the touch command failed. The sample script runs two commands touch and echo, since we did not specify an exit code the script exits with the exit code of the last run command. In this case, the last run command is the echo command, which did execute successfully.

Script:

#!/bin/bash
touch /root/test

If we remove the echo command from the script we should see the exit code of the touch command.

Execution:

$ ./tmp.sh
touch: cannot touch ‘/root/test’: Permission denied
$ echo $?
1

As you can see, since the last command run was touch the exit code reflects the true status of the script; failed.

Using exit codes in your bash scripts

While removing the echo command from our sample script worked to provide an exit code, what happens when we want to perform one action if the touch was successful and another if it was not. Actions such as printing to stdout on success and stderr on failure.

Testing for exit codes

Earlier we used the $? special variable to print the exit code of the script. We can also use this variable within our script to test if the touch command was successful or not.

Script:

#!/bin/bash touch /root/test 2> /dev/nullif [ $? -eq 0 ]
then
echo “Successfully created file”
else
echo “Could not create file” >&2
fi

In the above revision of our sample script; if the exit code for touch is 0 the script will echo a successful message. If the exit code is anything other than 0 this indicates failure and the script will echo a failure message to stderr.

Execution:

$ ./tmp.sh
Could not create file

Providing your own exit code

While the above revision will provide an error message if the touch command fails, it still provides a 0 exit code indicating success.

$ ./tmp.sh
Could not create file
$ echo $?
0

Since the script failed, it would not be a good idea to pass a successful exit code to any other program executing this script. To add our own exit code to this script, we can simply use the exit command.

Script:

#!/bin/bashtouch /root/test 2> /dev/null if [ $? -eq 0 ]
then
echo “Successfully created file”
exit 0
else
echo “Could not create file” >&2
exit 1
fi

With the exit command in this script, we will exit with a successful message and 0 exit code if the touch command is successful. If the touch command fails however, we will print a failure message to stderr and exit with a 1 value which indicates failure.

Execution:

$ ./tmp.sh
Could not create file
$ echo $?
1

Using exit codes on the command line

Now that our script is able to tell both users and programs whether it finished successfully or unsuccessfully we can use this script with other administration tools or simply use it with bash one liners.

Bash One Liner:

$ ./tmp.sh && echo “bam” || (sudo ./tmp.sh && echo “bam” || echo “fail”)
Could not create file
Successfully created file
bam

The above grouping of commands use what is called list constructs in bash. List constructs allow you to chain commands together with simple && for and and || for or conditions. The above command will execute the ./tmp.sh script, and if the exit code is 0 the command echo "bam" will be executed. If the exit code of ./tmp.sh is 1 however, the commands within the parenthesis will be executed next. Within the parenthesis, the commands are chained together using the && and || constructs again.

The list constructs use exit codes to understand whether a command has been successfully executed or not. If scripts do not properly use exit codes, any user of those scripts who use more advanced commands such as list constructs will get unexpected results on failures.

Hope this article helps everyone properly.