26

I just removed a package from my ubuntu 16.04 system. After removing the package, the terminal shows some warnings like this:

Removing gitlab-ce (8.10.4-ce.0) ...
Purging configuration files for gitlab-ce (8.10.4-ce.0)... 
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/sv' not empty so not removed 
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/etc' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/service' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/embedded/cookbooks' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/embedded/ssl/certs' not empty so not removed 
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/embedded/service/gitlab-rails/public' not empty so not emoved 
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/embedded/service/gitlab-rails/config/initializers' not empty so not removed 
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/embedded/service/gitlab-shell' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/init' not empty so not removed 

It says that /opt/gitlab/ directory is not empty, so it cannot remove those from the system.

Should I delete these directory manually or not?

  • 2
    You could try renaming it and see if anything bad happens. – edwinksl Sep 14 '16 at 6:45
  • 1
    Which gitlab package you installed and removed? – Anwar Sep 14 '16 at 6:50
  • It was gitlab-ce (community edition), as you can see in the image provided (second line). – vivek Sep 14 '16 at 6:54
  • 5
    Small thing, but important thing for the life and searchability of this question: Please do not post screenshots of text that can just easily be cut and pasted as code into the question itself. Actual text can be searched and indexed which makes it easier for people with similar problems to find this question and related answers. A screenshot is a screenshot: It’s just a non-searchable picture. – Giacomo1968 Sep 14 '16 at 11:16
52

That directory is populated with gitlab-ce reconfigure command after installation and holds variable data, configurations related to gitlab-ce package.

The recommended process to uninstall it was

  1. Remove services

     sudo gitlab-ctl uninstall
    
  2. Clean any data generated by usage of the package

     sudo gitlab-ctl cleanse
    
  3. You may also want to remove any accounts you configured. To do so

     sudo gitlab-ctl remove-accounts
    
  4. Then remove the package using

     sudo dpkg -P gitlab-ce
    

Furthermore, gitlab-ce uses these directories (as described here)

  • /opt/gitlab holds application code for GitLab and its dependencies.
  • /var/opt/gitlab holds application data and configuration files that gitlab-ctl reconfigure writes to.
  • /etc/gitlab holds configuration files for omnibus-gitlab. These are the only files that you should ever have to edit manually.
  • /var/log/gitlab contains all log data generated by components of omnibus-gitlab.

So, First remove the package recommended way (Even if you need to reinstall it). You can then remove those data using rm safely.

Information found from omnibus-gitlab README page

| improve this answer | |
  • 2
    This is working even in latest version of Gitlab 12.0.2-ee.0 just with one change: instead of sudo dpkg -P gitlab-ce you should write gitlab-ee – Govan Jul 2 '19 at 7:20
  • 1
    Yep. Works well but the last step should be sudo dpkg -P gitlab-ee – nwaweru Jan 24 at 7:20
11

Should I delete these directory manually or not?

Filesystem Hierarchy Standard for /opt/:

No other package files may exist outside the /opt, /var/opt, and /etc/opt hierarchies except for those package files that must reside in specific locations within the filesystem tree in order to function properly. For example, device lock files must be placed in /var/lock and devices must be located in /dev.

Anything in /opt/ is maintained by an uninstall-script that basically does a shutdown of the service (if needed) and a bunch of rm's. So if you want to do that manually you need to shutdown the service (if needed) and then rm it.

Mind that /opt/ has a companion /etc/opt/ that might contain files related to that package.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.