2

I have a laptop with a 250 GB SSD containing EFI copies of Windows 10 and Ubuntu 16.04, and a 1 TB HDD with a couple data partitions. I had been using this system with both Secure Boot and Fastboot enabled for a few weeks without issue.

Last night Ubuntu hung indefinitely during shutdown and so I hard powered the computer off by holding down the power button. When I attempted to start the computer after this, the UEFI menu could not see either the SSD or the two boot options it contained. It could still see the HDD (which contains no boot loaders, just data).

I was able to boot Ubuntu from a live USB and could not detect the SSD via Gparted or parted from within that Ubuntu system.

When I tried to reboot again this morning after the battery had run out last night, UEFI can again see the SSD and both the the Ubuntu and Windows boot options on it. However it won't boot either successfully.

Grub is able to load by default and it shows the boot options for both operating systems. When I try to boot Windows, I get the splash screen for a longer period of time than usual (maybe 30 or 60 seconds) and then it reverts back to the Grub interface to select an OS.

If I pick Ubuntu, it goes to an Ubuntu splash for a bit and then enters a terminal where it prints out:

/dev/sda4: clean, 580575/9322496 files, 5157737/37265152 blocks
[  OK  ] Started udev Kernel Device Manager.
         Starting Show Plymouth Boot Screen...
Welcome to emergency mode! After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "systemctl default" or ^D to try again to boot into default mode. 
Press Enter for maintenance

When I view the system logs with "journalctl -xb" I get a whole lot of text including the following error messages:

secureboot: Secure boot could not be determined (node 0)

and

Kernel is locked down from EFI secure boot: see man kernel_lockdown.7

and

tboot: non-0 tboot_addr but it is not of type E820_TYPE_RESERVED

When I run "man kernel_lockdown.7" I get an error saying that file doesn't exist.

Also, booting again into a live Ubuntu USB still does not let me see the SSD from either Gparted or parted, despite it now being visible from the UEFI boot options menu.

I've tried all of the above with SecureBoot and Fastboot both turned on and off in the UEFI menu.

I don't really understand how UEFI works but I think it seems like because I hard shut down the computer during the shutdown process, the SSD was has been left in a locked state in a way that makes it impossible to reload those two boot options? How would I go about fixing something like this?

Thanks!

EDIT:

I ran a chkdsk over night from within the installed Windows recovery environment cmd prompt (not from USB):

chkdsk D: /x /f /r

Which didn't locate any bad sectors or output any obvious error messages. It doesn't seem to have brought about any change in the behavior of Windows when I try to boot.

Also ran a fsck within an Ubuntu Live USB on the ext4 data partition for the Ubuntu installation, which didn't find any issues. That ext4 is on the HDD although the efi boot partition for both Windows and Ubuntu is on the SSD.

When I'm logged in to the Ubuntu Live USB I can see and navigate through the ext4 data partition for the original Ubuntu installation and open files and everything looks fine - and the same thing for the Windows data partition (located on the SSD) when I'm on a Windows recovery cmd line. I don't think there are any issues with file corruption there.One thing I was surprised by was that when loaded into that environment, the SSD was automatically mounted as D: and the HDD as C:, when the opposite was previously true in Windows - but both were mounted successfully and accessible for read access.

Not sure what to try next here beyond a clean re-install of the OSes. I also still can't seem to access the SSD from the Ubuntu live USB for some reason.

EDIT:

Here is a boot-info report created within a Ubuntu Live USB:

http://paste.ubuntu.com/p/73hdknqv6p/

EDIT:

Ubuntu cannot see the SSD as a filesystem I guess because it is currently not in AHCI mode - here's I think a pertinent output generated on a Ubuntu Live USB:

root@ubuntu:~# dmesg | grep -i 'ahci'
[    4.938935] ahci 0000:00:17.0: version 3.0
[    4.939107] ahci 0000:00:17.0: Found 1 remapped NVMe devices.
[    4.939107] ahci 0000:00:17.0: Switch your BIOS from RAID to AHCI mode to use them.
[    4.939344] ahci 0000:00:17.0: AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl RAID mode
[    4.939346] ahci 0000:00:17.0: flags: 64bit ncq sntf pm clo only pio slum part deso sadm sds apst 
[    4.939946] scsi host1: ahci

