Ubuntu: Slow boot or no boot at all - how did i mess up my ubuntu installation this time?



Question:

UPDATE 2018-03-23

So, i finally identified the problem. Its all about mounting NTFS paritions on startup on a dual boot setup. So if you want to share data between windows and linux, you might want to use FAT32 over NTFS. It seems windows sometimes unmounts the filesystem in a way, that causes linux to have troubles mounting it again. To fix the boot-problem, you can go into emergency console and type

ntfsfix /dev/sdXX  

where sdXX is the identifier of the ntfs partition. You can look that up in your /etc/fstab or by typing df. After runnung ntfsfix you are able to login by exiting the emergency console (simply type exit)

ORIGINAL POST

I recently decided to upgrade my pc and re-install ubuntu as well as windows. I must have made some terrible mistake because booting into ubuntu is working only every second attempt.

When the boot fails a emergency terminal will show up. I exported the log with the suggested journalctl -xb and uploaded the output for you (see link below)

The relevant parts of my hardware configuration:

Asus M5A97 LE R2.0 Mainboard      - PCIe 2.0 x 16: AMD Radeon R9 380      - PCIe 2.0 x 4: PCIe > M.2 Converter          - 500GB NVME attached to M.2 Converter      - PCI: Creative Sound Blaster X-Fi SB0730      - SATA-3: 480GB SSD      - SATA-3: 500GB HDD  

The mainboard has no boot-from-pcie support, so i could not install windows or ubuntu directly to the NVME drive. I figured it might be okay to simply install the bootloader to the SSD (/dev/sda), place the /boot mount on a primary partition on the ssd too (/dev/sda3) and mount everything else onto the nvme.

To avoid configuring grub i decided to first install windows 10 and then install ubuntu, so ubuntu will automatically write grub into the MBR of /dev/sda. That allways worked perfectly...

Additionally i created a ntfs-3g mount for the ssd to share data between my operating systems. I created only one ext4 partition on the hdd and mounted it on some user-folder (within /media)

What i tried so far

  • At first i noticed that i had no sound. Because i bought the mainboard second-hand i assumed the ac97 chip is broken and bought a second-hand soundcard (see above). I thought that might caused the boot-troubles, but that wasnt the case. I do have sound now but still the boot problems.

  • Then i read something about UUID issues in /etc/fstab because of multiple installation attempts and i checked all uuids and they were same as in /etc/fstab.

  • Then i read something about a wrongly mounted swap partition, so i ummounted, swapoff and swapon the partition on /dev/nvme0n1p6. No success.

  • Then i found some post, that it might be better to remove the uuids from /etc/fstab and simply insert the partitions directly. So i did - no success.

  • Like always lightdm made lots of problems, so i installed gdm instead.

lsblk -f output

NAME        FSTYPE   LABEL             UUID                                 MOUNTPOINT  loop1       squashfs                                                        /snap/vlc/190  sdb                                                                           â""â"€sdb1      ext4                       4fd6ff2a-50d0-465e-bd85-1c698bdbdc4a /media/hdd  loop0       squashfs                                                        /snap/core/4110  sda                                                                           â"œâ"€sda4                                                                        â"œâ"€sda2      ntfs                       CAC4D02AC4D01B11                       â"œâ"€sda5      ext4                       b68dceb3-b600-4143-bbcb-836e94503c34 /var  â"œâ"€sda3      ext4                       09ef7d7c-6332-4c63-b4df-5875db98ebd7 /boot  â"œâ"€sda1      ntfs     System-reserviert 0CE4C7BBE4C7A4F4                       â""â"€sda6      ntfs     Share             7FA5097E3B9D5067                     /media/share  nvme0n1                                                                       â"œâ"€nvme0n1p5 ntfs     NVME              AA52186052183393                       â"œâ"€nvme0n1p1                                                                   â"œâ"€nvme0n1p6 swap                       3277de96-09c9-4731-805a-a693c08543ab [SWAP]  â""â"€nvme0n1p2 ext4                       891a41fd-4c9b-4c0f-9f10-7abe82952b0a /  

contents of /etc/fstab

# /etc/fstab: static file system information.  #  # Use 'blkid' to print the universally unique identifier for a  # device; this may be used with UUID= as a more robust way to name devices  # that works even if disks are added and removed. See fstab(5).  #  # <file system> <mount point>   <type>  <options>       <dump>  <pass>  # / was on /dev/nvme0n1p2 during installation  /dev/nvme0n1p2 /               ext4    errors=remount-ro 0       1  # /boot was on /dev/sda3 during installation  /dev/sda3 /boot           ext4    defaults        0       2  # /var was on /dev/sda5 during installation  /dev/sda5 /var            ext4    defaults        0       2  # swap was on /dev/nvme0n1p6 during installation  /dev/nvme0n1p6 none            swap    sw              0       0  # share ntfs partition on 480g ssd  /dev/sda6   /media/share    ntfs-3g permissions 0   2  # hdd  /dev/sdb1   /media/hdd  ext4    defaults    0   2  

And finally the logs of my last unsuccessful boot attempt

http://s000.tinyupload.com/download.php?file_id=00683467828265059379&t=0068346782826505937914236

I would appreciate any help! Thanks for reading so far ;-)

UPDATE

That part of the bootlog might be interesting:

Mär 07 18:12:34 desktop-amdfx systemd-fsck[732]: /dev/sda3 besitzt nicht unterstützte Eigenschaft(en): metadata_csum  Mär 07 18:12:34 desktop-amdfx systemd-fsck[732]: e2fsck: Neuere Version von e2fsck benötigt!  Mär 07 18:12:34 desktop-amdfx systemd-fsck[732]: fsck failed with error code 8.  Mär 07 18:12:34 desktop-amdfx systemd-fsck[732]: Ignoring error.  Mär 07 18:12:34 desktop-amdfx systemd[1]: Found device SanDisk_Ultra_II_480GB 5.  


Solution:1

I managed to track down the problems and fix them.

It seems to be problematic to have /var mounted on another disk. Maybe because logging to /var/log is hardcoded somewhere during boot when the disk has not yet been mounted.

How to solve?

Boot to recovery mode mount drives with read/write options

then

nano /etc/fstab  # -> in nano outcomment the /var mount by prepending a "#" character  umount /dev/sdxx /var  mkdir /media/var  mount /dev/sdxx /media/var  rm -rf /var  mkdir /var  rsync -a /media/var/ /var/  reboot  

explanations

sdxx is the partition identifier you mounted on /var. Depending on your Setup this can also start with nvme.

  1. nano /etc/fstab at first we need to prevent from mounting the extra-partition on /var. Once the editor fired up outcomment the mount and close by pressing Ctrl+w followed by Ctrl+x
  2. umount /dev/sdxx /var unmount the drive
  3. mkdir /media/var create a directory in which you are going to re-mount sdxx
  4. mount /dev/sdxx /media/var mount the partition on the new directory
  5. rm -rf /var use the sledgehammer and make sure nothing is left from before
  6. mkdir /var create new empty folder as root
  7. rsync -a /media/var/ /var/ copy everything as-is to /var. I dont know why, but cp -a got me wrong results, only rsync -a seems to work reliable.
  8. reboot test installation

What where my problems with cp -r?

After copying all files to /var i checked if the structure seems the same by running a few commands.

checking by folder-size

du -hs /var vs. du -hs /media/var

checking by number of symbolic links

find /var -type l | wc -l vs. find /media/var -type l | wc -l

I made several attempts, cp always fucked up something, either the permissions were wrong and services started to block the boot or links were created where none had been in the source. Dont ask me why - as i understand cp -a it should work perfectly - but it didnt. rsync -a did though

important: dont forget the trailing slash in the rsync command

UPDATE

So NOW it becomes more clear. After configuring my /dev/sda5 to directly mount /var/www instead of /var (for historical reasons i am used to host my web-projects in that location) the boot was not successful again. So i assumed it has to be apache that blocks my boot.

My solution for this

  1. boot into recoverymode
  2. run mount -a -orw,remount to have read/write access to the file system
  3. run systemctl disable apache2.service to prevent apache from starting automatically on boot

And now it works again.

For some reason it seems apache is loading BEFORE all disks have been mounted. So this could be some NASTY bug in systemd.

I am going to reboot 5 times now to be sure :-)

UPDATE 2

OKAY - it seems more than 1 problem affected me at once

I finally (at least for the moment lookingfrustrated) got my setup working by:

  1. moving all optional mounts (except /, /boot and swap) from /etc/fstab to manual mount in /etc/rc.local
  2. running ntfsfix before mounting the partition that is mounted in both - windows and linux

So in detail:

Ubuntu seems to mount all drives parallel and not one-by-one, thats the reason for the random nature of this problem.

When windows shuts down it may not leave a "clean" filesystem behind because of some internal windows thing.

My /etc/fstab contains only the critical linux-only partitions:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>  /dev/nvme0n1p2 /               ext4    errors=remount-ro 0       1  /dev/sda3 /boot           ext4    defaults        0       2  /dev/nvme0n1p6 none            swap    sw              0       0  

And my /etc/rc.local contains the instructions for everything else:

mount /dev/sda5 /var/www  mount /dev/sdb1 /media/hdd  ntfsfix /dev/sda6  mount -t ntfs-3g /dev/sda6 /media/share  exit 0  

3 boots in a row without issues. But i doubt everything is really fine now, my system seems cursed

UPDATE 3

This is not a solution either, mounting now becomes "competitive" because ubuntu tries to mount /dev/sda5 and /dev/sdb1 automatically on /media/$USER/somelabel

Additionally i noticed that the ntfs-3g sometimes prevents from shutting down, so i have to shutdown by pressing the power-button.

I think there is something i completely miss :-(


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »