You are not logged in.

#1 2017-09-14 09:22:28

benjmanable
Member
Registered: 2017-03-12
Posts: 10

GRUB bootproblems after windows hibernate

Hey there,

After trying to boot archlinux while Windows 10 was in hibernation GRUB is kind of stuck with the following message:

Loading Linux linux...
error: invalid cluster 0.
Loading initial ramdisk...
error: you need to load the kernel first.

Press any key to continue...

After some research I found out, that one should disable hibernation in windows if windows and archlinux are installed on the same computer. Otherwise booting archlinux while windows is in hibernation can lead to data loss. But I couldn't find out what to do, when it already happened...

Many thanks in advance!

Last edited by benjmanable (2017-09-14 09:24:23)

Offline

#2 2017-09-14 10:06:33

dockland
Member
From: Sweden
Registered: 2015-06-06
Posts: 861

Re: GRUB bootproblems after windows hibernate

Can you boot in to Windows?
If thats the case, check that Fast startup is disabled aswell, under Power options in Control panel.


I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.
I use it to look at funny pictures of cats and to argue with strangers.

Offline

#3 2017-09-14 10:17:56

benjmanable
Member
Registered: 2017-03-12
Posts: 10

Re: GRUB bootproblems after windows hibernate

Yes, I can boot into windows... I did check the option, it was enabled. I disabled it and then tried to boot into my archlinux again, still the same problem.

Offline

#4 2017-09-18 11:54:35

benjmanable
Member
Registered: 2017-03-12
Posts: 10

Re: GRUB bootproblems after windows hibernate

So, I quess I found out where the problem is: with the EFI system partition...
I checked my partitions and found out that my home directory is still intact. So no significant data loss.

But I found my etc/fstab with double entries. I don't have a clue why, but I deleted the wrong entries.

The command

 mkinitcpio -p linux 

failed with the following error message:

 ==> Building image from preset: 'default'
   -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux'
==> Building image from preset: 'fallback'
   -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux`

If I had to guess, I would say the problem lies within the EFI system partition which is shared by windows and archlinux. Somehow I think windows messed up the partition when coming back from hibernation.

I now intend to format the partition again, install grub and make a proper entry in the etc/fstab.

I would be happy about any comments or suggestions.

Last edited by benjmanable (2017-09-18 11:57:28)

Offline

#5 2017-09-18 15:17:01

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: GRUB bootproblems after windows hibernate

I don't think Windows has messed up the files in the EFI partition whether it is hibernated or not. If Windows is hibernated (which is the case when you turn it off if the "fast boot" option is enabled), you cannot mount the Windows partition within Linux without risking to corrupt it. In theory, this might also apply to the EFI partition (since Windows use it) but as Windows doesn't mount it by default I doubt this is a problem.

I think you don't have mounted /boot correctly. When you install a kernel, it lands in /boot and as for every package, the files installed by a package must remain accessible at all time. Can you describe more properly what is your partition layout? What is the content of /boot? of pacman -Qk linux? Are you using a separate /boot partition? How have you configured Grub? Note that Grub is generally error-prone especially if you use their "magical" scripts. Unless you really need it, it would be better to use another boot manager such as systemd-boot or refind and learn how to configure it. In case you need Grub, learning to write a grub.cfg by hand is generally better than using their scripts which often cause problems and are virtually impossible to debug.

Last edited by olive (2017-09-18 15:23:27)

Offline

#6 2017-09-18 15:55:26

benjmanable
Member
Registered: 2017-03-12
Posts: 10

Re: GRUB bootproblems after windows hibernate

my partition layout is the following: (parted -> print)

 Model: ...
Disk /dev/sda: 256 GB

...

Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number	Start		End	Size	File system		Name		Flags
1	1049kB		538MB	537MB	fat32			p_boot		boot, esp
2	538MB		22.0GB	21.5GB	ext4			p_root
3	22.0GB		39.2GB	17.2GB	linux-swap(v1)		p_swap
4	39.2GB		180GB	141GB	ext4			p_home
5	180.0GB		256GB	76.1GB	ntfs					msftdata

the content of /boot:

[root@archiso /]# ls /boot
EFI      grub

So there are only two folders in /boot... does that mean that the kernel is missing?

pacman -Qk linux gives:

 root@archiso /]# pacman -Qk linux
warning: linux: /boot/vmlinuz-linux (No such file or directory)
linux: 4869 total files, 1 missing file

I am currently trying to configure grub manually but I am having trouble finding the path to my kernel...
I did initiate it however with the line

# grub-mkconfig -o /boot/grub/grub.cfg

And the file grub.conf is a mess indeed smile

I am open for any solutions, I don't need to use grub...

So the next step would probably be to install systemd-boot?

I thank you very much for your help!

Last edited by benjmanable (2017-09-18 16:03:39)

Offline

#7 2017-09-18 17:07:12

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: GRUB bootproblems after windows hibernate

It sounds like you are not completely familiar with UEFI. If you want to use SystemD, that's fine. But I recommend reading the installation guide and UEFI information in the Wiki. SystemD specific information is here: https://wiki.archlinux.org/index.php/Systemd-boot

Last edited by mrunion (2017-09-18 17:07:29)


Matt

"It is very difficult to educate the educated."

Offline

#8 2017-09-18 17:37:58

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: GRUB bootproblems after windows hibernate

You have to decide where to mount /boot. You can simply have it as a usual folder in your root partition if the bootloader understands the filesystem, ext4 in your case (possible with grub or refind but not with systemd-boot). Another solution is to have /boot mounted at the EFI partition (it is usually fine unless you multiboot several distributions that put conflicting files in it, which does not appear to be your case). In this case, you must have a valid entry for this partition in /etc/ftab. Once you have that setup correctly, the kernel must reside inside /boot as shown by pacman -Ql linux. To install the bootloader, read the appropriate wiki for your bootloader.

Offline

#9 2017-09-18 20:18:01

Blasphemist
Member
From: Colorado
Registered: 2013-01-17
Posts: 160

Re: GRUB bootproblems after windows hibernate

olive wrote:

You have to decide where to mount /boot. You can simply have it as a usual folder in your root partition if the bootloader understands the filesystem, ext4 in your case (possible with grub or refind but not with systemd-boot). Another solution is to have /boot mounted at the EFI partition (it is usually fine unless you multiboot several distributions that put conflicting files in it, which does not appear to be your case). In this case, you must have a valid entry for this partition in /etc/ftab. Once you have that setup correctly, the kernel must reside inside /boot as shown by pacman -Ql linux. To install the bootloader, read the appropriate wiki for your bootloader.

You're right but I think I can clear this up a bit. Unless you have a reason not to, mount the ESP at /boot. Since the kernel files install to /boot this mount point puts them on the ESP. Then UEFI or a boot loader or a boot manager all can access the kernel files without any driver issue. The wiki does explain this but not so clearly.

If you follow the install guide it will have you mount the ESP prior to when genfstab is run to generate the /etc/fstab file. That puts the ESP is fstab. I do think that led to your issue of loosing the kernel files but that also would have happened if the ESP was formatted.

Just for clarity, UEFI looks to it's variables to determine what to hand off boot to. It uses the boot entry that is at the top of the boot order to know what kernel, boot manager or boot loader to launch. Efibootmgr is how you view, edit or create entries in those variables. I launch the kernel directly from UEFI but I have boot entries for boot loaders and managers I can use for testing. If you don't launch the kernel directly, you choose one from the boot loader or manager.

If the kernel is not on the ESP, the boot loader or manager must know where it is and provide a driver for that filesystem to use for access. Grub and rEFInd do provide drivers, others such as bootctl from systemd do not. If you mounted the ESP to /boot/efi the kernel files are on the root partition since the ESP is mounted to a child directory of /boot. The kernel files are always installed and updated in /boot.


Simple and Open

Offline

#10 2017-09-19 05:06:53

benjmanable
Member
Registered: 2017-03-12
Posts: 10

Re: GRUB bootproblems after windows hibernate

Okey, so I actually followed the install-guide, but I didn't try to install the base group by using pacstrap.
So here is what I did:

Because of not being able to boot and being stuck in grub I use a installation image from a USB.
-boot the USB arch ISO
-loadkeys ...

-Mkdir /mnt /mnt/boot /mnt/home
mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
mount /dev/sda4 /mnt/home

My fstab does already exist and did always work, so i didn't touch it except from deleting double entries.
I skipped the step of installing the base group since I thought I would ruin all the configuration I did on my former archlinux...
Maybe I am wrong and the configuration files will remain untouched?

Then I chrooted into /mnt.

So I guess I mounted my ESP just at the right place. I will now try to install the base group with

pacstrap /mnt base

.
I guess the kernel will be installed at the right place then to /boot.

Later on I will follow the further installation instructions.

So I did always think that I would lose what lies in my home directory if I follow the installation again. Is that wrong?

I thank you all for helping, I will keep you up to date what happens.

Offline

#11 2017-09-19 06:59:18

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: GRUB bootproblems after windows hibernate

benjmanable wrote:

Okey, so I actually followed the install-guide, but I didn't try to install the base group by using pacstrap.
So here is what I did:

Because of not being able to boot and being stuck in grub I use a installation image from a USB.
-boot the USB arch ISO
-loadkeys ...

-Mkdir /mnt /mnt/boot /mnt/home
mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
mount /dev/sda4 /mnt/home

OK, /dev/sda2 is your main partition, /dev/sda1 is /boot (is it the EFI partition?) and /dev/sda4 is /home.

benjmanable wrote:

My fstab does already exist and did always work, so i didn't touch it except from deleting double entries.

If you can't boot at all, the fstab can't work. It seems that you are picking old configuration files without checking that they are right. You must have an entry for /dev/sda1 (/boot) in fstab. 

benjmanable wrote:

I skipped the step of installing the base group since I thought I would ruin all the configuration I did on my former archlinux...
Maybe I am wrong and the configuration files will remain untouched?

If you don't install the base group, things can't work. I think that new configuration files will be installed as "*.pacnew". But apparently, you have old files lying around in a messed up installation. That won't work reliably. You can use the Archlinux install CD to repair an old installation (without reinstalling the base group or other packages), but then it is not an installation and the installation wiki is not relevant. It is useful if you make your system unbootable but know what to do to repair it.

benjmanable wrote:

Then I chrooted into /mnt.

So I guess I mounted my ESP just at the right place. I will now try to install the base group with

pacstrap /mnt base

I guess the kernel will be installed at the right place then to /boot.

Later on I will follow the further installation instructions.

So I did always think that I would lose what lies in my home directory if I follow the installation again. Is that wrong?

The home partition will remain untouched. You can even install Archlinux without mounting the /home partition at install time. But you must understand what to do. When it installed, log in as root add an entry for /home in /etc/fstab and mount it, add your username with useradd (without using the -m option since it already exists); check that the newly added user owns the files in /home/youruser (chown them otherwise, you can also use the --uid option of useradd). Do the same with every user you have added to your system.

For the installation, I could suggest you reformat the root partition (back it up on an external disk) and check that you don't have old files lying around in /boot (if it is the EFI partition it is shared by other OS, so don't remove the files from the other OS's. Keeping /home should be OK. Then do a clean install. Doing a new installation over an old messed one will not help. Doing special things with Archlinux is possible but you must understand what you do. Installing Archlinux is just installing packages. The "pacstrap /mnt base" is essentially the same as "pacman --root /mnt -S base". The install scripts take care of a few configuration files but it woud be almost as easy to take care of them by hand.

Last edited by olive (2017-09-19 15:09:41)

Offline

#12 2017-09-19 16:55:22

benjmanable
Member
Registered: 2017-03-12
Posts: 10

Re: GRUB bootproblems after windows hibernate

olive wrote:

or the installation, I could suggest you reformat the root partition (back it up on an external disk) and check that you don't have old files lying around in /boot (if it is the EFI partition it is shared by other OS, so don't remove the files from the other OS's.

I did actually already format the ESP, which is, to answer your question, ...

olive wrote:

/dev/sda1 is /boot (is it the EFI partition?)

... indeed /boot.

In order to get the windows startup files back I did the following:

- Boot the computer using the Windows 7/8/8.1/10 installation media.
- On the first screen, press SHIFT+F10 to bring up the command prompt.
- Run the following commands at the command prompt.

diskpart
list disk
select disk # Note: Select the disk where the EFI system partition is located
list partition
select partition # Note: Select the EFI system partition
assign letter=s
list partition
list volume Note: Note the volume letter where the Windows OS is installed.
exit

bcdboot X:\windows /s S:
Note: Replace "X" with the volume letter of the Windows OS partition.

BCDBoot copies the boot files from the Windows partition to the EFI System partition and creates the BCD store in the same partition.

After that I did restart the computer and windows was working again.

So the EFI system partition is back to its last state again.

Now I did backup my /home and /root folder and tried to do a clean install again.

I connect to the internet with an Ethernet cable, but

pacstrap /mnt base

does not work.

ping www.google.com

fails as well with 100 % loss.
But

ping 8.8.8.8

is successful.

cat /etc/resolv.conf

gives me:

#generated by resolvconf
nameserver 192.168.0.1
nameserver 192.168.0.2
...

I change /etc/resolv.conf to the following:

# OpenNIC IPv4 nameservers (Worldwide Anycast)
nameserver 185.121.177.177
nameserver 185.121.177.53

# OpenDNS IPv6 nameservers
nameserver 2620:0:ccc::2
nameserver 2620:0:ccd::2

Then I also edit /etc/dhcpcd.conf and append

nohook resolv.conf

in order to prevent overwriting of /etc/resolv.conf

In the wiki it says changes made to resolv.conf apply immediately. So I try the two pings again, but the problem persists;

ping www.google.com

fails and

ping 8.8.8.8

is successful.

So I reboot but I am at the same situation again, because resolv.conf somehow gets overwritten.

Something is wrong with my DNS is the logical explanation?

Can you help me? Or do I have to make a new post for this?

Many thanks in advance!

Offline

#13 2017-09-19 17:02:13

dockland
Member
From: Sweden
Registered: 2015-06-06
Posts: 861

Re: GRUB bootproblems after windows hibernate

Have you set your hostname?
Oh, nvmind. It's to early in installation process i recall.

E2: output of

lspci -v

and output of

dmesg | grep yout nic name from previous command

But this is kind of basic, it's in the wiki

Last edited by dockland (2017-09-19 17:05:27)


I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.
I use it to look at funny pictures of cats and to argue with strangers.

Offline

#14 2017-09-19 18:13:36

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: GRUB bootproblems after windows hibernate

Are you speaking about the environment of the boot CD? The boot CD has a dhcp server and it should automatically connect to the internet. If the dns does not work, put "nameserver 8.8.8.8" in /etc/resolv.conf, there is no point to edit the configuration files of the dhcpcd server of the boot CD; they won't be reflected in the installation. For the installed Archlinux, you have to enable a dhcpcd server or configure your network correctly, see the wiki. If you are not sure about ipv6 connectivity, don't put ipv6 addresses in /etc/resolv.conv and possibly disable it by passing ipv6.disable=1 at the kernel command line.

Last edited by olive (2017-09-19 18:18:57)

Offline

#15 2017-09-19 19:47:22

benjmanable
Member
Registered: 2017-03-12
Posts: 10

Re: GRUB bootproblems after windows hibernate

olive wrote:

Are you speaking about the environment of the boot CD? The boot CD has a dhcp server and it should automatically connect to the internet. If the dns does not work, put "nameserver 8.8.8.8" in /etc/resolve.conf, there is no point to edit the configuration files of the dhcpcd server of the boot CD

Yes I am speaking about the environment of the boot CD. It actually does connect to the internet, I think that is proven by a successful

ping 8.8.8.8

I did now change /etc/resolve.conf to:

#resolve.conf
nameserver 8.8.8.8

And I tried

ping www.google.com

But unfortunately without success.

Last edited by benjmanable (2017-09-19 19:48:04)

Offline

#16 2017-09-19 20:32:20

dockland
Member
From: Sweden
Registered: 2015-06-06
Posts: 861

Re: GRUB bootproblems after windows hibernate

I was so wrong leading you to check nic. It obviously work.
Its something with dns i asume.


I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.
I use it to look at funny pictures of cats and to argue with strangers.

Offline

#17 2023-04-09 14:22:30

MateusAquino
Member
Registered: 2023-04-09
Posts: 1

Re: GRUB bootproblems after windows hibernate

Just had the same “error: invalid cluster 0” problem yesterday and here is how I fixed without pacstrap if anyone happens to get into that issue:

1. Booted into live cd or flash usb disk
2. Mounted all partitions (/, /boot and /home) to /mnt
3. Chrooted into mnt:

arch-chroot /mnt /bin/bash

4. Tried to run the same cmd OP did (note mine was linux—lts):

mkinitcpio -p linux-lts

And here is where it fails, the image was found (I could in fact ls them in /boot folder) but it was indeed corrupted (maybe since Windows tried to write something to it?) then set to readonly, this is the error I’ve got:

FAT—fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 0)
FAT—fs (sdb1): Filesystem has been set read-only

5. So I exited chroot, and umounted all disks, and tried to repair this corrupted filesystem by running (note the command below automatically fix errors and might cause data loss to your /boot partition):

dosfsck -w -r -l -a -v -t /dev/sdb1

6. Repeated steps 2 and 3 (mount + chroot)
7. Reinstalled the kernel boot images (since mine was erased, set to zero size bytes after the fsck):

pacman -S linux-lts
mkinicpio —p linux-lts

8. Rebooted and it works now! :)

Last edited by MateusAquino (2023-04-09 14:24:30)

Offline

#18 2023-04-09 15:36:20

jl2
Member
From: 47° 18' N 8° 34' E
Registered: 2022-06-01
Posts: 251
Website

Re: GRUB bootproblems after windows hibernate

just in case you are searching for a reason, from the wiki:

Warning: Data loss can occur if Windows hibernates and you dual boot into another OS and make changes to files on a filesystem (such as NTFS) that can be read and written to by Windows and Linux, and that has been mounted by Windows [3]. Similarly, data loss can occur if Linux hibernates, and you dual boot into another OS etc. Windows may hibernate even when you press shutdown, see section #Windows settings.

For the same reason, if you share one EFI System Partition between Windows and Linux, then the EFI System Partition may be damaged if you hibernate (or shutdown with Fast Startup enabled) Windows and then start Linux, or hibernate Linux and then start Windows.

just in case you have a shared esp:

Disable Fast Startup and enable hibernation:
you must use a separate EFI System Partition (ESP) for Windows and Linux, and ensure that Windows does not mount the ESP used for Linux. As there can only be one ESP per drive, the ESP used for Linux must be located on a separate drive than the ESP used for Windows. In this case Windows and Linux can still be installed on the same drive in different partitions, if you place the ESP used by linux on another drive than the Linux root partition.

https://wiki.archlinux.org/title/Dual_b … ibernation
+ please add [SOLVED] to the title. makes things look cleaned up.

Last edited by jl2 (2023-04-09 16:01:17)


Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...

Offline

#19 2023-04-09 16:51:12

BluishHumility
Member
Registered: 2023-03-31
Posts: 26

Re: GRUB bootproblems after windows hibernate

jl2 wrote:

+ please add [SOLVED] to the title. makes things look cleaned up.

This is not their thread (it appears to be a 5-year necro-bump) so they probably cannot edit the title. It is unclear if the original issue was ever solved.

Offline

#20 2023-04-09 22:12:33

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 4,645

Re: GRUB bootproblems after windows hibernate

As noted, this thread is almost six years old and the OP has not been back since 2017, so I am going to close it now.

MateusAquino, thanks for the contribution, but please note the dates on threads and do not necrobump.

Closing.


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

Board footer

Powered by FluxBB