Javatpoint Logo
Javatpoint Logo

Ubuntu Hangs

What is Hang?

In computing, a freeze or hang appears when either a system ceases or processes to respond to inputs. An example is when the graphical user interface of the computer no longer responds to the people moving their mouse and typing on their keyboard. The term covers a huge variety of behaviors in both servers and clients and is not restricted to graphical user interface problems.

  • Hangs have varied symptoms and causes, including hardware and software defects, like a long-running or infinite loop uninterruptible computation, under-performing hardware, resource exhaustion, external events like a slow computer network, compatibility, and misconfiguration problems.
  • Typically, the fundamental reason is resource exhaustion: resources essential for a few segments of the system to execute are not available because being in use by another process or insufficient.
  • The cause is often an interaction of more than one factor, making "hang" a disconnected umbrella term instead of a technical one.
  • Hangs may be limited if caused by any condition that solves itself, like slow hardware, or permanent and needs manual intervention, such as in the case of software or hardware logic error.

Several modern operating systems offer the user a means to terminate forcibly a hung program without logging out or rebooting; a few operating systems, like those made for mobile devices, even may do it automatically. In more serious hangs affecting the entire system, the solution might be to restart the machine by power cycling with a reset or on/off button. A hang is different from a crash, where the failure is unrelated and immediate to the input responsiveness.

Hang in Multitasking OS

It is possible for a thread or process to get stuck in a multitasking OS, like getting into an endless loop or blocking over a resource. Hence, the effect on the whole system significantly varies. A thread that stucks without returning will hang the entire system in a co-operative multitasking system because it would wedge itself because of the active thread and prevent another thread from execution.

  • Primarily, modern operating systems utilize pre-emptive multitasking, by contrast, like Windows 2000 and its successors, as well as Apple, macOS, and Linux.
  • In such a case, one thread getting stuck will necessarily not hang the system because the OS will preempt it when the time slice expires, permitting another thread to execute.
  • The scheduler might shift to another interdependent task group so that every process will not hang if any thread does hang.
  • Although, the stuck thread will utilize the resources, and if it's running, it will utilize the processor power and cycle when it's scheduled and slow down the system, so it doesn't hang it.

Although a system can hang with preemptive multitasking and a malicious or misbehaved task can hang the device, mainly by monopolizing a few other resources, such as memory or I/O, but processor time can not be monopolized. For instance, a process blocking the file system will hang the device again and again. Moving on top of a hanging function around a window at the time of a hang might cause a window trail through redrawing.

Causes of Hangs

Hardware can make a system hang, either as it is mismatched or intermittent with another hardware in the system (it can appear when one does an upgrade). Also, hardware can become defective due to heat or dirt damage over time.
Also, a hang can appear because of the fact that the system specialist has wrong termination cases for a loop or forgets to return to other tasks in a co-operative multitasking OS. Said differently, various software-related hangs are appeared by threads delaying for an event to appear which will never appear. Also, it is called an infinite loop.

Other causes of hangs are the race condition in negotiation between processes. A single process may transfer a signal to the second process and then stop running until it gets a response. When the second process is delaying the signal, it will be forced for waiting until the process can receive it.

Although, if the second process were delaying transferring a single to the initial process, then these processes would delay forever for the other for responding to signals and never see the signal of the other (this event is called deadlock). The processes will hang and need to be shut down if they are uninterruptible. If any process is a critical kernel process, the entire system may hang and need to be restarted.

A system may seem to hang when it's simply very slowly processing. It can be caused by several programs executing at the same time, slow system APIs, slow hardware access (to remove devices especially), memory fragmentation, or insufficient memory (RAM). Also, it can be caused by some invisible programs which were surreptitiously installed, like spyware.


In several cases, programs may occur to be hung but are enabling slow progress, and delaying some minutes will permit the task to finish. Modern operating systems offer a mechanism to terminate hung processes. For example, with the command, i.e., Unix kill, or from a graphical means, like the "end task" button of the Task Manager in Windows (choose the specific process within the list and click "end task").

Older computers, like those executing MS-DOS, classic Mac OS, or early Windows versions, often required to be completely restarted when a hang appears. A watchdog timer can restart the system when a hang appears on embedded devices in which human interaction is restricted.

Reasons of Hangs

If we find our PC becomes unresponsive and suddenly freezes, it is time to check our system. We will initially need to recognize the real cause behind the system freeze problem to find if it's hardware-related or software specific. Recognizing the real cause help in resolving the issue more quickly.

There are distinct types of system freeze problems, and all categories are found by the system behavior. The issue can be divided into Hang, Single-app Freeze, Generic Freeze, and Random Hang.

Let's discuss these categories individually:

Ubuntu Hangs
  • Hang: A PC hangs up and requires to be a reboot to recover whenever a particular procedure set is implemented on it.
  • Single-app Freeze: Single-app Freeze problem occurs when the system abnormally freezes while we try to begin a game, a big browsing website, or a specific program.
  • Generic Freeze: The system becomes unresponsive and turns automatically to a general functional state without troubleshooting.
  • Random Hang: If the system becomes unresponsive at regular time intervals frequently, we will need to reboot it for recovering hard drive data.

The reasons for hangs are as follows:

Ubuntu Hangs

Various Apps Running

All applications open on our system take some time and hardware resources to continue running. If more than one program or application is running, our system may execute low because memory is utilized by various applications. To ignore it, it's recommended to execute a single program at once to make sure that system freeze is not appeared due to executing more than one application at the same time.

Driver Issues

Damaged or outdated drivers can also be the cause behind constant computer freezes. The system may hang while we try to play a game or video if the video drivers that are installed on our system are not updated. We need to interpret Windows Device Manager to make sure that no "Other Devices" are linked. We also need to consider the device list to inspect that no exclamation mark is related to a device driver or red X marked closed to the device.

Important: Ensure that the latest driver versions are installed for network, modem, video, and sound devices being connected or downloaded to the system.

Operating System Problems

To ensure effortless functionality of the device, make sure that every update is installed. It's vital that we use a legal operating system copy to be able for keeping the system updated. It is recommended to always execute a legal Microsoft Windows copy to be able to install updates. If you are utilizing Windows 10, the update option is turned on automatically. Windows don't permit keeping this option off for all home users.

If we face any kind of data loss at the time of update, we can try employing any third-party hard drive recovery application for restoring our lost, formatted, or accidentally data back to our system.

Hardware Misconfiguration

A major reason behind the system freeze problem is hardware misconfiguration. It may have appeared because of misconfigured hardware element that we installed recently to our system. Hardware element recently installed may be incompatible with the system. We need to delete that hardware and inspect whether the system is smoothly running. After that, search for the most correct replacement for the deleted hardware mechanism.

Excess Heating Up

In case the temperature of our system processor is greater than normal, our system may freeze. The symptoms from which we can find the higher temperature of our processor are high squealing and odd noise on startup. We can examine the system when we turn it on and carefully listen to the sound produced by the fan. We can also enter the CMOS setup, monitor the RPM, and ensure that no bug message is addressed by the BIOS.

Insufficient RAM

The reason can be insufficient RAM when the system freezes at regular time intervals. It's essential to have appropriate RAM for keeping the system smoothly running. There could sometimes be 3D games and applications installed on the system that makes it heavy and hence causes device hang problems.

It's quite possible that the power supply, CPU, or motherboard may not be appropriately working. In such cases, reinstalling Windows operating system or upgrading RAM may help sort out the problem.

BIOS Settings

In many cases, changing BIOS settings can give serious problems and may freeze the system. Overlocking RAM or system processors causes instability issues. If it is the case that is freezing the system, we can reset the settings of BIOS to default. It can be done by deleting CMOS and bringing it back after many minutes. We need to always ensure that the firmware of BIOS is updated timely for preventing such problems.

External Devices

External devices or faulty USBs connected to the computer can cause a random or frequent restart. Devices such as gaming consoles, USB cameras, keyboards, or mouse externally connected to the system can be the real cause of problems like shutdown pursued by a freeze.

We can delete every connected device to see if the device normally works. Also, we can update our USB device drivers for preventing such problems.

Power Issues

The power supply unit of our system must be enough efficient to deliver enough voltage to the computer. Even if we have a strong system with the latest GPU, processor, enough RAM, and advanced motherboard, a sudden power surge or insufficient power supply can cause a system freeze on an upcoming start-up. We can prevent it by having a continuous power supply unit that can manage low voltage problems and keep the system active for some time, even when there is no power.

Hard Drive Malfunction

A clicking sound from the CPU of our device is nothing but a symptom telling us that something is not right with the hard drive. We can visit the website of the manufacturer and find a troubleshooting method to solve this problem.

We can alternatively execute a diagnostic check for examining the hard drive and run an accurate workaround. If data gets accidentally detected because of hard drive malfunction, it can be efficiently recovered with the help of the hard disk recovery tool.

Infinite Loop

If interrupts are deactivated, even a clock interrupt can't be responded. As an outcome, if the running operation doesn't abandon the CPU on its own, i.e., it comes into an infinite loop, other operations would not have a chance to be run. If interrupts are activated but preemption deactivated, CPU can react to interrupts; however, even operations with higher priority can't be run, thus making a few services offered by the ready operations unavailable.

There are many other factors that can lead to a computer freeze in addition to the reasons which are mentioned above. Whatever be the reason, the result is to prevent important data from getting vanished. Hence, it is recommended to follow a normal data backup technique to ignore negative consequences.

Ubuntu Hang Reasons

Any OS can crush, such as Ubuntu. If we are running Linux and have an issue, here are some causes and their solutions to help us get out of our crush. The first thing we can try is to restart our system if Ubuntu hangs. We might sometimes need to do a cold boot. We need to power our system off and then get the backup. Rebooting our system resolves several issues, such as the browser hangs, application crashes, and low memory.

In this article, we will discuss some below methods to recognize and recover through a crush:

  • Testing our memory
  • Free up hard drive space
  • Hardware failures
  • Recovery from an X server crash
  • Intermittent hardware issues
  • Boot Linux from other sources

Low Memory

If we are running Ubuntu and our system crashes randomly, we might be running out of memory. This low memory can be happened by opening many data files and applications.

If that's the problem, don't open several at a time or upgrade to memory on our system. Other causes of low memory are failing RAM. We need to execute a memory test to decide whether our RAM memory is bad.

Performing a Memory Test

  • Begin by switching on or rebooting our system
  • Hold down the Shift key on our keyboard to get the GRUB menu
  • We need to search the Ubuntu label, i.e., memtest86+, with the help of the arrow keys.
  • After we click on the enter button, the memory test will run automatically. We will find a blue screen during the test run.
  • The test would not complete until we clicked on the Escape We need to let the test execute for at least one complete pass. If our issue is very intermittent, we need to let the test execute longer.

Free up hard drive space

To see how much space we have on our hard drive, press the Start button, Accessories, and disks.

Ubuntu does not have a similar disk built-in defrag and clean-up tools like Windows. Then, what can we do for freeing up the disk space?

  • Empty our trash
  • Remove .ISO downloads
  • Delete old kernels we don't need
  • Uninstall applications and games we do not use
  • Clean APT cache regularly
  • Utilize a system cleaner
  • Keep our system updated

Hardware failures

If our system powers off and not coming back at all (it has no sounds and no lights), we need to first check to ensure that there is power in the outlet. The poor power supply can also be a cause.

We might have a non-moving or slow fan if it attempts to power up and power back in 30 seconds. It is quite possible that the sensor that finds fan speed might be failing.

Other elements that can cause our system to crash are as follows:

  • Overheating because fans aren't turning or slow at all
  • Poor power supply
  • Hard drive failure
  • Failing CPU or motherboard
  • Graphics card issues
  • Sensors

Also, we can test our hard drives for crashes ourselves. A possible number of failures are common. Even fresh hard drives have already a few errors.

If we know how to work with our repairs, we can substitute the failing element. Otherwise, our computer technician can repair the system.

Recovery from an X server crash

Ubuntu systems offer more than one way to recover through a crash. The simplest way is a restart. But there are some other methods which are listed below:

  • Utilize the Magic SysRq key
  • Kill the X server on the network with SSH
  • Shift virtual consoles
  • Utilize a keyboard shortcut to reboot the X server

Intermittent hardware issues

The most basic reasons for sporadic issues are hard drive failures and overheating memory errors.

If testing does not recognize the failing elements, we need to substitute them one by one until we find the issue.

Boot Linux from other sources

What if our system powers on but deny loading Ubuntu? We could have a poor hard drive, or the OS files could be corrupted. If we have made an Ubuntu USB or Live CD, we can start from that on other OSes. We need to implement it in advance, or we can make any Live boot on a distinct system.

Next TopicUbuntu Repository

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA