0

Since some time I have problems that my Linux Ubuntu 18.04 is very slowly booting (sometimes 5-10 minutes). Strangely, this seems to have started since I edited the Swapfile or/and that I used Gparted. The top command and swapon -s command show that the Swapfile is working (I reserved 4 GB).

But the following command showed something weird:

sudo findmnt --verify --verbose

All lines are fine except the following warning appears:

[W] non-bind mount source /swapfile is a directory or regular file

What does that line exactly mean? Does it mean that it could not mount the swapfile? (while actually in the end it is working). So I wondered if something is wrong in my fstab file.

cat /etc/fstab

The swap line gives the following:

/swapfile none swap sw 0 0

I heard that problems of finding and mounting the swapfile during boot can slow down the whole process. The swapfile is running from the main disk so I wondered if the above line should be changed in something like this:

UUID=xx9999x9-9x99-9xx9-9999-xx9x9xx99xx9/swapfile none swap sw 0 0

Where the UUID is the hard disk. I did not use any partitioning.

Systemd-analyze blame gives the following output:

systemd-analyze blame | head
 17.041s dev-sda1.device
 11.192s dev-loop9.device
 11.056s dev-loop16.device
 10.964s dev-loop14.device
 10.704s dev-loop6.device
 10.703s dev-loop1.device
 10.703s dev-loop7.device
 10.703s dev-loop2.device
 10.702s dev-loop4.device
 10.687s dev-loop13.device

After having used sudo apt-get purge snapd this is the following:

systemd-analyze blame | head
    7.902s dev-sda1.device
    7.152s NetworkManager-wait-online.service
    5.121s ufw.service
    4.792s systemd-udevd.service
    4.539s docker.service
    4.298s accounts-daemon.service
    4.152s systemd-journal-flush.service
    3.970s apparmor.service
    3.808s avahi-daemon.service
    3.751s bluetooth.service

The command sudo blkid gives one line (I anonymized the ID). Previously, there were a lot of lines /dev/loopX: TYPE="squashfs"

    /dev/sda1: UUID="xx9999x9-9x99-9xx9-9999-xx9x9xx99xx9" TYPE="ext4"   PARTUUID="9999xx999-01"

A screenshot of Disks parameters:

SMART Data

Output of syslog:

grep -i FPDMA /var/log/syslog*

[ 48.245514] ata6.00: failed command: READ FPDMA QUEUED [ 48.247916] ata6.00: failed command: READ FPDMA QUEUED [ 48.250316] ata6.00: failed command: READ FPDMA QUEUED [ 48.252774] ata6.00: failed command: READ FPDMA QUEUED

Here follows a screenshot of Gparted:

Gparted

Another observation: when I start the computer, the screen stays black 5-10 minutes. Then after long waiting, it gives a title screen with the laptop mark. From there all seems to run smoothly. Just wanted to say this as it may indicate where during the booting something is going wrong. I wondered if the boot loader (Grub) can be broken, since I previously run dual boot on this system and removed Windows 7 recently.

File system table

sudo cat /etc/fstab
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=ae2158a5-6f28-4da8-8082-cc6d6bb20ed2 /               ext4       errors=remount-ro 0       1
/swapfile none            swap    sw              0       0


sudo blkid /dev/sda1: UUID="ae2158a5-6f28-4da8-8082-cc6d6bb20ed2" TYPE="ext4" PARTUUID="630bb523-01"

BIOS version

sudo dmidecode -s bios-version
1.03.05

Motherboard infos:

TUXEDO Book DC1504
Model: W650SJ
Clevo CO

sudo dmidecode -t 2

dmidecode 3.1

Getting SMBIOS data from sysfs. SMBIOS 2.8 present.

Handle 0x0002, DMI type 2, 15 bytes Base Board Information Manufacturer: Notebook
Product Name: W65_67SJ
Version: Not Applicable
Serial Number: Not Applicable
Asset Tag: Tag 12345 Features: Board is a hosting board Board is replaceable Location In Chassis: Not Applicable Chassis Handle: 0x0003 Type: Motherboard Contained Object Handles: 0

I am running Ubuntu 18.04.5 LTS.

Grub

The command dpkg -l grub* | grep ii gives the following output:

ii  grub-common           2.02-2ubuntu8.18 amd64        GRand Unified Bootloader (common files)

ii grub-gfxpayload-lists 0.7 amd64 GRUB gfxpayload blacklist

ii grub-pc 2.02-2ubuntu8.18 amd64 GRand Unified Bootloader, version 2 (PC/BIOS version)

ii grub-pc-bin 2.02-2ubuntu8.18 amd64 GRand Unified Bootloader, version 2 (PC/BIOS binaries)

ii grub2-common 2.02-2ubuntu8.18 amd64 GRand Unified Bootloader (common files for version 2)

Thank you for your help!

  • Your /etc/fstab /swapfile line is fine. Don't add UUID. What commands did you use to "started since I edited the Swapfile"? What did you do with gparted? All of these details should be in your question. Hit the ESC key during boot, and see where booting stops... that will give a clue as to why it's taking so long to boot. – heynnema Sep 11 '20 at 14:48
  • What is the output of systemd-analyze blame | head in your system? Please [edit] your question and add this info. – FedKad Sep 11 '20 at 15:16
  • Might be related to: https://askubuntu.com/questions/1056645/what-are-the-dev-loop-services-that-started-on-boot . It seems to me that snaps (some misconfiguration?) are causing the problem. Paste also the output of losetup command to your original question. – FedKad Sep 11 '20 at 15:21
  • I think the issue can be A) You've misconfigured something B) it's the snaps removing all cut 2+ minutes C) based on my 2 tb luks hdd (~4 ms with fsck) your sda1 is taking a bit long, is it running fsck? What filesystem,partition,free space,fstab parameters do you have on it? – kortewegdevries Sep 11 '20 at 17:43
  • @kortewegdevries It's probably A. – heynnema Sep 11 '20 at 18:03
  • @FedonKadifeli: Thank you. I have followed the advice in the link and used sudo apt-get purge snapd. That does clearly improve the noted times in system-analyze blame | head, but booting remains very slow. Is it possible that an outdated or broken Grub causes these kind of problems? – Partoudata Sep 11 '20 at 19:55
  • Can you [edit] and update your original question, by pasting the new output of system-analyze blame | head? – FedKad Sep 12 '20 at 07:21

1 Answers1

2

You probably made a mistake when you "edited" the /swapfile.

  • "seems to have started since I edited the Swapfile"

  • "/swapfile is a directory or regular file"

The correct process for creating/resizing to a 4G /swapfile...

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

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 nnG RAM and 4G swap

Confirm this line in /etc/fstab... and confirm no other “swap” lines...

/swapfile    none    swap    sw      0   0

reboot                    # reboot and verify operation

Update #1:

You have some NCQ errors with your disk.

Native Command Queuing (NCQ) is an extension of the Serial ATA protocol allowing hard disk drives to internally optimize the order in which received read and write commands are executed.

Edit sudo -H gedit /etc/default/grub and change the following line to include this extra parameter. Then do sudo update-grub to write the changes to disk. Reboot. Monitor hangs, and watch /var/log/syslog or dmesg for continued error messages.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash libata.force=noncq"

If this doesn't help cure the problem, we'll come back and bad block the disk.

Update #2:

Since you're still having problems, we'll do this to troubleshoot the slow startup times.

Edit /etc/default/grub.

change this line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash libata.force=noncq"

to this:

GRUB_CMDLINE_LINUX_DEFAULT="libata.force=noncq"

then:

sudo update-grub

reboot

This will now show a lot of text on the screen during the reboot. When it stalls or pauses, the last item on the screen will give us a clue as to what's wrong. Take a clear picture of that and upload it into your question, and then ping me.

Your SMART data doesn't show any bad block problems. It DOES show lots of read errors, which the NCQ patch MAY have taken care of.

Update #3:

Note: You should have good backups, just in case of problems.

We'll update your ramdisk, and reinstall GRUB.


ls -al /boot/initrd* # note the size of these files

sudo update-initramfs -c -k $(uname -r) # recreate the ramdisk file

ls -al /boot/initrd* # note if the file sizes have changed

reboot # see if it boots any faster now


dpkg -l grub* | grep ii # show current grub file packages installed

sudo apt install --reinstall package_name_here # for each GRUB package listed above

sudo update-grub # update GRUB

reboot # see if it boots any faster now

Update #4:

To check for a newer BIOS, you must create a user account at https://www.tuxedocomputers.com/index.php?module=account

To contact Tuxedo support, call tel:+4982189982992, and email at https://www.tuxedocomputers.com/en/Contact.tuxedo

heynnema
  • 70,711
  • Sorry but I don't find this answer to be very relevant to the problem Partoudata is having. The swapfile made is already working: "The top command and swapon -s command show that the Swapfile is working" and isn't contributing to the slow boot time as much as the snaps are. – kortewegdevries Sep 11 '20 at 17:26
  • @kortewegdevries If you read closer, you'll note "seems to have started since I edited the Swapfile or/and that I used Gparted" and "/swapfile is a directory or regular file"... so what better place to start, than with the possibility that something was done incorrectly with /swapfile? – heynnema Sep 11 '20 at 17:32
  • @heynnema: thank you for your help! I followed your advice, unfortunately recreating the swapfile does not change anything. To be fair, I am not really sure when the problems with booting started, it may already have started before re-partitioning. I saw the following post where you answered a question: https://askubuntu.com/questions/1189592/slow-start-after-removing-a-hard-disk. I noticed there something different in the formatting of fstab. Shouldn't the format be like UUID=af9cbf4b-7a29-422e-b24a-e620301b8369 none swap sw 0 0 or rather /swapfile none swap sw 0 0 ? – Partoudata Sep 11 '20 at 19:50
  • @Partoudata Edit your question and show me cat /etc/fstab and show me a screenshot of gparted, and tell me what changes you made using gparted. – heynnema Sep 11 '20 at 19:53
  • @Partoudata Also show me sudo blkid. – heynnema Sep 11 '20 at 21:23
  • @Partoudata Also show me screenshot(s) of the Disks app scrollable SMART Data window. – heynnema Sep 12 '20 at 15:23
  • @Partoudata Status please... – heynnema Sep 13 '20 at 15:30
  • @heynnema: What do you mean with "Disks app scrollable SMART Data window", do you mean a test with Smartmontools package of the harddrive? ( https://help.ubuntu.com/community/Smartmontools ) – Partoudata Sep 13 '20 at 16:13
  • @Partoudata No. In the Disks app, there's a SMART Data window which shows various parameters from the disk. This window is scrollable, although it doesn't look like it with a scroll bar on the right. I need screenshots of all of the parameters. Also, please show me ALL of the requested information, and don't redact any info like UUIDs, or I can't help. Redacting loop info is fine. – heynnema Sep 13 '20 at 16:21
  • @heynnema: Sorry, can you give an URL to anything about Disks app? Tried to Google it but it does not give a clear result. – Partoudata Sep 13 '20 at 16:29
  • @Partoudata Just hit the SUPER key and type Disks. – heynnema Sep 13 '20 at 16:32
  • @Partoudata Thanks for the SMART Data. You have lots of read and seek errors. Show me grep -i FPDMA /var/log/syslog*. – heynnema Sep 13 '20 at 17:11
  • @heynnema: the harddisk is a Seagate, they tell measuring read and seek gives always inflated values. What do you think? Any other suggestions? – Partoudata Sep 15 '20 at 12:24
  • @Partoudata No, read/seek errors are important. Was there only 4 items shown from the last grep command, or were there more? You have some disk NCQ errors. Also, is yours an older BIOS computer, or a newer UEFI computer? Please tell me how/why your repartitioned with gparted. Is this a desktop or laptop computer? Then I can update my answer. – heynnema Sep 15 '20 at 13:31
  • @Partoudata I also still need to see cat /etc/fstab and sudo blkid (without redactions). And show me sudo dmidecode -s bios-version and tell me the exact make/model # of your computer or motherboard. Thanks. – heynnema Sep 15 '20 at 13:34
  • @Partoudata Please see Update #1 in my answer. Reboot and report back. Remember to flag me with a comment that starts with "@heynnema". Thanks for the other infos. I do need the exact make/model # to see if there's a newer BIOS available. I couldn't find that with the info you've given. – heynnema Sep 15 '20 at 16:42
  • @heynnema: When I started the machine today it was "surprisingly" faster. No blackscreen, directly the laptop trademark, as it used to be. This was before I made the changes that you propose under #1. I think it may be because of sudo update-grub I did. Hope it stays this way. Thank you for your kind help! – Partoudata Sep 16 '20 at 12:27
  • @heynnema: For learning purposes, could you tell how you identified the NCQ errors on the disk? – Partoudata Sep 16 '20 at 12:37
  • If we modify the previous grep -i FPDMA /var/log/syslog* command, to grep -i FPDMA /var/log/syslog* -B5 -A5 | more you'll see ncq listed in that output. Have you done Update #1 from my answer? – heynnema Sep 16 '20 at 15:14
  • @Partoudata Status please... – heynnema Sep 24 '20 at 14:27
  • @heynnema: For a while booting was fast but it has reverted to the previous state and actually worse, it is now taking one hour to start Ubuntu. I wonder if the hard drive has any problem. When it is finally running everything works smooth, only the mouse freezes now and then (reconnecting it to the USB helps). I have done Update #1 as you asked. As you suggested in your answer to bad block the disk I have run yesterday sudo badblocks -v /dev/sda1 > badsectors.txt which gave surprisingly Pass completed, 0 bad blocks found. (0/0/0 errors). What is the right way to bad block the disk? – Partoudata Oct 30 '20 at 10:43
  • @Partoudata See Update #2 in my answer. – heynnema Oct 30 '20 at 13:32
  • @heynnema: Thank you! You mentioned "Note: do NOT bad block a SSD". Mine is SSHD. Is there any danger of damaging the disk using sudo e2fsck -fccky /dev/sdXX or is it safe? – Partoudata Oct 30 '20 at 21:33
  • @Partoudata I guess that it's probably not a good idea to BB a SSHD. But you don't have any bad blocks that I can tell. I reworked my answer for that. Did you do the NCQ patch? Did you do the first part of Update #2 yet? – heynnema Oct 30 '20 at 22:06
  • @heynnema: Yes, regarding the NCQ, I have used GRUB_CMDLINE_LINUX_DEFAULT="libata.force=noncq" . The screen messages come only after 30-60 minutes waiting a black screen where nothing seems to happen. When after this long time the messages appear, it is all pass (green), no failures. It does not stall, at this point booting has no problems. Could the actual problem occur before the booting process? – Partoudata Nov 02 '20 at 09:28
  • @Partoudata I haven't been able to check on your BIOS with the info that you've given. Please tell me the exact make/model # of your computer or motherboard. Next we'll rebuild your ramdisk, and reinstall GRUB. Give me a few minutes to update my answer. – heynnema Nov 02 '20 at 13:18
  • @heynnema: I have done the steps you indicated under #Update 3 with 2 reboots and it did not improve. I have updated the infos in the question (see Grub) and I wondered if grub and grub2 could interfere in some way, or if any of the grub packages seems strange to you. Could you tell me what exact motherboard info you would need? – Partoudata Nov 04 '20 at 14:08
  • @Partoudata I need the make/model # of your computer, or motherboard (if home built). See the tag on the bottom of the computer. For example: Dell Inspiron 54321. – heynnema Nov 04 '20 at 14:16
  • @Heynnema: I have added it under Motherboard infos. – Partoudata Nov 04 '20 at 14:34
  • @Partoudata To determine if there's a newer BIOS available, they want you to log into your Tuxedo account at https://www.tuxedocomputers.com/index.php?module=account – heynnema Nov 04 '20 at 15:06
  • @Heynnema: thank you for the link! I have made an account but as I am not the original but second-hand user of this laptop I do not have access to the needed BIOS pack. Nor does Tuxedo respond to my requests. Is there an alternative to find the needed BIOS pack? – Partoudata Nov 06 '20 at 12:27
  • @Partoudata Have you tried to phone call them, and/or sent email? Their phone # is tel:+4982189982992, and email at https://www.tuxedocomputers.com/en/Contact.tuxedo – heynnema Nov 06 '20 at 15:02
  • @heynnema: Finally could reach them by telephone. Their support suggests not replacing the BIOS but rather unplug the harddrive and boot without harddrive. I am bit confused if this is a way to go... what do you think? – Partoudata Nov 06 '20 at 16:10
  • @Partoudata EVERY company suggests not to upgrade the BIOS... IF the machine is operating normally. Yours is not. How can you boot if the hard disk is unplugged? Kind of stupid. I'd call them again and get the BIOS updater. – heynnema Nov 06 '20 at 16:51