Lädt...

🔧 Firefighting with bashrc: How I restore my Ubuntu terminal


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Restoring My Ubuntu Terminal After a Corrupt .bashrc

Recently, I encountered an issue with my .bashrc file on my Ubuntu system that left my terminal unusable, eventually all stuffs like developing, running, testing halts. Here’s how I identified and resolved the problem.

The Issue Begins

I was trying to install WebLogic on my local system to check for compatibility issues. My Java version at the time was:

openjdk version "1.8.0_302"
OpenJDK Runtime Environment (build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (build 25.302-b08, mixed mode)

When I attempted to execute the WebLogic installer JAR file with the command:

java -jar fmw-....jar

it fails.

Checking the error logs, I found the following message:
the openjdk jvm is not supported on this platform.

Switching to Oracle Java

The installer required Oracle Java, but I was using SDKMAN! to manage my Java versions. SDKMAN is similar to RVM for Ruby, but due to licensing restrictions, it no longer provides Oracle Java.

To work around this, I decided to switch to Zulu JDK but ultimately opted to manually install Oracle JDK 8 instead.

Steps I Took:

  1. Downloaded Oracle JDK 8 and extracted it.

  2. Placed it in /opt/java/jdk.

  3. Set JAVA_HOME, ensuring it pointed to the new JDK instead of SDKMAN.

After setting the new path, I verified the Java version:

java version "1.8.0_431"
Java(TM) SE Runtime Environment (build 1.8.0_431-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.431-b10, mixed mode)

😆

💚 Now, Java was correctly set up.

The Persistent PATH Issue

Later, I navigated to the installer’s directory in a new terminal window and re-ran the command—only to face the same error. Checking the Java version revealed that my shell was still using OpenJDK instead of the newly installed Oracle JDK.

At this point, I realized that my PATH was not updated permanently. Since .bashrc is responsible for configuring interactive non-login shells, I needed to reload it.

source ~/.bashrc

The Real Problem Begins

The command froze. Nothing happened. Even pressing Ctrl + C didn’t work.

  • I opened a new terminal—same issue, it was stuck.
  • I restarted my system multiple times—no improvement.
  • The terminal simply hung, waiting indefinitely. 😨

Troubleshooting .bashrc

Realizing that .bashrc was likely causing the issue, I manually edited the file:

I undid all my recent changes—but the problem persisted. As a last resort, I deleted all content inside .bashrc, and my terminal started working again. 🚀

Unfortunately, this also meant I lost all my Java, Ruby environment configurations. 😞. And all my projects starts throwing error.

Finding the Culprit

I carefully restored my .bashrc content line by line to identify which one was causing the issue. Eventually, I found the problematic line:

source <(ng completion script)

This stale Angular CLI autocomplete command was preventing the script from executing correctly, causing the terminal to hang.

Final Fix

I removed the problematic line, then ran:

source ~/.bashrc

Now, the terminal worked smoothly! 🎉

I re-ran the WebLogic installer, and this time, the installation window popped up successfully.

Lessons Learned

  1. Be cautious when modifying .bashrc A single incorrect command can render your terminal unusable.
  2. If your terminal hangs after updating .bashrc try restoring an earlier version by editing or clearing the file.
  3. Use source ~/.bashrc carefully. Ensure the file is free from syntax errors before sourcing it.
  4. Check your PATH persistence. If Java (or any tool) isn’t behaving as expected, verify that the correct PATH is applied across all terminal sessions.

💡 Tip: Keep a backup of your .bashrc file before making major changes:

cp ~/.bashrc ~/.bashrc.bak

This way, you can always restore a working version if things go wrong!

...

🔧 Firefighting with bashrc: How I restore my Ubuntu terminal


📈 75.04 Punkte
🔧 Programmierung

🐧 Customize Your Terminal Prompt for Distrobox in `.bashrc`


📈 32.66 Punkte
🐧 Linux Tipps

📰 Firefighting Simulator löscht Unreal-Engine-5-Feuer


📈 26.55 Punkte
📰 IT Nachrichten

📰 Es brennt bei Astragon – helfen Sie mit im Firefighting Simulator: Ignite


📈 26.55 Punkte
📰 IT Nachrichten

📰 Ignite: Firefighting Simulator löscht Unreal-Engine-5-Feuer


📈 26.55 Punkte
📰 IT Nachrichten

🔧 How to break the cycle of firefighting and build engineering excellence


📈 26.55 Punkte
🔧 Programmierung

🔧 Rethinking The Role Of Your UX Teams And Move Beyond Firefighting


📈 26.55 Punkte
🔧 Programmierung

📰 Vice Society ransomware claims attack on Australian firefighting service


📈 26.55 Punkte
📰 IT Security Nachrichten

📰 Firefighting Simulator - The Squad: Die virtuelle Feuerwehr rückt aus


📈 26.55 Punkte
📰 IT Nachrichten

📰 Firefighting Simulator – The Squad ist ab sofort für den PC via Steam erhältlich


📈 26.55 Punkte
📰 IT Nachrichten

🕵️ Crooks hit Puerto Rico Firefighting Department Servers


📈 26.55 Punkte
🕵️ Hacking

📰 Hackers Target Puerto Rico Firefighting Department Servers


📈 26.55 Punkte
📰 IT Security Nachrichten

🐧 I wrote a bash function for forwarding your .bashrc's to the remote machines on ssh


📈 24.63 Punkte
🐧 Linux Tipps

🐧 I wrote a bash function for forwarding your .bashrc's to the remote machines on ssh


📈 24.63 Punkte
🐧 Linux Tipps

🐧 How To Edit The BashRC File To Make Bash More Useful On Linux


📈 24.63 Punkte
🐧 Linux Tipps

📰 How To Edit The BashRC File To Make Bash More Useful On Linux


📈 24.63 Punkte
🖥️ Betriebssysteme

🔧 .bashrc Cheatsheet - Shortcut Commands


📈 24.63 Punkte
🔧 Programmierung

🔧 A Quick Guide to My .bashrc Setup


📈 24.63 Punkte
🔧 Programmierung

🔧 run.bash &amp; migrate.bash - Pimpe deine .bashrc auf 🔝🔥


📈 24.63 Punkte
🔧 Programmierung

🐧 How to Export a Path in .Bashrc


📈 24.63 Punkte
🐧 Linux Tipps

🐧 Colorize your SSH shell prompt with .bashrc PS1 generator


📈 24.63 Punkte
🐧 Linux Tipps

🐧 Best/practical aliases for ~./bashrc


📈 24.63 Punkte
🐧 Linux Tipps

🐧 Why does .bashrc have write access by non-root users by default?


📈 24.63 Punkte
🐧 Linux Tipps

🐧 What functions do you have in your .bashrc


📈 24.63 Punkte
🐧 Linux Tipps

🐧 TIL what the &quot;RC&quot; in .bashrc or .vimrc stands for...


📈 24.63 Punkte
🐧 Linux Tipps

🎥 How you can restore a Cloud PC from a previous restore point.


📈 23.47 Punkte
🎥 Video | Youtube

🪟 System Restore failed to restore a file (0xc0000022)


📈 23.47 Punkte
🪟 Windows Tipps

🐧 What's the best terminal emulator? and why is gnome-terminal (default in ubuntu), not sufficient?


📈 20.14 Punkte
🐧 Linux Tipps

🪟 Windows Terminal Preview 1.21 can restore sessions and show emojis


📈 19.76 Punkte
🪟 Windows Tipps

🐧 How to Backup and Restore Terminal History in Raspberry Pi


📈 19.76 Punkte
🐧 Linux Tipps

matomo