# Troubleshooting & Debugging

As part of day-2 of 50days of Devops learning journey. Today i tried to install all the required tools via shell script. Able to install with basic script which missed some debugging/error handling capabilities later i modified the script and to test that script i created one more shell script named as `cleanup.sh` to remove all the existing folders and packages related to the project i am working on. Which gave me some learning

**Note :** i am using ubuntu 24 version as OS in an EC2 instance

* It worked perfectly for all the packages except `python` errors and the solutions are provided below 👇 once python removed and tested setup script which throw me an error related to docker installation which is again another learning . How i fixed this issues are listed below

### Docker installation Issue

<figure><img src="/files/NiEYpbDABNUr6qythLPt" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/FpSnytnKSewDHsrmOCc2" alt=""><figcaption></figcaption></figure>

### python package removal issue

<figure><img src="/files/7prB9qJ5xzirvpxwmj5L" alt=""><figcaption></figcaption></figure>

Solution :&#x20;

The error regarding unmet dependencies when attempting to remove Python indicates a conflict between package versions or held packages

1. Fix broken dependencies `sudo apt-get install -f`
2. Reconfigure packages `sudo dpkg --configure -a`
3. clean package cache

```sh
sudo apt-get clean
sudo apt-get autoclean
```

4. Identify Hold packages `sudo apt-mark showhold` if you find something then use `sudo apt-mark unhold`
5. Force Removal of problematic packages

`sudo dpkg --remove --force-all <package name>`&#x20;

6. use aptitude for dependency resolution

Aptitude is a more advanced package manager that can resolve complex dependency issues

`sudo apt-get install aptitude`  `sudo aptitude purge python3.*`&#x20;

Note : sometimes \* may not work, has to specifically mention our package name i.e; 3.13 etc

7. Retry Removal

`sudo apt-get purge --auto-remove python3.* -y`&#x20;

8. Verification

```sh
which python3
ls /usr/bin/python*
```

### Git Troubleshooting

<figure><img src="/files/AUMyZUdNAcQjL5rv3SnZ" alt=""><figcaption></figcaption></figure>

The error `src refspec main does not match any` indicates that there is no local branch named `main` in your Git repository

Solution :&#x20;

1. Verify local branch `git branch`&#x20;
2. Renamed local branch `git branch -m master main`&#x20;
3. commit changes to local brqnch `git status` `git add README.md ; git commit -m "initial commit"` &#x20;
4. Push to remote repository `git push -u origin main`&#x20;
5. Handling different remote branches `git push -u origin main:develop` here `main`  is the local branch and `develop`is the remote branch&#x20;
6. Check remote repository `git remote show origin`&#x20;

<figure><img src="/files/qbyPzlcBYz5GARiunXPP" alt=""><figcaption></figcaption></figure>

**Solution :**&#x20;

Got error due to lack of permissions for the PAT Token. After this error i regenerated token and modified permissions for the token at repository level. We can do it in the github UI . settings --> Developer settings (at the bottom left) --> Generate new fine grained token --> permissions edit

### Ec2 instance is not reachable via ssh

<figure><img src="/files/oyHMC3tmxtKlrihrLBHS" alt=""><figcaption></figcaption></figure>

<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-system-instance-status-check.html#instance-status-checks> &#x20;

### Maven Build Failure

<figure><img src="/files/BfYypolHyvxsTYIg3IVa" alt=""><figcaption></figcaption></figure>

The error i encounted due to  the `junit.framework` package and associated classes like `TestCase`, `Test`, and `TestSuite` are not available in my project project. This is  due to missing or incorrect JUnit dependencies in my Maven configuration (`pom.xml`&#x20;

`./src/test/java/com/ecomm/AppTest.java` This is the path of the Apptest.java by default

As part of fix , i updated my `pom.xml` and `Apptest.java`  files. Then ran this `mvn clean install &&`&#x20;\
`mvn test`&#x20;

## git error

<figure><img src="/files/NuxWERTJ8xaZEFtqMuwp" alt=""><figcaption></figcaption></figure>

* As part of fix, changed branch `git checkout main` and pulled `git pull`&#x20;

### Python Error

<figure><img src="/files/wMJg7VDvLHh1M0wwoclC" alt=""><figcaption></figcaption></figure>

To fix this created venv using `python3 -m venv ./order-service/.`

`pip install requirements`

To activate virtual env, use `source ./bin/activate`&#x20;

finally ran `sudo pip install flask` It worked

<figure><img src="/files/GKEyOqkZORXS4kpBstZ5" alt=""><figcaption></figcaption></figure>

### Go Error

we got this error due to something wrong in the syntax of main.go file. Sometime other possibilities of this error could be of port running for other service

* To check port `netstat -tuln | grep 8081`—if empty, the app isn’t starting.\`

`sudo lsof -i :8081` `sudo kill -9 $(sudo lsof -t -i:8081)`

![](/files/zIELCxR8be9f1XAgNxts)&#x20;

once it started working, we will see something like below

<figure><img src="/files/7F7tR4EKAiiL440Cp4XK" alt=""><figcaption></figcaption></figure>

### Kubernetes Error

While trying to setup kubernetes cluster with minikube locally got below error

<figure><img src="/files/mCNfTy9BlA00b1Gll5Ys" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/juJa2pqRktPpTImeGGJa" alt=""><figcaption></figcaption></figure>

Verified docker installation `docker version` and checked docker status with `sudo systemctl status docker` and then created docker group and added user into that group using `sudo usermod -aG docker $USER && newgrp docker`  finally i ran `minikube start --driver=docker` It worked

<figure><img src="/files/3mFcsB7WgbG0bVPzd0hT" alt=""><figcaption></figcaption></figure>

### kubernetes Error

<figure><img src="/files/yEhXDnaqLdbXdBa7uWwJ" alt=""><figcaption></figcaption></figure>

\--> This issue we will get mostly due to not having kubeconfig file. Once you have updated kubeconfig file. Please check and update minikube&#x20;

<figure><img src="/files/MeCz3yTJXOwAWnwjshTB" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/bCEw142SSyfzC1Bp9Vt7" alt=""><figcaption></figcaption></figure>

### Jenkins Errors

<figure><img src="/files/WteKFnNzMLfdLnX9TgqR" alt=""><figcaption></figcaption></figure>

And also not able to setup webhook due to running jenkins locally. Github doesn't accept http it needs https url to function webhook properly. To fix that issue i used ngrok.com to test webhook

<figure><img src="/files/iyztvRGZ61DGgzfn2INh" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/1kJ27ec4Rlo40vTp4Kfp" alt=""><figcaption></figcaption></figure>

The errors you’re seeing when running npx eslint --init and npm run lint stem from two main issues:

1. **UNC Path Issue**: You’re running commands in a **Windows Subsystem for Linux (WSL)** environment, and the path \\\wsl.localhost\Ubuntu-24.04\\... is a UNC (network) path, which Windows’ cmd.exe doesn’t support. This causes ESLint to default to C:\Windows, leading to permission and context errors.
2. **Missing package.json or Permissions**: The npx eslint --init error indicates no package.json in the Product Service directory, and the npm run lint error (EPERM: operation not permitted, scandir 'C:\Windows\appcompat\appraiser') confirms ESLint is trying to operate in the wrong directory (C:\Windows) due to the UNC issue, hitting permission restrictions.

These issues are common when mixing WSL and Windows environments, especially for Node.js workflows

* **Production Context**: In prod, companies avoid such WSL issues by standardizing environments (e.g., Linux containers on Kubernetes), but your dev setup needs this fix to mimic real-world CI
*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://charan-techjourney.gitbook.io/charan-techjournal/50-days-of-devops-ecommerce-microservices/project-daily-tasks/troubleshooting-and-debugging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
