One of the most common mistakes when using Linux is deleting a seemingly innocent package and accidentally wiping out critical system dependencies along with it. For example, you might think you are just deleting a background package (like ultramarine-backgrounds-compat), only to realize that your SDDM (display manager) providing your graphical interface is gone, and your system drops to a black screen!
If you reinstalled the package using the install command but the system is still broken, don't worry. Thanks to DNF's excellent transaction history feature, we will restore everything to its original state with a single command.
Step 1: Viewing DNF Transaction History
DNF records every installation and removal process you perform. First, we need to find that transaction that broke the system. Type the following command in the terminal:
sudo dnf history list
Important Note: If you are on a distribution using DNF5 (the next-generation DNF), just typing dnf history like in older systems will give a "Missing command" error. You must append list to the end of the command.
Step 2: Finding the ID Number of the Faulty Transaction
In the output list, find the ID number on the far left of the transaction that broke the system (where you deleted the package). If the list is long, you can use this filter to see only the removal transactions:
sudo dnf history list | grep -i -E "remove|erase"
Once you find the transaction in this list, the number at the very beginning is the ID number of that transaction (For example: 70).
Step 3: Undoing the Transaction (The Magic Command)
Now for the most crucial part. We will use the "undo" command to bring back the package and all its deleted dependencies (SDDM, X11 components, etc.) in one go. Run the following command with the ID number you found:
sudo dnf history undo 70
(Don't forget to replace 70 with your own ID number.)
A small detail: If you tried to manually install the same package in the meantime, you might see a warning like "Transaction merge error" in the terminal; this is completely normal. DNF will skip what is already installed and install the missing vital parts. Confirm the transaction (Y) and wait for the installation to finish.
Step 4: Reboot
Once the installation is complete, all you need to do is restart your computer:
reboot
That's it! Your deleted graphical interface and login screen will continue to work right where they left off. Nothing is ever truly lost in Linux, as long as you know how to look at the DNF history!
Linux kullanırken en sık yapılan hatalardan biri, görünüşte masum olan bir paketi silerken onunla birlikte kritik sistem bağımlılıklarının da silinmesidir. Örneğin, sadece bir arka plan paketini (ultramarine-backgrounds-compat vb.) sildiğinizi sanırsınız, ancak bir bakmışsınız grafik arayüzünüzü sağlayan SDDM (giriş ekranı yöneticisi) uçup gitmiş ve sistem siyah ekrana düşmüş!
Eğer paketi tekrar install komutuyla kurduysanız ama sistem hala düzelmediyse endişelenmeyin. DNF'in harika işlem geçmişi özelliği sayesinde her şeyi tek komutla eski haline getireceğiz.
Adım 1: DNF İşlem Geçmişini Görüntüleme
DNF, yaptığınız her kurulum ve silme işlemini kaydeder. Öncelikle sistemi bozan o işlemi bulmamız gerekiyor. Terminale şu komutu yazın:
sudo dnf history list
Önemli Not: Eğer DNF5 (yeni nesil DNF) kullanan bir dağıtımdaysanız, eski sistemlerdeki gibi sadece dnf history yazmak "Missing command" (Eksik komut) hatası verecektir. Komutun sonuna mutlaka list eklemelisiniz.
Adım 2: Hatalı İşlemin ID Numarasını Bulma
Çıktıdaki listede, sistemi bozan (paketi sildiğiniz) işlemin en solundaki ID numarasını bulun. Liste uzunsa sadece silme işlemlerini görmek için şu filtreyi kullanabilirsiniz:
sudo dnf history list | grep -i -E "remove|erase|kaldır|sil"
Bu listede işlemi bulduğunuzda, en baştaki sayı o işlemin ID numarasıdır (Örneğin: 70).
Adım 3: İşlemi Geri Alma (Sihirli Komut)
Şimdi en can alıcı noktaya geldik. Paketi ve silinen tüm eksik bağımlılıkları (SDDM, X11 bileşenleri vb.) tek seferde geri getirmek için "undo" (geri al) komutunu kullanacağız. Bulduğunuz ID numarası ile şu komutu çalıştırın:
sudo dnf history undo 70
(70 yerine kendi bulduğunuz ID numarasını yazmayı unutmayın.)
Küçük bir detay: Eğer arada aynı paketi kendiniz elle kurmaya çalıştıysanız terminalde "Transaction merge error" gibi bir uyarı görebilirsiniz, bu tamamen normaldir. DNF zaten kurulu olanı atlayıp eksik olan hayati parçaları yükleyecektir. İşlemi onaylayın (Y) ve kurulumun bitmesini bekleyin.
Adım 4: Yeniden Başlatma
Kurulum tamamlandıktan sonra tek yapmanız gereken bilgisayarınızı yeniden başlatmak:
reboot
Geçmiş olsun! Silinen grafik arayüzünüz ve giriş ekranınız kaldığı yerden çalışmaya devam edecektir. Linux'ta hiçbir şey gerçekten kaybolmaz, yeter ki DNF geçmişine bakmayı bilin!
No comments