0

I want to install Sublime Text 3 , but had a problem, my terminal is showing this error:

dpkg: error: dpkg status database is locked by another process

What shall I do?

guntbert
  • 13,134

2 Answers2

2

This is probably because apt-get is being used already. Close the Ubuntu software center, and if you are using dpkg or apt-get on a different tab, wait for it to finish.

If that doesn't work try rebooting.

If you don't want to reboot, try:

sudo rm /var/lib/dpkg/lock

Note that this could break your system and it should only be used if everything else doesn't work.

tejas
  • 72
  • 1
  • 1
  • 10
1

You need to add sudo to your commands and check if apt-get is already busy. If apt-get is busy wait for it to finish.

METHOD 1 USING PPA

Here are the steps to install Sublime text 3 using PPA:

Add Sublime text 3 PPA:

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update

Install sublime text

 sudo apt-get install sublime-text-installer

Create symbolic link so that you can run ST3 from terminal by typing subl

sudo ln -s /opt/Sublime\ Text\ 3/sublime_text /usr/bin/subl

Just to make sure if it's installed properly , try running it from terminal by typing

 subl

METHOD 2 USING DEB PACKAGE

Install ST3 from deb file :

Download deb package:

Head over to Sublime text website and download the deb package by clicking on Download for Ubuntu .

Change directory to location where you have saved the downloaded file:

If you have downloaded the deb in Download directory then in terminal type

cd Downloads/

this will change your directory to Downloads.

Install the package:

At present it's named sublime-text_build-3103_amd64.deb , for future release, replace the package name with new package name)

dpkg -i sublime-text_build-3103_amd64.deb

Note: If there are some errors with unresolved dependencies, run apt-get install -f afterwards.

In case you face any issues or have doubt read How do I install a .deb file via the command line? and Install from a deb file, by dpkg -i or by apt?

  • You don't need a PPA for Sublime Text 3, in fact I would actively discourage it. .deb files for Ubuntu are available for download, and it will remind you to upgrade when a new version is released. The debs also create /usr/bin/subl and other files, so the PPA is pointless at this point. – MattDMo May 01 '16 at 21:21
  • @MattDMo Sir as I'm new to Linux and as far as my understanding goes on PPA, I think I'd use PPAs before I use .debs because with a PPA you may at least have the possibility of getting security updates once in a while,whereas with a .deb you've just got to fend for yourself and try to stay on top of them. If there is anything else that I should be aware off then please let me know. – Rishi Shukla May 02 '16 at 01:21
  • What I was saying is that as far as Sublime goes, the program itself will let you know when an update is available, so a Sublime PPA is pretty much pointless, as it will lag behind the original version until the maintainers decide to update. PPAs in general are not bad at all, I didn't want to give that impression, it's just in this particular situation I don't think it is warranted. – MattDMo May 02 '16 at 01:29
  • Ohh! Thank you. I will update the answer soon. – Rishi Shukla May 02 '16 at 01:42