Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How To Fix Broken Ubuntu OS Without Reinstalling It - DesignLinux

Dec 28 2020
designlinux 0 Comments

Over the course of time, your system can be plagued with errors that can render it broken or unusable. A classic example is the inability to install software packages, update or upgrade the system. Other times, you may encounter a black screen during login preventing you from accessing your system.

An extreme fix would be to reinstall your Ubuntu OS right away, but this means that you’ll lose all your precious files and applications. Instead of taking that path, a few fixes can come in handy with a Live CD or USB bootable medium.

Let’s check out a few solutions that can help you fix broken Ubuntu OS without reinstalling it.

Fix the inability to install software packages, update or upgrade the system

Sometimes you could run into the error ‘Could not get lock /var/lib/dpkg/lock.’ This also mirrors the error ‘Could not get lock /var/lib/apt/lists/lock‘ error.

Could not get lock /var/lib/dpkg/lock error
Could not get lock /var/lib/dpkg/lock error

This is usually caused by an interrupted update or upgrades process such as when the power goes out or when you press CTRL + C to interrupt the process. This error prevents you from installing any packages or even update or upgrade your system.

To resolve this error, remove the lock file(s) as shown.

$ sudo rm /var/lib/dpkg/lock
$ sudo rm /var/lib/dpkg/lock-frontend

In case you bump into the error about the apt-cache lock such as /var/cache/apt/archives/lock, remove the lock file as shown.

$ sudo rm /var/lib/dpkg/lock
$ sudo rm /var/cache/apt/archives/lock

Next, reconfigure dpkg and clear the local repository of any remnants left in the /var/cache file

$ sudo dpkg --configure -a
$ sudo apt clean
Fix Ubuntu when it freezes in boot time due to Graphic drivers

NVIDIA drivers are notorious for causing crashes on Ubuntu systems. Sometimes, your system can boot and get stuck at the purple screen as shown.

Stuck at Ubuntu Booting
Stuck at Ubuntu Booting

Other times, you might get a black screen. When this happens, the only option is to boot into rescue mode or emergency mode on Ubuntu.

Let’s check out how to solve this issue. First, reboot your machine and press ‘e’ on the first option.

Ubuntu Boot Grub Menu
Ubuntu Boot Grub Menu

This brings you to the editing mode as shown. Scroll until to get to the line starting with ‘Linux’. Append the string nomodeset as shown.

Edit Ubuntu Boot Parameters
Edit Ubuntu Boot Parameters

Lastly, press CTRL + X or F10 to exit and continue booting. If you still cannot boot into your system, try adding the parameter nouveau.noaccel=1.

Now, this is a temporary fix and won’t apply the next time you log in. To make the changes permanent, you need to edit the /etc/default/grub file.

$ sudo nano /etc/default/grub

Scroll and locate the line that reads:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Set it to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"

Save the changes and exit.

Lastly, you need to update grub as follows:

$ sudo update-grub

Once you are done, reboot your system. This should fix the problem.

Related

Tags: Ubuntu Tips

How to Install PHP 8 on Ubuntu 20.04

Prev Post

How to Convert PDF to Image Using Gimp

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 259
  • 614,631

DesignLinux.com © All rights reserved

Go to mobile version