I was using fedora 28 with cinnamon desktop environment. It also had gnome desktop environment.

I ran a command something along the lines of sudo dnf remove gnome* which remove everything there was along with the terminal as the default was gnome-terminal.

Now I can see an empty grey screen because I had auto-login enabled. I had only user account on the system.

How can I restore the removed packages and get the system back without losing the data?

2 Answers 2


The "empty grey screen" is probably the default background of an empty X11 server without a desktop environment running.

Press Ctrl+Alt+F1 to switch to a text-based login prompt. Log in, enter cd /var/log to move into /var/log directory, and then enter less dnf.log. If it does not allow you to read the file, use sudo less dnf.log instead.

Hopefully, the tail end of this log file will list the names of all the packages you mistakenly removed. Make a note of all of them: the list may include some packages that are not named like "gnome*", as they might have been removed because they depend on one or more of the "gnome*" packages.

Use commands like sudo dnf install <package name> <package name> <package name...> to re-install the removed packages. Once all the mistakenly removed packages have been re-installed, reboot the system with sudo shutdown -r now. After the reboot, if you managed to reinstall all the packages you removed, the system should be as it was before the mistake.

Unless you stored your data files somewhere you shouldn't, removing any packages should always leave user files and configuration files in place. Reinstalling the same packages should automatically use any existing configuration files for them, if available.

  • i can open terminal using fedora rescue but installing cinnamon or any desktop environment from there gives me an error which says 'can't connect to fedora repo' or something similar
    – Doc
    Commented Sep 22, 2018 at 22:11
  • i have fedora 28 iso file. will it be any useful?
    – Doc
    Commented Sep 22, 2018 at 22:13
  • Doc this isn't Rescue mode. Start your machine normally and then follow the instructions in this answer. Commented Sep 22, 2018 at 22:16
  • I have reinstalled all the packages but still i have the grey screen
    – Doc
    Commented Sep 22, 2018 at 23:25
  • i am getting a backup of data and will format the drive. Any other folder that may contain important data other than /home/droid/ which I need to backup?
    – Doc
    Commented Sep 23, 2018 at 0:35

dnf has a transaction history and rollback routines to revert to and/or undo operations.

Issue sudo dnf history to get a list of transactions, find the transaction that borked the system, then issue either sudo dnf history undo <BorkingTransactionNumber> or sudo dnf history rollback <BorkingTransactionNumber - 1> where <BorkingTransactionNumber> is the number of the transaction that broke your system.

See man dnf for more information on the history function and other options.

  • i tried reinstalling all the packages as described by @telcoM which didn't work out well. Now I have another problem askubuntu.com/questions/1078691/… to solve.
    – Doc
    Commented Sep 26, 2018 at 18:49
  • @Miorin I agree with Miorin's appraisal of how dnf is supposed to work. I personally use Fedora 29, with Cinnamon manually dnf-installed on top. However, I do not think that it is reasonable to expect the Fedora (volunteer) developers to anticipate problems with such a Fedora-Cinnamon interaction. Nor do I think that it is reasonable to expect the Cinnamon (volunteer) developers to anticipate such problems. Therefore, I always have to be ready, at any time, to re-install everything. Commented Jan 1, 2019 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .