0

Yes I know I'm an idiot, I just need help

I have a laptop running centOS 8 and I was trying to set another default version of Python. Long story short I used sudo dnf remove python and my laptop immediately crashed and now when I boot it just brings me to a command line. What are the steps I can take to safely recover?

#rpm -q centos-release
>centos-release-8.2-2.2004.0.2.el8.x84_64

Since booting just brings me into a command line now, I ran dnf install python3 hoping to get functionality back but when I restart it continues to boot like this, anything else I can do?

Fool
  • 1
  • 1
  • What exactly do you see on the screen now? – Michael Hampton Oct 02 '20 at 00:43
  • It just boots to a command line that asks me login info, when I enter it I'm just left in CLI and have use the command line. – Fool Oct 02 '20 at 00:52
  • A normal command line? Or something else? – Michael Hampton Oct 02 '20 at 00:56
  • I'm not exactly sure how to answer, immediately after logging in when I run ```# ls > anaconda-ks.cfg initial-setup-ks.cfg ``` I can ```cd /``` and be in the root directory and see ```bin, boot, dev, usr```, etc. I can run commands like yum (even though I don't think it can actually work now?) and others – Fool Oct 02 '20 at 00:59
  • I tried to just dnf install python again to see if it would get everything working but it did not unfortunately. Not sure if that was a dumb move. – Fool Oct 02 '20 at 01:02

1 Answers1

0

You could revert the last transaction with:

dnf history undo last

Since you already ran something else, reverting last won't restore to the desired state. List the last 5 transactions:

dnf history list | head -n5

Then rollback to the one prior to the ID that corresponds to when you mistakenly deleted Python, e.g.:

dnf history rollback 123

The 123 should be a transaction that was before you deleted Python, aka "last good transaction".

Danila Vershinin
  • 5,286
  • 5
  • 17
  • 21