There's an option in the UEFI menu to switch to AHCI, but selecting that option doesn't seem to do anything. After switching to AHCI there and logging in to the Live USB, Ubuntu still doesn't see the SSD and the above output is the same, and shutting down and booting back into the UEFI menu shows the option switched back to the RST version instead.

Conor
  • 21
  • After a hard shutdown, you often have file corruption. With Windows NTFS partitions you need to run chkdsk from your Windows repair flash drive. You may be able to directly boot Windows from UEFI menu & f8 into its internal repair console. Similar with Ubuntu you need to run fsck on all ext4 partitions using Ubuntu live installer. You may be able to boot recovery mode & run fsck from there if partitions unmounted. https://askubuntu.com/questions/642504/ubuntu-14-04-is-not-booting-normaly-after-a-manual-hard-boot/642789#642789 – oldfred Aug 29 '19 at 21:26
  • When I try to boot into recovery mode from the existing ubuntu installation it hangs at the step "A start job is running for dev-disk-by" for 90 seconds before appearing to time out. Then it goes to the normal recovery mode screen but says "filesystem state: read-only" and won't respond to any keystrokes (eg up/down arrows to select between menu items) - had to sysrq-alt-REISUB out. – Conor Aug 29 '19 at 22:21
  • Attempting to run fsck from a live Ubuntu USB doesn't work because like I mentioned the Live USB can't see the SSD. – Conor Aug 29 '19 at 22:23
  • Does it make sense that the windows boot system would get corrupted by a hard reboot from Ubuntu? Is this something that just impacts the whole disk, as opposed to a single partition? I've just tried and I am able to get in to a Windows cmd line from the recovery mode for the existing Windows installation, and that cmd line can see the SSD in DiskPart, so I'm going to try running a chkdsk later when I'm home (currently out and can't commit to leaving the laptop running for hours undisturbed) – Conor Aug 29 '19 at 22:33
  • Corruption may only occur on partitions or files that are in use. If in Ubuntu you have mounted a NTFS partition and that was part of the issue, then chkdsk may be required. Generally Windows & Ubuntu are separate and one should not change other. – oldfred Aug 30 '19 at 03:42
  • I would only experiment with UEFI Secure boot off. And make sure drives are AHCI. Shutdown issue may have been caused by Windows update changing UEFI settings or Ubuntu update not completing. That you have UEFI entry for boot does not mean much, it saves entries as long as drive is connected. Does system show drive ok in system drive listing? – oldfred Aug 30 '19 at 18:24
  • With regards to your last question, which system do you mean? The Ubuntu emergency mode prompt which the Ubuntu installation defaults into can't see the SSD at all, but the Windows recovery environment is able to mount it and shows all the partitions as healthy. I just checked and it actually WASN'T set to AHCI mode in BIOS but changing this doesn't seem to have made any change in the boot behavior. Thanks! – Conor Aug 31 '19 at 02:53
  • Windows needs AHCI drivers to keep working. You have to turn AHCI back off to install those drivers. With AHCI on, does Ubuntu now see SSD? have you updated UEFI and SSD firmware? You have to restore UEFI settings, I keep a list as I have to change many. Windows will not see Linux partitions. May be best to see details, use ppa version with your live installer (2nd option), not older Boot-Repair ISO: Please copy & paste link to the Boot-info summary report ( do not post report), the auto fix sometimes can create more issues. https://help.ubuntu.com/community/Boot-Repair – oldfred Aug 31 '19 at 03:30
  • Want to make that practically impossible to happen again? Run sudo nano /etc/hdparm.conf and cursor down to #write_cache = off and remove the #, then press Ctrl+X Y Enter. Your performance loss will be negligible - it only tells the drive to report completion when it really is on disk, instead of reporting completion when writes get into the drive buffer. Kernel disk write caching is unaffected. Sorry it won't fix it, just prevents it. I learned to do that the hard way like you did. – doug65536 Aug 31 '19 at 06:29
  • I just checked and actually the switch in the UEFI menu to use AHCI was not persistent - it lets me select AHCI but after I attempt to boot Windows or Ubuntu (without any apparent change in behavior) it's switched back to "Intel RST Premium with Intel Optane System Acce" - so maybe I don't have the AHCI drivers and it's not trying to boot with AHCI at all. I'll try to install those in a bit! I also haven't tried updating the UEFI or SSD firmware yet, but here is a current boot-info report generated from within the live USB: http://paste.ubuntu.com/p/73hdknqv6p/ – Conor Aug 31 '19 at 18:18
  • Report is not seeing NVMe drive. Typical of either UEFI/SSD firmware update need and/or Windows is hibernated or Fast Start up back on. Windows is known to turn Fast start up back on and change some UEFI settings with updates (which you may not see in background). – oldfred Sep 01 '19 at 19:50
  • I've been traveling the last few days but am home now and so can make a more determined effort to fix this. I'll try updating the UEFI and SSD firmware now! If it is an issue with Windows being in hibernation how would I fix that? – Conor Sep 01 '19 at 23:05
  • Fast start up is definitely off in the UEFI menu. I did find a newer version of the UEFI firmware - the motherboard is model X580GD, currently on BIOS version 308, but the newest available is 314. However the options for updating say that I can only upgrade and cannot downgrade, and the internet seems to think that upgrading the BIOS can be risky - is this definitely something that makes sense to try? Why would the existing BIOS suddenly have stopped working after it had been going fine for weeks? – Conor Sep 02 '19 at 01:33
  • You mentioned earlier that I should try installing new AHCI drivers - is that something I could do via the Ubuntu Live USB, or the Windows Recovery cmd line? How do I go about doing that? Thanks! – Conor Sep 02 '19 at 01:37
  • I honestly don't really have anything important on either the SSD or the HDD which isn't backed up. Is there a risk to just trying a clean install of the two OSes in the current state? – Conor Sep 02 '19 at 01:44
  • Ok I actually got this fixed! Going to post an answer with what I ended up doing. Thanks all! – Conor Sep 03 '19 at 05:16

