Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 22.04.4 LTS FIX helpers.sh #1422

Open
tttttint opened this issue Dec 30, 2024 · 2 comments
Open

Ubuntu 22.04.4 LTS FIX helpers.sh #1422

tttttint opened this issue Dec 30, 2024 · 2 comments
Labels
bug Something isn't working EMBA Installation Installation issues

Comments

@tttttint
Copy link

ERROR
image
jq
Description: lightweight and flexible command-line JSON processor
Download-Size: 52.5 kB

Error detected - status code 1
Command: echo -e "Command: ${ORANGE}${BASH_COMMAND}${NC}"
Location: ./installer/helpers.sh, line 68
Stack Trace:
[1] print_tool_info(): ./installer/helpers.sh, line 68 -> print_tool_info jq 1
[2] I01_default_apps_host(): ./installer/I01_default_apps_host.sh, line 24 -> I01_default_apps_host
[3] main(): ./installer.sh, line 345 -> main -d

Important: Consider filling out a bug report at https://github.com/e-m-b-a/emba/issues

以下是一篇完整的 GitHub Issue 模板,描述了问题、解决方案以及一些相关建议:

Title:

Error detected in helpers.sh when running jq - Missing jq installation and Docker setup clarification

Description:

I encountered the following error when running the script:

jq
Description: lightweight and flexible command-line JSON processor
Download-Size: 52.5 kB

Error detected - status code 1
Command: echo -e "Command: ${ORANGE}${BASH_COMMAND}${NC}"
Location: ./installer/helpers.sh, line 68
Stack Trace:
[1] print_tool_info(): ./installer/helpers.sh, line 68 -> print_tool_info jq 1
[2] I01_default_apps_host(): ./installer/I01_default_apps_host.sh, line 24 -> I01_default_apps_host
[3] main(): ./installer.sh, line 345 -> main -d


Steps to Reproduce:
1. Run the script on Ubuntu 22.04.4 LTS.
2. Observe the error message indicating a missing jq dependency.

Cause:

The error occurs because the system does not have jq installed, which is required for processing JSON data in the script.

Additionally, some users might face issues with Docker and Docker Compose setup, which are prerequisites for the tool.

Solution:

  1. Install jq:

Ensure that jq is installed on your system. Use the following command:

sudo apt update && sudo apt install jq -y

  1. Install Docker and Docker Compose:

Follow the steps below to set up Docker and Docker Compose on Ubuntu properly:

Step 1: Install Docker

Update the package index

sudo apt update

Install Docker's package dependencies

sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

Add Docker's official GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add Docker's official repository to the APT sources

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y

Verify Docker installation

sudo docker --version

Step 2: Install Docker Compose

Download the latest version of Docker Compose

sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r .tag_name)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Apply executable permissions to the binary

sudo chmod +x /usr/local/bin/docker-compose

Verify Docker Compose installation

docker-compose --version

Step 3: Enable and Start Docker

Enable Docker to start on boot

sudo systemctl enable docker

Start Docker

sudo systemctl start docker

  1. Update the Script:

Ensure your script includes checks for the presence of jq, and gracefully handles the error if it’s missing.

Add this to the script before invoking jq:

Check if jq is installed

if ! command -v jq &> /dev/null; then
echo "Error: jq is not installed. Please install jq using 'sudo apt install jq' and try again."
exit 1
fi

Expected Behavior:

With jq installed and Docker/Docker Compose correctly set up, the script should run without errors and process JSON data as expected.

Environment:
• OS: Ubuntu 22.04.4 LTS
• Docker Version: Ensure the latest stable release.
• Docker Compose Version: Ensure the latest stable release.

Additional Notes:

If you encounter any further issues, feel free to reply to this issue, and I’ll assist you further!


FIX helpers.sh

print_tool_info(){
echo -e "\n""${ORANGE}""${BOLD}""${1:-}""${NC}"
TOOL_INFO="$(apt-cache policy "${1:-}" 2> /dev/null)"
if echo "${TOOL_INFO}" | grep -q "已安装:"; then
INSTALLED_VERSION=$(echo "${TOOL_INFO}" | grep "已安装:" | awk '{print $2}')
CANDIDATE_VERSION=$(echo "${TOOL_INFO}" | grep "候选:" | awk '{print $2}')
if [[ "${INSTALLED_VERSION}" == "${CANDIDATE_VERSION}" ]]; then
echo -e "${GREEN}""${1:-}"" is already installed and up-to-date.""${NC}"
else
echo -e "${ORANGE}""${1:-}"" is installed but will be updated.""${NC}"
INSTALL_APP_LIST+=("${1:-}")
fi
else
echo -e "${ORANGE}""${1:-}"" will be newly installed.""${NC}"
INSTALL_APP_LIST+=("${1:-}")
fi
}


Copy link

Thank you for contributing an issue!

Welcome to the EMBA firmware analysis community!

We are glad you are here and appreciate your contribution. Please keep in mind our contributing guidelines here and here.
Also, please check existing open issues and consider to open a discussion in the dedicated discussion area.
Additionally, we have collected a lot of details around EMBA, the installation and the usage of EMBA in our Wiki.

If you like EMBA you have the chance to support us by becoming a Sponsor or buying some beer here.

To show your love for EMBA with nice shirts or other merch you can check our Spreadshop.

This is an automatic message. Allow for time for the EMBA community to be able to read the issue and comment on it.

@m-1-k-3 m-1-k-3 added bug Something isn't working Installation Installation issues EMBA labels Dec 30, 2024
@m-1-k-3
Copy link
Member

m-1-k-3 commented Jan 8, 2025

Sorry for the delay.

Your first issue was around the docker installation. Your system has already a docker-compose installation and the installer complains on it. You can uninstall your current docker enviroment and then the installer should be able to handle the fresh installation. The docker installation routine can be found here

The second issue is weird as jq should be installed here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working EMBA Installation Installation issues
Projects
None yet
Development

No branches or pull requests

2 participants