The APT Database could not be opened!

Asked by wendy smith

The APT Database could not be opened! This may be caused by incorrect APT configuration or some similar problem. Try running apt-setup and apt-get update in terminal and see if it helps to resolve the problem.
Opened terminal and tried to run apt-setup and apt-getupdate, but it says command not recognised.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Allen Chemist
Solved:
Last query:
Last reply:
Revision history for this message
Andreas (register-rez2000) said :
#1

Hi Wendy,

the command is apt-get update.
You have to run it with super user authorization.

sudo apt-get update

If this does not help please post the error message.

Andreas

Revision history for this message
wendy smith (wendy-smartsavenue) said :
#2

wendy@wendy-desktop:~$ sudo aptget update
Password:
sudo: aptget: command not found
wendy@wendy-desktop:~$
this is what i get when i type in the command.

Revision history for this message
Allen Chemist (alchemist) said :
#3

Hi Wendy

the apt-get needs a dash between the two words (it's not aptget). It is probably easiest to copy and paste it from here into the terminal. Once again, the command is:

sudo apt-get update

Revision history for this message
wendy smith (wendy-smartsavenue) said :
#4

wendy@wendy-desktop:~$ sudo apt-get update
E: Type ‘http://packages.ubuntu.com/gutsy/utils’ is not known on line 1 in sourc e list /etc/apt/sources.list
wendy@wendy-desktop:~$

sorry forgot to put the hyphen in so this is what comes up when I do that.

Revision history for this message
Allen Chemist (alchemist) said :
#5

Ok, next in the command line, do the following:
1. Backup the current configuration, in case we break things further
sudo cp /etc/apt/sources.list /etc/apt/sources.list.broken
2. Edit the configuration, to reset it to a good version
gksudo gedit /etc/apt/sources.list

This will pop up a text editor. Erase everything in the text editor, and add the lines below to it. Then save it, then do the sudo apt-get update again. That should fix your problem. Here is what you should add to the gedit text editor:

#
# deb cdrom:[Ubuntu 7.10 _Gutsy Gibbon_ - Release amd64 (20071016.1)]/ gutsy main restricted

deb http://us.archive.ubuntu.com/ubuntu/ gutsy main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://us.archive.ubuntu.com/ubuntu/ gutsy universe
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy universe
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ gutsy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy multiverse
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://us.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb http://security.ubuntu.com/ubuntu gutsy-security universe
deb-src http://security.ubuntu.com/ubuntu gutsy-security universe
deb http://security.ubuntu.com/ubuntu gutsy-security multiverse
deb-src http://security.ubuntu.com/ubuntu gutsy-security multiverse

Revision history for this message
wendy smith (wendy-smartsavenue) said :
#6

Hi sorry that didn't work this is what I got.
wendy@wendy-desktop:~$ gksudo gedit /etc/apt/sources.list
X Error: BadDevice, invalid or uninitialized input device 168
  Major opcode: 145
  Minor opcode: 3
  Resource id: 0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 168
  Major opcode: 145
  Minor opcode: 3
  Resource id: 0x0
Failed to open device

wendy

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#7

Please try:
sudo gedit /etc/apt/sources.list

HTH

Revision history for this message
Best Allen Chemist (alchemist) said :
#8

Hi Wendy,

That probably did work, those "X Error" messages are unrelated.

In any case, gedit should have come up (a notepad-like application). Were you able to copy and paste the above into it and save it?

If so, try the
sudo apt-get update
again

If not, either re-do the steps above or do this, which does exactly the same thing
sudo cp /etc/apt/sources.list /etc/apt/sources.list.broken
sudo wget www.muzik.ca/sources.list -O /etc/apt/sources.list
sudo apt-get update

This will pull a new sources file off my server and save it in the correct location (essentially the same as copy and paste from above into the file)

Also note that -O in the middle is a capital letter O, not a zero (in case you are typing it)

Hope this helps

Revision history for this message
wendy smith (wendy-smartsavenue) said :
#9

Thanks Allen Chemist, that solved my question.

Revision history for this message
wendy smith (wendy-smartsavenue) said :
#10

Hi Allen many Thanks for all your help. It is now working properly. Wendy

Revision history for this message
MC Moshou (mcmosh24) said :
#11

o.k. people, im a rookie

what is apt and what does it do? where and how do i get it?

Scenario: my update manager hangs whenever i run it. my notebook is up and running for 6 - 8 hours a day. got some advice about configuring dpkg which i did after changing to sudo(im not sure im saying this right). then there was a command i had to put in that had this APT syntax, but i get the following error message:

root@work-baby:~# apt -get -f install
The program 'apt' can be found in the following packages:
 * openjdk-6-jdk
 * sun-java5-jdk
 * sun-java6-jdk
Try: apt-get install <selected package>
bash: apt: command not found

so gentlemen (ladies r gentle2), what do i do now.