Score:0

Xubuntu runs well in recovery mode but freezes in normal mode

cv flag

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.

Aashish Sharma avatar
cv flag
Sorry, didn't get it, would you please explain?
heynnema avatar
ru flag
Almost guaranteed that you have a swap problem. Edit your question and show me `free -h` and `swapon -s` and `grep -i swap /etc/fstab`. Report back. Start comments to me with @heynnema or I'll miss them.
Aashish Sharma avatar
cv flag
@heynnema I have given the link for image.
Aashish Sharma avatar
cv flag
@Akshaj Singla I have given a screenfetch snapshot
heynnema avatar
ru flag
Status please...
Score:1
ru flag

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.
Aashish Sharma avatar
cv flag
@heynnema I tried your method by increasing swapsize but problem remains same.
heynnema avatar
ru flag
@AashishSharma Did you reboot after increasing the /swapfile? Please show me `free -h`.
Aashish Sharma avatar
cv flag
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
heynnema avatar
ru flag
@AashishSharma Status please...
heynnema avatar
ru flag
@AashishSharma Status please...
Someone avatar
my flag
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!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.