0

I have been using Xubuntu 20.04 LTS as a primary OS. From time to time it gets randomly freezes and restarts. Freezing might be any time regardless of opening some specific program. While freezing nothing work. I have to manually press power button to shut it down. But the interesting part is, it doesn't get freeze while logging into grub recovery mode and start normal boot from there.

Here is my swapfile and other descriptions link https://pasteboard.co/8krbKHbriZzR.png

Here's my screenfetch snapshot https://pasteboard.co/RbaWBF55Ab8v.png

Here's my SMART Data and Self-Tests image https://pasteboard.co/Rvv1eY7hsqwb.png

PC specification:

  • RAM: 6GB DDR3
  • Processor: Intel Pentium B960 @2.40GHz
  • HDD size: 500 GB
  • Graphics card: Intel HD Graphics 2000

I have used various methods to troubleshoot this issue.

Methods I did try:

  • Updated and upgraded all packages
  • Fixed missing dependencies
  • Updated kernel to latest stable version
  • Installed right graphics driver
  • did boot-repair

I even reinstalled Xubuntu but the error remains the same.

heynnema
  • 70,711

1 Answers1

1

Yes, as I thought, your /swapfile is too small at 2G. Let's increase it to 4G and see if that helps...

Note: Depending on your usage pattern, you may need to add more RAM.

Note: Incorrect use of the rm and dd commands can cause data loss. Suggest copy/paste.

In the terminal...

sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile # set proper file protections sudo mkswap /swapfile # init /swapfile sudo swapon /swapfile # turn on swap free -h # confirm 6G RAM and 4G swap

Edit /etc/fstab, using sudo -H gedit /etc/fstab or sudo pico /etc/fstab.

Confirm this /swapfile line in /etc/fstab... and confirm no other “swap” lines... use SPACES in this line... confirm NO TABS...

/swapfile  none  swap  sw  0  0

reboot                    # reboot and verify operation

Update #1:

After reviewing the SMART data for your older 500G HDD, there are READ errors, PENDING SECTOR errors, and SELF-TEST errors. We should bad block your disk to see if we can map out any bad sectors.

After bad blocking the disk, run the Disks application SMART Self-Tests to confirm proper operation.

Note: do NOT abort a bad block scan!

Note: do NOT bad block a SSD

Note: backup your important files FIRST!

Note: this may take many hours

Note: you may have a pending HDD failure

Boot to a Ubuntu Live DVD/USB in “Try Ubuntu” mode.

In terminal...

sudo fdisk -l # identify all "Linux Filesystem" partitions

sudo e2fsck -fcky /dev/sdXX # read-only test

or

sudo e2fsck -fccky /dev/sdXX # non-destructive read/write test (recommended)

The -k is important, because it saves the previous bad block table, and adds any new bad blocks to that table. Without -k, you loose all of the prior bad block information.

The -fccky parameter...

   -f    Force checking even if the file system seems clean.

-c This option causes e2fsck to use badblocks(8) program to do a read-only scan of the device in order to find any bad blocks. If any bad blocks are found, they are added to the bad block inode to prevent them from being allocated to a file or direc‐ tory. If this option is specified twice, then the bad block scan will be done using a non-destructive read-write test.

-k When combined with the -c option, any existing bad blocks in the bad blocks list are preserved, and any new bad blocks found by running badblocks(8) will be added to the existing bad blocks list.

-y Assume an answer of `yes' to all questions; allows e2fsck to be used non-interactively. This option may not be specified at the same time as the -n or -p options.

heynnema
  • 70,711
  • 2
    @heynnema I tried your method by increasing swapsize but problem remains same. – alexander Oct 20 '21 at 03:26
  • @AashishSharma Did you reboot after increasing the /swapfile? Please show me free -h. – heynnema Oct 20 '21 at 03:28
  • I will consider about your update but what I wanna tell is after updating grub with GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_idle.max_cstate=1". The freezing decreases slightly but not completely. I don't know about this but this give a little more time to work with my pc @heynnema – alexander Oct 22 '21 at 15:30
  • @AashishSharma Status please... – heynnema Oct 25 '21 at 14:17
  • @AashishSharma Status please... – heynnema Oct 30 '21 at 02:58
  • Hello! You already know who downvoted your answer as we already had a long discussion about it. I'm sorry for this downvote. I've upvoted your answer. You know, at the time I downvoted your question I was new to the site and didn't know how downvotes work. Sorry! – Error404 Jan 20 '22 at 14:07