Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am a noob I admit it, and I cant seem to find an answer.
it says that my postgresql is outdated and need to be upgraded, yet when i try to 'apt-get install postgresql-9.1', I get this response:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
Check that you don't have another apt program running (apt-get, aptitude, synaptic, etc) maybe something is running in the background updating the repository.
Check that you don't have another apt program running (apt-get, aptitude, synaptic, etc) maybe something is running in the background updating the repository.
I was making reference to 'sudo apt-get'; how do I check to see if anything is running in the background updating the registery, because I am not seeing anything open, then again I am looking through the GUI not the 'command shell', what is the command to check etc.... cause i even tried restarting my pc and still get the error =~(
I think in the last post you stated something about the registry. Are you referring to Linux or Windows. Because Linux does not have a registry but a complex filesystem that uses the kernel and modules to manage intricate functions.
However, if you misspoke, the command to verify if the system is running would be as follows:
Code:
chkconfig --list | grep -i postgresql # Verify the correct daemon starts at the different run levels during boot up
Look like this -> "postgresql 0:off 1:off 2:on 3:on 4:on 5:on 6:off"
service postgresql status # Verifies if the system is running or not
or /etc/init.d/postgresql status # Does the same thing
apt-get remove postgresql # Removes postgresql from the system, this needs to match the daemon found in chkconfig
apt-get clean postgresql # Removes the downloaded files
apt-get check postgresql # Validate to see if there are no broken dependencies
apt-get install postgresql postgresql-client pgadmin3 # Installs server, client and gui
Also, there is a log file found in /var/log/postgresql/postgresql-[version]-main.log
Run from the cli in another window, tail -f /var/log/postgresql/postgresql-[version]-main.log # Try to restart postgresql from the command prompt using the following:
Code:
/etc/init.d/postgresql start
or
service postgresql start
If it fails, then validate the error message. It should say something about SHMMAX or SHMALL (max = max memory segment size, mall = smallest memory segment), modify those settings by updating the kernel to the settings they suggest:
Code:
sysctl -a | egrep -i "shmmax|shmall" # This will give you the size of your current memory allocation
sysctl -w kernel.shmmax=<recommended memory size found in the log or how much memory do you have, I can do the calculation
sysctl -w kernel.shmall=4194304 # 4 Meg minimal segment
Go back to your system and run the following:
Code:
/etc/init.d/postgresql start
or service postgresql start
If it does not start, then please paste the log of the postgres-[version]-main.log. If you have trouble finding it, then run the following:
Code:
find /var/log -name 'postgresql-???-main.log' -exec tail -n 50 {} \; | grep -i `date +'%y-%m-%d'` > $HOME/postgres-today.txt
# This command is used to extract the items from today, since you it is not running, it should be limited, go back to your home directory and you should see the file there.
Also, in order to keep your system changes go to /etc/sysctl.conf and add the following items to end of the file:
# Postgresql Modifications
kernel.shmmax=<recommended setting> Based on available memory you have, read recommendation from log
kernel.shmall=4194304 # I usually set this to 4 megs, very low amount of memory
Just skim through the file to make sure these values do not exist before adding it.
Thank you.
I just installed postgresql and ran into the same problem, now the system is up and running.
Do I remove the file? I tried to install 'chkconfig' and I still get the same error:
sudo apt-get install chkconfig[sudo] password for smurf:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
I went to 'https://help.ubuntu.com/community/PackageManagerTroubleshootingProcedure' (the link in the previous message), I understand the commands but am sure of what to do... I also tried:
~/Desktop $ sudo apt-get check postgresql
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
I have to of course, update my postgresql from 8.? to 9.? but everytime I try to update or install, I get the same message: (see above) ....
It appears that dpkg is already running as process 4668
Don't try to remove the file manually as that may cause more harm. Closing dpkg gracefully should remove the lock file. Use "ps" to determine why dpkg is running (ps -ef|grep -v grep|grep dpkg). Until you fix this, apt-get attempts will fail because of the running process using key resources.
It appears that dpkg is already running as process 4668
Don't try to remove the file manually as that may cause more harm. Closing dpkg gracefully should remove the lock file. Use "ps" to determine why dpkg is running (ps -ef|grep -v grep|grep dpkg). Until you fix this, apt-get attempts will fail because of the running process using key resources.
ps -ef | awk -F" " '/dpkg/ {print $2; system("kill -9 " $2)}' # This removes every instance of dpkg in each line item
apt-get clean postgresql
apt-get -f check postgresql # -f is force and check validates you have all of the packages you need
apt-get update
apt-get upgrade
Sounds like the update on your system just failed during one of the updates it was trying to perform, the first command kills it and the others validates everything is working fine.
ps -ef | awk -F" " '/dpkg/ {print $2; system("kill -9 " $2)}' # This removes every instance of dpkg in each line item
apt-get clean postgresql
apt-get -f check postgresql # -f is force and check validates you have all of the packages you need
apt-get update
apt-get upgrade
Sounds like the update on your system just failed during one of the updates it was trying to perform, the first command kills it and the others validates everything is working fine.
I killed the process (Thank You), I cleaned 'postgresql' yet when I did the '-f check postgresql' I got this:
~/Desktop $ sudo apt-get -f check postgresql
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
So I had remembered that I have to update it, If I am not mistaken I have to download postgresql 9.1, before I remove postfresql 8.?, yet when I try to download postgres 9.1, I got :
~/Desktop $ sudo apt-get install postgresql-9.1
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
so I atempt to install 'postgresql-9.1' :
~/Desktop $ sudo apt-get install postgresql-9.1
[sudo] password for smurf:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
I also did a check like instructed :
~/Desktop $ sudo apt-get check postgresql
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
If I killed the process/command shouldnt it be locked? Or is it something I am missing still?
'sudo dpkg --configure -a' # this will clean the process dpkg process
3rd validate the installation process continues properly, it may do that during the dpkg --configure -a process
Code:
'apt-get -f check postgresql' # The latest version is 9.2, but 9.1 will work just fine.
This will fix the inconsistencies associated with the install of postgresql. Be sure to pay attention to the messages and run a tail to look at the logs when you are doing this:
One thing, make sure you have a cleaned up system, that is if you still have problems, this will clear the dpkg problem and then update the entire system. If you are running workstation, be sure to close down the gui software update program, because it may be conflicting:
Run this code to address the problem with the computer, reboot is recommended but not necessary, in certain instances.
'sudo dpkg --configure -a' # this will clean the process dpkg process
3rd validate the installation process continues properly, it may do that during the dpkg --configure -a process
Code:
'apt-get -f check postgresql' # The latest version is 9.2, but 9.1 will work just fine.
This will fix the inconsistencies associated with the install of postgresql. Be sure to pay attention to the messages and run a tail to look at the logs when you are doing this:
One thing, make sure you have a cleaned up system, that is if you still have problems, this will clear the dpkg problem and then update the entire system. If you are running workstation, be sure to close down the gui software update program, because it may be conflicting:
Run this code to address the problem with the computer, reboot is recommended but not necessary, in certain instances.
'sudo dpkg --configure -a' : I get a blue-screen terminal "Configuring postgresql-common" im unclear of how to progress past that screen and not mess anything up...
Can you capture the screen and send it to me or tell me what is on the screen or what it is asking you?
Todd
this is the blue screen
┌─────────────────────┤ Configuring postgresql-common ├─────────────────────┐
│ │
│ Obsolete major version 8.4
│
│ The PostgreSQL version 8.4 is obsolete, but the server or client
│ packages are still installed. Please install the latest packages
│ (postgresql-9.1 and postgresql-client-9.1) and upgrade the existing
│ clusters with pg_upgradecluster (see manpage).
│
│ Please be aware that the installation of postgresql-9.1 will
│ automatically create a default cluster 9.1/main. If you want to upgrade
│ the 8.4/main cluster, you need to remove the already existing 9.1
│ cluster (pg_dropcluster --stop 9.1 main, see manpage for details).
│
│ The old server and client packages are no longer supported. After the
│ existing clusters are upgraded, the postgresql-8.4 and
│
│ <Ok>
│ │
└───────────────────────────────────────────────────────────────────────────┘
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.