0

I have an ubuntu server (16.04) that I am supposed to deploy a python-flask website to. However I was having some difficulty with the virtual environment, and read here to remove packages manually in the dist-packages folder which was not in my virtual environment.

This resulted in me removing pip and not being able to use it in my virtual environment as well.

So then I read here that I should run the command;

sudo apt-get install ubuntu-desktop^

So I did and its still running 10 minuted later. But am now getting confused, as I have an ubuntu server not ubuntu-desktop, will this restore the appropriate files correctly? If not, should I cancel this command I run, as it is still running now.

Update:

This is my activity log file for today's events. I am not sure what else to remove I have already run apt remove ubuntu-desktop;

Start-Date: 2017-03-28  06:07:33
Commandline: /usr/bin/unattended-upgrade
Install: linux-headers-4.4.0-70-generic:amd64 (4.4.0-70.91, automatic), linux-cloud-tools-4.4.0-70:amd64 (4.4.0-70.91, automatic), linux-cloud-tools-4.4.0-70-generic:amd64 (4.4.0-70.91, automatic), linux-headers-4.4.0-70:amd64 (4.4.0-70.91, automatic), linux-image-4.4.0-70-generic:amd64 (4.4.0-70.91, automatic), linux-image-extra-4.4.0-70-generic:amd64 (4.4.0-70.91, automatic)
Upgrade: linux-headers-generic:amd64 (4.4.0.66.70, 4.4.0.70.76), linux-libc-dev:amd64 (4.4.0-67.88, 4.4.0-70.91), linux-image-generic:amd64 (4.4.0.66.70, 4.4.0.70.76), linux-cloud-tools-common:amd64 (4.4.0-67.88, 4.4.0-70.91), linux-virtual:amd64 (4.4.0.66.70, 4.4.0.70.76), eject:amd64 (2.1.5+deb1+cvs20081104-13.1, 2.1.5+deb1+cvs20081104-13.1ubuntu0.16.04.1), linux-headers-virtual:amd64 (4.4.0.66.70, 4.4.0.70.76), linux-cloud-tools-virtual:amd64 (4.4.0.67.72, 4.4.0.70.76), linux-image-extra-virtual:amd64 (4.4.0.66.70, 4.4.0.70.76), linux-image-virtual:amd64 (4.4.0.66.70, 4.4.0.70.76)
End-Date: 2017-03-28  06:15:21

Start-Date: 2017-03-28  06:15:37
Commandline: /usr/bin/unattended-upgrade
Remove: linux-cloud-tools-4.4.0-67-generic:amd64 (4.4.0-67.88), linux-cloud-tools-4.4.0-67:amd64 (4.4.0-67.88)
End-Date: 2017-03-28  06:15:44

Start-Date: 2017-03-28  10:40:36
Commandline: apt-get install ubuntu-desktop^
Requested-By: Fonzi (1000)
mp252
  • 151
  • 1
    You shouldn't have tried to install ubuntu-desktop and if possible, cancel that install. The point of an Ubuntu Server install is that it runs without a desktop and all the graphic stuff that comes with it. I don't know how accidentally removing pip would be remedied by installing ubuntu-desktop, instead of simply installing pip. – Jos Mar 28 '17 at 11:13
  • @Jos Managed to cut it off while it was still running. Now when I try to run a a sudo apt-get update I get the error; dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. Am I safe to run this command? – mp252 Mar 28 '17 at 11:41
  • It may still try to install ubuntu-desktop. Better do apt remove ubuntu-desktopfirst, then look in /var/log/apt/history.log to see what packages were going to be installed, then apt remove these as well. Then do dpkg --configure -a. – Jos Mar 28 '17 at 11:45
  • @Jos Thanks I just tried that but the same error, about dpkg came up. – mp252 Mar 28 '17 at 11:49
  • At this point, you don't have many more options than running dpkg --configure -a. It's generally safe, though. – Jos Mar 28 '17 at 11:51
  • @Jos dpkg --configure -a worked fine then I run apt remove ubuntu-desktop but now stuck on what to remove. I have listed my log file up above. Is there anything particular I need to remove. – mp252 Mar 28 '17 at 13:00

1 Answers1

0

Manually removing files from places other than your home folder if you are unsure of what you are affecting is not a good starting sign....

First question would be, do you even remember what you removed in the first place ?

Secondly, apt-get install ubuntu-desktop^ indeed should not have been run in the first place... hint was in the name...

Thirdly, "fixing" with removing it will have yielded odd results, not least because you also have removed files manually; but also because when removing with a package manager, it will also try to check for "unused" files... when things are not in the right places, the checks can yield false positives, false negatives; if some files were installed before ubuntu-desktop was installed, but are normally part of ubuntu-desktop, uninstalling ubuntu-desktop might remove those too.

You might again remove way more than you installed. apt install X ; apt remove X is NOT guaranteed to be idempotent.

...

I could go on, but suffice to say that this server is probably not in an operational state, or at least, it won't be for long - routes to resolution:

  • Who provided this server to you? If it was a client, employer, etc ask them. Don't flail alone, you'll only do more damage
  • If the server is a VM or a container itself, can you revert to a snapshot ? Reverting early is preferable to leaving a server in a sorry state, accumulating more operational information... because that's just more data that will be lost on revert
  • Was the server brand new? If so, just ditch the server and start a fresh one.

If there was already important data on the server, find the admin (if not you). They will need to take their backup ASAP and start a fresh server to restore to. Given what you have described above, I would say the server is fubar now.

tk-noodle
  • 788
  • 3
  • 15