1 Answers1

0

Based on oldfred's advice and a lot of googling, this is what I ended up doing which seems to have corrected the problem:

1) Loaded UEFI settings and turned OFF secure boot and fast boot. Make sure to save UEFI setting changes before booting an operating system - at least on my firmware this isn't done by default, you actually need to click Save before booting out of the options menu into an OS

2) Booted Windows but used F8 to enter recovery options menu

3) Navigated through recovery menu to the cmd prompt

4) Set windows to boot in safe mode:

bcdedit /set {current} safeboot minimal

5) Restart and boot Windows again (in safe mode, given the above setting)

6) Open regedit and change the registry values and default values for the following keys to 0:

HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ iaStorV -> start
HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ iaStorV\ StartOverride 
HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ storahci -> start
HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ storahci\ StartOverride 

7) Restart the computer again, and load the UEFI settings. Changed SATA options to AHCI mode, from Intel IDE RST

8) Boot Windows, which will again boot into safemode, but will this time install all the AHCI drivers (NOTE - trying to boot into Windows after switching to AHCI without having it in safe mode will cause a bluescreen)

9) Run the following command in a cmd prompt to remove default safe mode booting

bcdedit /deletevalue {current} safeboot

10) Restart and boot into Windows, which should now load properly in non-safe mode with AHCI

11) Restart and boot into Ubuntu, which should now load properly and detect the AHCI SSD

12) Turned Secure Boot and Fast Boot back on in the UEFI options and verified that both operating systems can still boot properly

I THINK that this is the full list of things I did which are important to reproducing the successful fix. I did a lot of other stuff before figuring this out though so it's possible I've missed something else relevant!

Conor
  • 21