Trouble identifying EFI partition to do timeshift restore

Hello all.

So after last update I also wanted to manage .pacnew. However, I did not fully know what I was doing and continued anyways to replace files. This resulted in me not being able to log in after reboot (my password and fingerprint simply stopped working).

Now I do not know anymore which files I changed. But I do have timeshift backups!

I am already booted into a live USB and have my external timeshift drive connected and recognised.

My system is dual boot using grub. I have 7 partitions on my internal drive, one of which contains my manjaro system (nvme0n1p7).
The output of fdisk -l is

Disk /dev/nvme0n1: 953,87 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: WDC PC SN730 SDBQNTY-1T00-1001          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 43F627DE-5AE9-42CB-B72E-32D522CCF294

Device              Start        End   Sectors   Size Type
/dev/nvme0n1p1       2048     534527    532480   260M EFI System
/dev/nvme0n1p2     534528     567295     32768    16M Microsoft reserved
/dev/nvme0n1p3     567296  974360575 973793280 464,3G Microsoft basic data
/dev/nvme0n1p4 1998360576 2000408575   2048000  1000M Windows recovery environme
/dev/nvme0n1p5  974360576  975409151   1048576   512M Microsoft basic data
/dev/nvme0n1p6  975409152 1016369151  40960000  19,5G Linux swap
/dev/nvme0n1p7 1016369152 1998360575 981991424 468,3G Linux filesystem

Partition table entries are not in disk order.

NOW MY QUESTION:
Timeshift automatically selects nvme0n1p5 as /boot/efi partition. However I would think that nvme0n1p1, labelled as EFI SYSTEM by fdisk should be selected as /boot/efi inltimeshift. Which one is correct?

I have no experience with EFI stuff, but i can recommend to use the Timeshift GUI and not the CLI mode for a restore. The GUI gives side by side a compare Window, which partitions it wants to overwrite… it should be pretty clear after that.

I hope you have a fresh snapshot and don’t restore a old snapshot… otherwise you could face even more issues.

If you have created a fresh snapshot right before you playing around with this pacnew files, then everything should be fine.

You have 2 options, restore your snapshot (recommend to use GUI) or just open dolphin and click on “modified” to list the last modified files first, at /etc/

You may can open Dolphin to get a overview and copy+paste manually the old unmerged files (Timeshift backup files), to get it working again.

This sounds to me like this file:

/etc/passwd

Check for recently modification and maybe replace it.
This pacnew file showed up in February this year.

Edit:
If im right and it is this file and you want still assist or need more infos to Merge this file.

Look at the comments in the annoucement Topic from February:

or this here:

Please do not use images, when showing text !


LANG=en;sudo fdisk -l /dev/sd?

Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: SanDisk SDSSDH31
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 

Device          Start        End    Sectors  Size Type
/dev/sda1        2048    1953791    1951744  953M EFI System
/dev/sda2     1953792 1889390591 1887436800  900G Linux filesystem
/dev/sda3  1894531072 1953523711   58992640 28.1G Linux swap

Here the first partition is the EFI

Disk /dev/sdb: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: ADATA SP610     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 

Device       Start        End   Sectors   Size Type
/dev/sdb1     2048    1050623   1048576   512M EFI System
/dev/sdb2  1050624 1000214527 999163904 476.4G Linux filesystem

Also the first partition

Disk /dev/sdc: 4.55 TiB, 5000981077504 bytes, 9767541167 sectors
Disk model: Expansion HDD   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 

Device          Start        End    Sectors   Size Type
/dev/sdc1        2048    2099199    2097152     1G Microsoft basic data
/dev/sdc2     2099200   23070719   20971520    10G Linux filesystem
/dev/sdc3    23070720 6314524671 6291453952   2.9T Linux filesystem
/dev/sdc6  6314526720 8411678719 2097152000  1000G Linux filesystem
/dev/sdc7  8411678720 9767540735 1355862016 646.5G Linux filesystem

This disk has no EFI-Partition

You could try:

lsblk -o KNAME,PTTYPE,TYPE,FSTYPE,SIZE,PARTTYPENAME,PARTLABEL,label 
KNAME     PTTYPE TYPE FSTYPE   SIZE PARTTYPENAME         PARTLABEL      LABEL
sda       gpt    disk        931.5G                                     
sda1      gpt    part vfat     953M EFI System                          
sda2      gpt    part btrfs    900G Linux filesystem                    
sda3      gpt    part swap    28.1G Linux swap                          
sdb       gpt    disk        476.9G                                     
sdb1      gpt    part vfat     512M EFI System           efi            EFI
sdb2      gpt    part        476.4G Linux filesystem     manjaro        
sdc       gpt    disk          4.5T                                     
sdc1      gpt    part exfat      1G Microsoft basic data efi            
sdc2      gpt    part           10G Linux filesystem     OutOfSpace     
sdc3      gpt    part btrfs    2.9T Linux filesystem     1              1
sdc6      gpt    part btrfs   1000G Linux filesystem     4              4
sdc7      gpt    part btrfs  646.5G Linux filesystem     5              5
sr0              rom          1024M                                     
nvme0n1   gpt    disk          1.9T                                     
nvme0n1p1 gpt    part vfat       1G EFI System                          
nvme0n1p2 gpt    part            1M BIOS boot            grub2 core.img 
nvme0n1p3 gpt    part btrfs    900G Linux filesystem     manjaro21      
nvme0n1p4 gpt    part btrfs  942.7G Linux filesystem     backup         
nvme0n1p5 gpt    part swap      64G Linux swap           swap           swap2

EFI needs to be vfat
:footprints:

I suspect this as well.

Going by your description of how you got yourself in this situation,
you can likely get by without needing to timeshift.

There is a good chance to remedy the situation - but you probably need to boot from USB
to have access to the file system without needing the system to be up.

  • sudo mount /dev/sdXy /mnt
    mount the / partition to /mnt
    (or simply use your file manager - but then the PATH in the following commands is different)
  • sudo cp /mnt/etc/passwd /mnt/etc/passwd.backup
    create a backup of your current passwd file
  • sudo cp /mnt/etc/passwd- /mnt/etc/passwd
    copy the backup of the passwd file (denoted by the - at the end) over the one that you now have -
    which is no longer working - because it is the default file (the .pacnew file) without any of your changes

If that was the source of your current problem, these three commands should get you back up and running - reboot and see …

If that wasn’t the source of the problem, then you haven’t made anything worse than it already was - you have the backup file and can revert.

The ESP is p1 indeed and NOT p5

He can also open Timeshift GUI from Live Boot and click on Browse, then Dolphin opens with root rights, from there he can easy copy+paste this file from his snapshot to his destination.

This as well - just pull the one file you need out of the timeshift backup.
I never used timeshift and couldn’t recommend it because I do not know it.

replacing the defunct /etc/passwd with it’s always present /etc/passwd- backup copy is a lightweight timeshift as well :nerd_face:

Thank you! That was a very simple and effective idea!
I had indeed changed /etc/passwd, /etc/shadow and /etc/shells.
The root of my issue turned out to be the missing paths for zsh in /etc/shells. This meant that zsh was not recognized as a valid login shell (if I understand correctly).

My /etc/shells file looks now like this:

# Pathnames of valid login shells.
# See shells(5) for details.

/bin/sh
/bin/bash
/bin/rbash
/bin/zsh
/usr/bin/sh
/usr/bin/bash
/usr/bin/rbash
/usr/bin/zsh

/usr/bin/git-shell

/usr/bin/systemd-home-fallback-shell

I shall mark this post as the solution, however note that it is based on @Kobold’s 1st answer.

Further, thank you @anon33601770 for the details on how to recover the files in question:

A further useful addition by @Kobold :

And lastly thank you @Teo for the very concise and direct anwer :wink:

I am sorry, I was posting from my phone. I have now replaced the photo with text :slight_smile:

From the rest of your answer I take it that in my case, timeshift did indeed identify the wrong partition as the EFI partition?