You are not logged in.
What I did:
My system has 3 drives, 1st one is an M.2 that has grub on it and arch, the second one is Windows and the 3rd one is just for storage. I had some issues with Arch so I reinstalled it last night, today I wanted to do the usual os-prober followed by grub-mkconfig to get my windows back and running but os-prober doesn't seem to find it. I am running UEFI.
How did I try to resolve the issue:
I used os-prober to try to get Windows as I usually do, I also made sure i have ntfs-3g installed and drives mounted (via thunar's gvfs) but that didn't budge.
lsblk output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
|-sda1 8:1 0 16M 0 part
`-sda2 8:2 0 223.6G 0 part /run/media/username/9A28FCC028FC9D07
sdb 8:16 0 931.5G 0 disk
|-sdb1 8:17 0 16M 0 part
`-sdb2 8:18 0 931.5G 0 part /run/media/username/067600AA76009D15
sr0 11:0 1 1024M 0 rom
nvme0n1 259:0 0 238.5G 0 disk
|-nvme0n1p1 259:1 0 512M 0 part /boot
|-nvme0n1p2 259:2 0 2G 0 part [SWAP]
`-nvme0n1p3 259:3 0 236G 0 part /
My grub.cfg:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 8990e5bd-f33c-45cc-80df-96e0dc3f7537
else
search --no-floppy --fs-uuid --set=root 8990e5bd-f33c-45cc-80df-96e0dc3f7537
fi
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=5
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-8990e5bd-f33c-45cc-80df-96e0dc3f7537' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 6DFC-3A6B
else
search --no-floppy --fs-uuid --set=root 6DFC-3A6B
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=8990e5bd-f33c-45cc-80df-96e0dc3f7537 rw loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-8990e5bd-f33c-45cc-80df-96e0dc3f7537' {
menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-8990e5bd-f33c-45cc-80df-96e0dc3f7537' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 6DFC-3A6B
else
search --no-floppy --fs-uuid --set=root 6DFC-3A6B
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=8990e5bd-f33c-45cc-80df-96e0dc3f7537 rw loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux.img
}
menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-8990e5bd-f33c-45cc-80df-96e0dc3f7537' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 6DFC-3A6B
else
search --no-floppy --fs-uuid --set=root 6DFC-3A6B
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=8990e5bd-f33c-45cc-80df-96e0dc3f7537 rw loglevel=3 quiet
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux-fallback.img
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
Now I am unsure what grub exactly does when it installs itself but last time I had a similar issue my Windows Boot Manager somehow found itself on my M.2 (where I keep grub and arch).
EDIT: I am also event less sure if allowing windows to fix itself via the installation medium will brick grub so I'm still holding my fire on that one.
Last edited by DigitalCyan (2021-01-17 23:25:26)
Offline
Are you sure that Windows's NTFS partition was clearly unmounted (not hibernated, which is often even if you "Power Off" windows)? Usually you will get information about it when you try to mount NTFS partition.
If yes, try to mount with hibernation file removal (as root):
mount -t ntfs-3g -o remove_hiberfile /dev/<NTFS> <MOUNTPOINT>
and try again.
Offline
Alright so ive tried what you said and this is what I've got.
sudo mount -t ntfs-3g -o remove_hiberfile /dev/sda1 /mnt/win
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
So after being questioned about my partition choices, i did:
sudo mount -t ntfs-3g -o remove_hiberfile /dev/sda /mnt/win
NTFS signature is missing.
Failed to mount '/dev/sda': Invalid argument
The device '/dev/sda' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
EDIT:
Also I made sure the drive didnt actually get mounted
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
|-sda1 8:1 0 16M 0 part
`-sda2 8:2 0 223.6G 0 part
sdb 8:16 0 931.5G 0 disk
|-sdb1 8:17 0 16M 0 part
`-sdb2 8:18 0 931.5G 0 part
sr0 11:0 1 1024M 0 rom
nvme0n1 259:0 0 238.5G 0 disk
|-nvme0n1p1 259:1 0 512M 0 part /boot
|-nvme0n1p2 259:2 0 2G 0 part [SWAP]
`-nvme0n1p3 259:3 0 236G 0 part /
Also, quick note, using Thunar I was able to browse my NTFS filesystems.
Last edited by DigitalCyan (2021-01-13 13:13:21)
Offline
lsblk -f
The windows bootloader might be on one of the 16M partitions.
Offline
Perhaps... here's lsblk -f:
lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
|-sda1
`-sda2 ntfs 9A28FCC028FC9D07
sdb
|-sdb1
`-sdb2 ntfs 067600AA76009D15
sr0
nvme0n1
|-nvme0n1p1 vfat FAT32 6DFC-3A6B 454.1M 11% /boot
|-nvme0n1p2 swap 1 9f3bd583-66a4-4a93-9023-0250d5ab5db6 [SWAP]
`-nvme0n1p3 ext4 1.0 8990e5bd-f33c-45cc-80df-96e0dc3f7537 210.8G 4% /
Offline
The tow ntfs partitions are sda2 and sdb2, god knows what those 16MB partitions are.
Mount them and check whether either contains an "EFI" directory
Offline
The tow ntfs partitions are sda2 and sdb2, god knows what those 16MB partitions are.
Mount them and check whether either contains an "EFI" directory
16MB partitions are 'Microsoft reserved partitions' without any filesystem.
Windows need them for some raw disk operations.
In Linux they should be ignored (not mounted/used)
Offline
Ok so I mounted both partitions like this and checked their contents
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
|-sda1
|
`-sda2
ntfs 9A28FCC028FC9D07 112G 50% /mnt/win/a
sdb
|-sdb1
|
`-sdb2
ntfs 067600AA76009D15 751.3G 19% /mnt/win/b
sr0
nvme0n1
|
|-nvme0n1p1
| vfat FAT32 6DFC-3A6B 454.1M 11% /boot
|-nvme0n1p2
| swap 1 9f3bd583-66a4-4a93-9023-0250d5ab5db6 [SWAP]
`-nvme0n1p3
ext4 1.0 8990e5bd-f33c-45cc-80df-96e0dc3f7537 208.2G 5% /
sda2 is my used-to-be C:\ with your classic Windows layout, It does have some folders I didn't notice before tho such as bootmgr, BOOTNXT, swapfile.sys, hiberfil.sys and pagefile.sys.
sdb2 is just my 1TB main storage, nothing out of order there.
Offline
How did you reinstall arch?
Did you reformat efi partition (nvme0n1p1) accidentally?
Check if your /boot folder contains Windows boot files.
my Windows Boot Manager somehow found itself on my M.2 (where I keep grub and arch).
That is correct. EFI partition must contain boot files for both arch and windows.
If windows files are missing, you should repair windows boot, this will break grub and then repair arch boot.
Last edited by GeorgeJP (2021-01-14 00:35:42)
Offline
How did you reinstall arch?
Did you reformat efi partition (nvme0n1p1) accidentally?
Check if your /boot folder contains Windows boot files.DigitalCyan wrote:my Windows Boot Manager somehow found itself on my M.2 (where I keep grub and arch).
That is correct. EFI partition must contain boot files for both arch and windows.
If windows files are missing, you should repair windows boot, this will break grub and then repair arch boot.
That probably is what happened.
So I first installed Arch, then Win, then Arch. So if i get it right. My windows bootloader got moved from my sda1 to nvme0n1p1 since i installed grub over to the grub's partition, correct?
So by fixing windows via repair tool I am bound to break grub.
Offline
So I first installed Arch, then Win, then Arch. So if i get it right. My windows bootloader got moved from my sda1 to nvme0n1p1 since i installed grub over to the grub's partition, correct?
Installing grub would not move any files belonging to a different OS from one filesystem to another.
Offline
So I first installed Arch, then Win, then Arch. So if i get it right. My windows bootloader got moved from my sda1 to nvme0n1p1 since i installed grub over to the grub's partition, correct
Not correct.
If you first installed Arch, then during this installation EFI partition was created.
When you install Windows, it install his boot files also to this EFI partition.
If you reinstall Arch, you should not touch windows files on EFI partition.
So by fixing windows via repair tool I am bound to break grub.
Yes, Windows is not friendly to other OS and expects to be alone in PC.
https://wiki.archlinux.org/index.php/Du … th_Windows
Offline
Thanks for the info, but before I mark the thread solved, something is still grinding my gears...
When you install Windows, it install his boot files also to this EFI partition.
In my specific case I installed Arch on drive no. 1, then installed Win on drive no. 2. Why would windows overwrite a partition that is on an another drive?
Can't there be multiple EFI partitions? Shouldn't installing each OS on it's own drive give it it's own environment to work with?
Offline
There can be multiple ESP's. The firmware does not treat them as separate and may not even properly support such a configuration.
Why would WIndows need to overwrite the existing ESP it located to add its own files and set itself as the default entry?
Offline
There can be multiple ESP's. The firmware does not treat them as separate and may not even properly support such a configuration.
Why would WIndows need to overwrite the existing ESP it located to add its own files and set itself as the default entry?
See that is the part I do not get.
I install Arch and theres an ESP partition on /nvme0n1p1
I install Windows and an ESP partition gets created on /sda1
I add Windows to grub (by using os-prober and grub-mkconfig)
I reinstall Arch again on the same drive and I make the ESP sit under /nvme0n1p1
I loose access to Windows
Last time I had the same issue I saw that Windows Boot Manager was sitting on /nvme0n1p1 for some reason.
I doubt it's a mistake cause everything else windows related like program files and stuff was on /sda2 (implying that /sda1 is the small managment partition created by Win we discussed earlier)
I don't get it, but no matter, will probably reinstall Win from scratch tommorow and add it to grub again, I will post my findings here so I'll keep the thread open for a little longer for the sake of documenting this issue.
Offline
Please post the output of `parted -l`
Edit:
I install Arch and theres an ESP partition on /nvme0n1p1
I install Windows and an ESP partition gets created on /sda1
I believe you are mistaken here. 16M matches the size used for the Microsoft Reserved Partition. From Microsoft's own documentation the minimum size Windows requires for an ESP is 100M [1] and to accommodate 4KN drives defaults to 260M.
I add Windows to grub (by using os-prober and grub-mkconfig)
I reinstall Arch again on the same drive and I make the ESP sit under /nvme0n1p1
I loose access to Windows
If you formatted the ESP that Windows was sharing with Arch removing Windows boot mechanism that would explain loss of access to Windows.
[1] https://docs.microsoft.com/en-us/window … partitions
Last edited by loqs (2021-01-14 05:59:39)
Offline
There can be multiple ESP's. The firmware does not treat them as separate and may not even properly support such a configuration.
Why would WIndows need to overwrite the existing ESP it located to add its own files and set itself as the default entry?
Usually there can be one ESP per drive.
Windows just adds his files to ESP and set itself as default in UEFI NVRAM.
OP have 3 disks, only nvme is bootable (have ESP partition), used by both OS.
|-nvme0n1p1
| vfat FAT32 6DFC-3A6B 454.1M 11% /boot
Ocuppied size 11% of 454MB leds me to assumption, that during second Arch install this partition was formatted and win boot entries wiped and only grub is present.
I install Arch and theres an ESP partition on /nvme0n1p1
I install Windows and an ESP partition gets created on /sda1
Windows installation was not creating ESP on /sda1. ESP created by Arch on /nvme0n1p1 was used.
Offline
OP have 3 disks, only nvme is bootable (have ESP partition), used by both OS.
Yes but there should be 2 bootable disks if i installed Arch on one disk and Windows on the other.
Please post the output of `parted -l`
Here you go bud.
Model: ATA WDC WDS240G2G0A- (scsi)
Disk /dev/sda: 240GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 17.8MB 16.8MB Microsoft reserved partition msftres
2 17.8MB 240GB 240GB ntfs Basic data partition msftdata
Model: ATA ST1000DM003-1ER1 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 17.8MB 16.8MB Microsoft reserved partition msftres
2 17.8MB 1000GB 1000GB ntfs Basic data partition msftdata
Model: ADATA SX8200PNP (nvme)
Disk /dev/nvme0n1: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 538MB 537MB fat32 boot, esp
2 538MB 2685MB 2147MB linux-swap(v1) swap
3 2685MB 256GB 253GB ext4
Offline
1 1049kB 538MB 537MB fat32 boot, esp
The only ESP in the output. DigitalCyan please read my edit to post 16. You continue to contend Windows created an ESP on sda without explaining how you determined that or providing an explanation for why it is no longer present.
Offline
Yes but there should be 2 bootable disks if i installed Arch on one disk and Windows on the other.
NO. There is only one ESP. Only one boot disk.
Please post output
tree /boot
To be able boot window you should have something similiar available on ESP partition (shortened)
/boot
├── EFI
│ ├── Microsoft
│ │ ├── Boot
│ │ │ ├── BCD
│ │ │ ├── BCD.LOG
│ │ │ ├── BCD.LOG1
│ │ │ ├── BCD.LOG2
│ │ │ ├── bootmgfw.efi
│ │ │ ├── bootmgr.efi
│ │ │ ├── BOOTSTAT.DAT
│ │ │ ├── boot.stl
│ │ │ ├── en-US
│ │ │ │ ├── bootmgfw.efi.mui
│ │ │ │ ├── bootmgr.efi.mui
│ │ │ │ └── memtest.efi.mui
│ │ │ ├── Fonts
│ │ │ │ ├── chs_boot.ttf
│ │ │ │ ├── cht_boot.ttf
│ │ │ │ ├── jpn_boot.ttf
│ │ │ │ ├── kor_boot.ttf
│ │ │ │ ├── malgun_boot.ttf
│ │ │ │ ├── malgunn_boot.ttf
│ │ │ │ ├── meiryo_boot.ttf
│ │ │ │ ├── meiryon_boot.ttf
│ │ │ │ ├── msjh_boot.ttf
│ │ │ │ ├── msjhn_boot.ttf
│ │ │ │ ├── msyh_boot.ttf
│ │ │ │ ├── msyhn_boot.ttf
│ │ │ │ ├── segmono_boot.ttf
│ │ │ │ ├── segoen_slboot.ttf
│ │ │ │ ├── segoe_slboot.ttf
│ │ │ │ └── wgl4_boot.ttf
│ │ │ ├── kdstub.dll
│ │ │ ├── kd_0C_8086.dll
│ │ │ ├── kd_02_1af4.dll
│ │ │ ├── kd_02_10df.dll
│ │ │ ├── kd_02_10ec.dll
│ │ │ ├── kd_02_1137.dll
│ │ │ ├── kd_02_14e4.dll
│ │ │ ├── kd_02_15b3.dll
│ │ │ ├── kd_02_19a2.dll
│ │ │ ├── kd_02_1969.dll
│ │ │ ├── kd_02_8086.dll
│ │ │ ├── kd_07_1415.dll
│ │ │ ├── memtest.efi
│ │ │ ├── qps-ploc
│ │ │ │ └── memtest.efi.mui
│ │ │ ├── Resources
│ │ │ │ ├── bootres.dll
│ │ │ │ └── en-US
│ │ │ │ └── bootres.dll.mui
│ │ │ ├── updaterevokesipolicy.p7b
│ │ │ ├── winsipolicy.p7b
│ │ └── Recovery
│ │ ├── BCD
│ │ ├── BCD.LOG
│ │ ├── BCD.LOG1
│ │ └── BCD.LOG2
If you don't have such files, os-probe can't add them to Grub boot menu and start Windows.
To your partitions on sda and sdb you can look as / (root) or /home in linux analog. They are mounted after succesfull OS boot from ESP partition.
Offline
1 1049kB 538MB 537MB fat32 boot, esp
The only ESP in the output. DigitalCyan please read my edit to post 16. You continue to contend Windows created an ESP on sda without explaining how you determined that or providing an explanation for why it is no longer present.
Yes, excuse my negligence. You are right. Just installed Win and it did target a pre-existing ESP.
To be able boot window you should have something similiar available on ESP partition (shortened)
You are right too.
lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
|-sda1
`-sda2 ntfs 82AA8F26AA8F15B7
sdb
|-sdb1
`-sdb2 ntfs 5E7486687486432F
sdc
|-sdc1 ntfs Windows USB 317048B975B5977A
`-sdc2 vfat FAT12 UEFI_NTFS 1DB0-EF13
sr0
nvme0n1
|-nvme0n1p1 vfat FAT32 6DFC-3A6B 427.4M 16% /boot
|-nvme0n1p2 swap 1 9f3bd583-66a4-4a93-9023-0250d5ab5db6 [SWAP]
`-nvme0n1p3 ext4 1.0 8990e5bd-f33c-45cc-80df-96e0dc3f7537 197G 10% /
ls /boot/EFI
Boot GRUB Microsoft
So if i wish to preserve the Win's boot files next time I happen to reinstall Arch, should I just move the Microsoft file over to my bootable device, install the OS and put it back? Would that work?
Offline
You do not need to move any files belonging to Windows. They were removed because you formatted the ESP on the second installation of Arch. Just omit formatting the ESP that is already in use.
If installing Windows overwrites the bootloader you setup using Arch reinstall that bootloader.
Offline
You do not need to move any files belonging to Windows. They were removed because you formatted the ESP on the second installation of Arch. Just omit formatting the ESP that is already in use.
If installing Windows overwrites the bootloader you setup using Arch reinstall that bootloader.
Actually a good point, thanks a bunch guys and thank you for your patience. Do I mark the thread solved now or by just changing the title to include [SOLVED]? I am really green when it comes to forums, this is was my first post.
Offline
Do I mark the thread solved now or by just changing the title to include [SOLVED]? I am really green when it comes to forums, this is was my first post.
Edit your first post and add [SOLVED] to the title. Please read "How to Post" linked in my signature.
How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.
Offline