Reinstalling EOS: get package list without access to pacman

Long story short: On a dual boot system Windows messed up my EndeavourOS drive’s partition table, so I have no GRUB and no way to boot Arch. I’m still able to mount from a bootable USB so I’m doing a /home backup to reformat the drive and reinstall EndeavourOS. I guess I can still chroot but I’m waiting for the backup to finish.

Is there a way I can get a list of my installed packages without access to pacman for when I do a fresh install?

Also kind of offtopic: Any suggestions backup-wise? Should I copy anything else from the partition other than /home?

Edit 1: Forgot to mention, the same thing for AUR packages installed through yay, if possible?

Edit 2: Since some of you suggested fixing GRUB before reinstalling, I think I will try to pick the correct partition table first after I backup everything, then try to reinstall GRUB and hope for the best. I’ll leave my gdisk outputs below in case somebody knows what’s wrong. Thank you all for the help either way :slight_smile:

gdisk output:

[liveuser@eos-2023.03.26 ~]$ sudo gdisk /dev/nvme0n1
GPT fdisk (gdisk) version 1.0.9.1

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: present

Found valid MBR and GPT. Which do you want to use?
 1 - MBR
 2 - GPT
 3 - Create blank GPT

When I select MBR:

Disk /dev/nvme0n1: 1953525168 sectors, 931.5 GiB
Model: Samsung SSD 970 EVO Plus 1TB            
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 1A0E603E-51F0-4487-B502-11E625DF814E
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 211840366 sectors (101.0 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1      1426096128      1427144703   512.0 MiB   0700  Microsoft basic data
   2      1427144704      1741717503   150.0 GiB   0700  Microsoft basic data
   5           32768      1426096126   680.0 GiB   0700  Microsoft basic data

When I select GPT:

Disk /dev/nvme0n1: 1953525168 sectors, 931.5 GiB
Model: Samsung SSD 970 EVO Plus 1TB            
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): A9089CC8-91CB-4A00-AB2F-F39D643718A8
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 8-sector boundaries
Total free space is 211807631 sectors (101.0 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              34            2081   1024.0 KiB  4201  LDM metadata partition
   2            2082           32767   15.0 MiB    0C01  Microsoft reserved ...
   3           32768      1426096127   680.0 GiB   4200  LDM data partition
   4      1426096128      1427144703   512.0 MiB   EF02  
   5      1427144704      1741717503   150.0 GiB   8300  

In GPT, the “LDM (meta)data partition” is the same as when Windows changed the drive to dynamic, so I’ll probably keep the MBR partition and reinstall GRUB through arch-chroot.

Why not just reinstall grub?

Also yes, you can chroot in and see everything you have.

2 Likes

For that matter, while arch-chrooted in, you can have pacman create a list of installed packages that it can use for reinstalling them all. If needed - it should be fixable in one of several ways (mostly documented on our Wiki (see top line of the forum display).

1 Like
  1. There is no need to reinstall EndeavourOS in order to fix this. Just chroot and fix GRUB.
  2. If you are making a backup of your /home directory simply by copying its contents under windoze to an NTFS drive, you’re going to have all your permissions messed up. I hope you’re not doing that, because there is no easy way to fix that.
1 Like
  1. The problem is a little more complicated, Windows changed the drive to dynamic drive and rolling it back ended up with two partition tables for the same drive (one MBR, the other GPT) and I have found no easy way to fix that. I think the BIOS is having trouble booting to that drive because of that conflict so it ends up not finding GRUB, so I’m not sure reinstalling GRUB will fix that issue.

  2. Like a dumbass I was doing exactly that, how would you suggest I back it up then? rsync or some wrapper of it to an external drive?

For clarification, I still intended to try to save the drive before formatting, I’m just backing up in case I mess something up or don’t find a solution. But I feel pretty hopeless about fixing it at this point.

Well I just checked the Wiki as suggested by @freebird54 and I seem to need an external device with ext4 format if I want to keep my permissions from the original filesystem, so I guess that answers the second point. Still no idea how I’ll fix the original problem (1.), but I understand if this is not the place for that type of question.

Well, I’ll leave this as a final solution for anybody that runs through this particular, personal hell.

Indeed, when reverting back from Windows’ dynamic drive, two partition tables were left conflicting (an MBR with the correct distribution, and the old GPT one with the dynamic distribution). I was scared about the MBR partition since it only had “Windows basic data”, but apparently that code and name only affect whether a partition is visible from Windows or not.

The thing that did it for me then was zapping (lowercase!) the GPT table using:

sudo gdisk /dev/path/to/drive
x
z   # (in lowercase! since uppercase Z will nuke both tables.)
destroy gpt partition? y
wipe mbr partition? n

Then, as suggested by everybody here, and per the wiki: https://discovery.endeavouros.com/system-rescue/repair-a-non-booting-grub/2021/03/ (thx @freebird54) carefully mounting my system, the EFI partition, arch-chroot into my OS and repairing (reinstalling) GRUB.

And after rebooting I can happily say I have everything back in order! :smiley:

If anybody ends up here with a similar problem, BE CAREFUL when doing anything with your partitions (both on Windows and when using fdisk, gdisk, sgdisk, etc.) and always backup your data, what worked for me may not necessarily work for you. I was, several times, a few keys away from doing the completely wrong thing and messing up my data for good because other posts looked very similar to my problem.

Thank you to everybody in this post for the help!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.