LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 09-17-2012, 04:05 PM   #1
Cyb3r.Kn!ght
Member
 
Registered: Aug 2012
Location: Northern California
Distribution: SolusOS 3.3.6
Posts: 34

Rep: Reputation: Disabled
Configuring postgresql


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?


did i mess something up on my computer?
 
Old 09-17-2012, 05:40 PM   #2
sackboy
LQ Newbie
 
Registered: Sep 2012
Posts: 20

Rep: Reputation: Disabled
Try adding sudo.

sudo apt-get install postgresql-9.1
 
Old 09-17-2012, 05:43 PM   #3
Link182
LQ Newbie
 
Registered: Mar 2005
Distribution: Debian Testing
Posts: 10

Rep: Reputation: 0
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.
 
Old 09-17-2012, 07:00 PM   #4
Cyb3r.Kn!ght
Member
 
Registered: Aug 2012
Location: Northern California
Distribution: SolusOS 3.3.6
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Link182 View Post
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 =~(
 
Old 09-18-2012, 08:21 AM   #5
tdsan
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Rep: Reputation: Disabled
Just curious

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.

Todd

Last edited by tdsan; 09-18-2012 at 08:23 AM.
 
Old 09-18-2012, 08:21 AM   #6
griswald
LQ Newbie
 
Registered: Aug 2007
Posts: 11

Rep: Reputation: 0
Try looking in https://help.ubuntu.com/community/Pa...otingProcedure

The command "sudo fuser -vvv /var/lib/dpkg/lock" should show if anything is accessing the file.
 
Old 09-18-2012, 11:19 AM   #7
Cyb3r.Kn!ght
Member
 
Registered: Aug 2012
Location: Northern California
Distribution: SolusOS 3.3.6
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by griswald View Post
Try looking in https://help.ubuntu.com/community/Pa...otingProcedure

The command "sudo fuser -vvv /var/lib/dpkg/lock" should show if anything is accessing the file.
Yes I did enter it wrong, Thank Your for correcting me =~D

when I enter the command 'sudo fuser -vvv /var/lib/dpkg/lock' I get this:

~/Desktop $ sudo fuser -vvv /var/lib/dpkg/lock
USER PID ACCESS COMMAND
/var/lib/dpkg/lock: root 4668 f.... dpkg

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) ....
 
Old 09-18-2012, 12:06 PM   #8
griswald
LQ Newbie
 
Registered: Aug 2007
Posts: 11

Rep: Reputation: 0
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.
 
Old 09-18-2012, 12:17 PM   #9
Cyb3r.Kn!ght
Member
 
Registered: Aug 2012
Location: Northern California
Distribution: SolusOS 3.3.6
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by griswald View Post
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.

I entered it and this is what it showed:

~/Desktop $ ps -ef|grep -v grep|grep dpkg
root 4667 1 0 Sep17 ? 00:00:00 sudo dpkg --configure -a
root 4668 4667 0 Sep17 ? 00:00:00 dpkg --configure -a
root 4669 4668 0 Sep17 ? 00:00:00 /usr/bin/perl -w /usr/share/debconf/frontend /var/lib/dpkg/info/postgresql-common.postinst configure
root 4675 4669 0 Sep17 ? 00:00:00 /bin/bash /var/lib/dpkg/info/postgresql-common.config configure
 
Old 09-18-2012, 01:05 PM   #10
tdsan
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Rep: Reputation: Disabled
Remove dpkg from running processes

I would suggest running the following commands:

Code:
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.

Todd

Last edited by tdsan; 09-18-2012 at 01:08 PM.
 
Old 09-18-2012, 02:13 PM   #11
Cyb3r.Kn!ght
Member
 
Registered: Aug 2012
Location: Northern California
Distribution: SolusOS 3.3.6
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by tdsan View Post
I would suggest running the following commands:

Code:
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.

Todd
~/Desktop $ ps -ef | awk -F" " '/dpkg/ {print $2; system("kill -9 " $2)}'
29758
Killed

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?
 
Old 09-18-2012, 03:14 PM   #12
tdsan
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Rep: Reputation: Disabled
Ok, I think I see what was done.

1st run the command to kill the dpkg process first.

Code:
ps -ef | awk -F" " '/dpkg/ {print $2; system("kill -9 " $2)}'
2nd run the command to fix the dpkg problem.

Code:
'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:

Code:
tail -f /var/log/postgresql/postgresql-9.1-main.log
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.

Code:
ps -ef | awk -F" " '/dpkg/ {print $2; system("kill -9 " $2)}'
sudo dpkg --configure -a
apt-get update
apt-get upgrade
I hope this helps.

Todd
 
1 members found this post helpful.
Old 09-18-2012, 06:18 PM   #13
Cyb3r.Kn!ght
Member
 
Registered: Aug 2012
Location: Northern California
Distribution: SolusOS 3.3.6
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by tdsan View Post
Ok, I think I see what was done.

1st run the command to kill the dpkg process first.

Code:
ps -ef | awk -F" " '/dpkg/ {print $2; system("kill -9 " $2)}'
2nd run the command to fix the dpkg problem.

Code:
'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:

Code:
tail -f /var/log/postgresql/postgresql-9.1-main.log
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.

Code:
ps -ef | awk -F" " '/dpkg/ {print $2; system("kill -9 " $2)}'
sudo dpkg --configure -a
apt-get update
apt-get upgrade
I hope this helps.

Todd
When I enter in the command :

'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...
 
Old 09-18-2012, 06:28 PM   #14
tdsan
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Rep: Reputation: Disabled
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
 
Old 09-19-2012, 12:09 AM   #15
Cyb3r.Kn!ght
Member
 
Registered: Aug 2012
Location: Northern California
Distribution: SolusOS 3.3.6
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by tdsan View Post
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>
│ │
└───────────────────────────────────────────────────────────────────────────┘
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Postgresql 8.4 shravankumar.bbc Linux - Server 1 05-02-2011 04:11 AM
Configuring postgresql kisembo Linux - Software 1 02-07-2006 05:13 PM
problem with installing PostgreSQL . Configuring false with Java kernelvn Linux - Software 0 08-30-2004 04:15 AM
postgresql -odbc & postgresql-jdbc installation kjsubbu Linux - Software 0 06-19-2003 02:50 AM
PostgreSQL dorian33 Linux - Software 3 01-15-2003 04:01 PM


All times are GMT -5. The time now is 09:57 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration