After pacnew overwriting not able to log into user account

Hello,
So I have made a mistake and have overwritten some files with pacnew files. Now I cannot log into the user session. I did some research and encountered other problems with similar origins. They were told to log in per chroot via liveUSB.
Before I try that I wanted to try a simpler solution. How can I log into root? As root user I should be able to change the user name and password, shouldn’t I?
I tried logging into root via tty but there I also need my user logins, which are not working.
So it boils down to:

  1. How can I log in into root despite not being able to log in into user?
  2. Once being root, how can I fix my login problem for user account?

Thank you.

If you have overwritten /etc/passwd and /etc/shadow you have effectively locked yourself out.

If you did what I suspect you did - the only method is by means of a live ISO and chroot.

Before you venture into setting passwd for users you should check if the backup files are still there - which you can then copy over - the backups are name

/etc/passwd-
/etc/shadow-
/etc/group-
/etc/gshadow-

Hi @linux-aarhus , in case of the backups still being there, what would the output look like?

E.g. the ends of the lines of the first command show something like:
bin:x:1:1::/:/sbin/nologin

In fact every line shows /nologin At the end.

Am I able to to change the password through grub menu by mounting?

/etc/passwd- would look like

root:x:0:0::/root:/bin/bash

/etc/shadow- would look like

root:$6$jvows/LzH4dycwMU$Eg.UHdptaGcfoF2iGKHnPTqejG8kZPjQRll63RkRIM5ANDi2LnzpDLR.SEIQ9W5kg/yuE2/7xbZHIdfU4xAc8/:19063::::::

No - you need to restore using the backup files - in a chroot environment.

If you know how to manually locate and mount the root partition, a chrooted environment is not strictly required - but you need booting a live environment - again strictly speaking - Manjaro is not required - any live GNU/Linux will do.

Yes, it does look like this.
How do I proceed from here?

  • Get a liveUSB
  • Mount USB
  • Get into chroot envrionment

Would those be the next steps?

It actually worked. Thank you very much, @linux-aarhus !

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