accidentally deleted /var/lib/apt/
up vote
6
down vote
favorite
I accidentally deleted content of /var/lib/apt with command below:
sudo rm -rf /var/lib/apt/*
what should I do now? can I restore it? is it necessary?
apt
New contributor
Hossein Hosseinvand is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
6
down vote
favorite
I accidentally deleted content of /var/lib/apt with command below:
sudo rm -rf /var/lib/apt/*
what should I do now? can I restore it? is it necessary?
apt
New contributor
Hossein Hosseinvand is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
6
down vote
favorite
up vote
6
down vote
favorite
I accidentally deleted content of /var/lib/apt with command below:
sudo rm -rf /var/lib/apt/*
what should I do now? can I restore it? is it necessary?
apt
New contributor
Hossein Hosseinvand is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I accidentally deleted content of /var/lib/apt with command below:
sudo rm -rf /var/lib/apt/*
what should I do now? can I restore it? is it necessary?
apt
apt
New contributor
Hossein Hosseinvand is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Hossein Hosseinvand is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 3 hours ago
Braiam
51.2k20134219
51.2k20134219
New contributor
Hossein Hosseinvand is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 18 hours ago
Hossein Hosseinvand
363
363
New contributor
Hossein Hosseinvand is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Hossein Hosseinvand is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Hossein Hosseinvand is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
14
down vote
accepted
The folder contains a few interesting things, in particular there is /var/lib/apt/keyrings/ directory for any repositories that you've added to the system via apt-add-repository ( and then there's also /etc/apt/trusted.gpg and /etc/apt/trusted.gpg.d/) and cdroms.list which should reference the installation media as source of packages. Removed /var/lib/apt/keyrings/ubuntu-archive-keyring.gpg may be reinstalled with sudo apt-get install --reinstall ubuntu-keyring.
There's also /var/lib/apt/lists, which contains lock files for when apt is running update or upgrade, and lists of packages in remote repositories. Items in that directory sometimes are cleared or deleted as in this post for example. It should regenerate once you run apt-get update.
In short, I wouldn't worry about this much. Just run sudo apt-get update and it should be back, however if you have added repositories via apt-add-repository which may have required a GPG key, then you may want to add that key again or temporarily remove that repository from /etc/apt/sources.list.d.
You will also want to review how the error was made in the first place, because writing outsudofollowed byrm -rffollowed by an unintended directory name followed by*should not be something your brain allows to happen. Corrective action/changes to behaviours may be required to avoid much worse problems in the future.
– Lightness Races in Orbit
6 mins ago
@LightnessRacesinOrbit I think this comment should be placed under OP's question, but I do agree - user has to know what they type and avoid doingrm -rfwithout checking and ensuring that they remove the right thing first.
– Sergiy Kolodyazhnyy
4 mins ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
14
down vote
accepted
The folder contains a few interesting things, in particular there is /var/lib/apt/keyrings/ directory for any repositories that you've added to the system via apt-add-repository ( and then there's also /etc/apt/trusted.gpg and /etc/apt/trusted.gpg.d/) and cdroms.list which should reference the installation media as source of packages. Removed /var/lib/apt/keyrings/ubuntu-archive-keyring.gpg may be reinstalled with sudo apt-get install --reinstall ubuntu-keyring.
There's also /var/lib/apt/lists, which contains lock files for when apt is running update or upgrade, and lists of packages in remote repositories. Items in that directory sometimes are cleared or deleted as in this post for example. It should regenerate once you run apt-get update.
In short, I wouldn't worry about this much. Just run sudo apt-get update and it should be back, however if you have added repositories via apt-add-repository which may have required a GPG key, then you may want to add that key again or temporarily remove that repository from /etc/apt/sources.list.d.
You will also want to review how the error was made in the first place, because writing outsudofollowed byrm -rffollowed by an unintended directory name followed by*should not be something your brain allows to happen. Corrective action/changes to behaviours may be required to avoid much worse problems in the future.
– Lightness Races in Orbit
6 mins ago
@LightnessRacesinOrbit I think this comment should be placed under OP's question, but I do agree - user has to know what they type and avoid doingrm -rfwithout checking and ensuring that they remove the right thing first.
– Sergiy Kolodyazhnyy
4 mins ago
add a comment |
up vote
14
down vote
accepted
The folder contains a few interesting things, in particular there is /var/lib/apt/keyrings/ directory for any repositories that you've added to the system via apt-add-repository ( and then there's also /etc/apt/trusted.gpg and /etc/apt/trusted.gpg.d/) and cdroms.list which should reference the installation media as source of packages. Removed /var/lib/apt/keyrings/ubuntu-archive-keyring.gpg may be reinstalled with sudo apt-get install --reinstall ubuntu-keyring.
There's also /var/lib/apt/lists, which contains lock files for when apt is running update or upgrade, and lists of packages in remote repositories. Items in that directory sometimes are cleared or deleted as in this post for example. It should regenerate once you run apt-get update.
In short, I wouldn't worry about this much. Just run sudo apt-get update and it should be back, however if you have added repositories via apt-add-repository which may have required a GPG key, then you may want to add that key again or temporarily remove that repository from /etc/apt/sources.list.d.
You will also want to review how the error was made in the first place, because writing outsudofollowed byrm -rffollowed by an unintended directory name followed by*should not be something your brain allows to happen. Corrective action/changes to behaviours may be required to avoid much worse problems in the future.
– Lightness Races in Orbit
6 mins ago
@LightnessRacesinOrbit I think this comment should be placed under OP's question, but I do agree - user has to know what they type and avoid doingrm -rfwithout checking and ensuring that they remove the right thing first.
– Sergiy Kolodyazhnyy
4 mins ago
add a comment |
up vote
14
down vote
accepted
up vote
14
down vote
accepted
The folder contains a few interesting things, in particular there is /var/lib/apt/keyrings/ directory for any repositories that you've added to the system via apt-add-repository ( and then there's also /etc/apt/trusted.gpg and /etc/apt/trusted.gpg.d/) and cdroms.list which should reference the installation media as source of packages. Removed /var/lib/apt/keyrings/ubuntu-archive-keyring.gpg may be reinstalled with sudo apt-get install --reinstall ubuntu-keyring.
There's also /var/lib/apt/lists, which contains lock files for when apt is running update or upgrade, and lists of packages in remote repositories. Items in that directory sometimes are cleared or deleted as in this post for example. It should regenerate once you run apt-get update.
In short, I wouldn't worry about this much. Just run sudo apt-get update and it should be back, however if you have added repositories via apt-add-repository which may have required a GPG key, then you may want to add that key again or temporarily remove that repository from /etc/apt/sources.list.d.
The folder contains a few interesting things, in particular there is /var/lib/apt/keyrings/ directory for any repositories that you've added to the system via apt-add-repository ( and then there's also /etc/apt/trusted.gpg and /etc/apt/trusted.gpg.d/) and cdroms.list which should reference the installation media as source of packages. Removed /var/lib/apt/keyrings/ubuntu-archive-keyring.gpg may be reinstalled with sudo apt-get install --reinstall ubuntu-keyring.
There's also /var/lib/apt/lists, which contains lock files for when apt is running update or upgrade, and lists of packages in remote repositories. Items in that directory sometimes are cleared or deleted as in this post for example. It should regenerate once you run apt-get update.
In short, I wouldn't worry about this much. Just run sudo apt-get update and it should be back, however if you have added repositories via apt-add-repository which may have required a GPG key, then you may want to add that key again or temporarily remove that repository from /etc/apt/sources.list.d.
edited 17 hours ago
answered 17 hours ago
Sergiy Kolodyazhnyy
68.6k9143303
68.6k9143303
You will also want to review how the error was made in the first place, because writing outsudofollowed byrm -rffollowed by an unintended directory name followed by*should not be something your brain allows to happen. Corrective action/changes to behaviours may be required to avoid much worse problems in the future.
– Lightness Races in Orbit
6 mins ago
@LightnessRacesinOrbit I think this comment should be placed under OP's question, but I do agree - user has to know what they type and avoid doingrm -rfwithout checking and ensuring that they remove the right thing first.
– Sergiy Kolodyazhnyy
4 mins ago
add a comment |
You will also want to review how the error was made in the first place, because writing outsudofollowed byrm -rffollowed by an unintended directory name followed by*should not be something your brain allows to happen. Corrective action/changes to behaviours may be required to avoid much worse problems in the future.
– Lightness Races in Orbit
6 mins ago
@LightnessRacesinOrbit I think this comment should be placed under OP's question, but I do agree - user has to know what they type and avoid doingrm -rfwithout checking and ensuring that they remove the right thing first.
– Sergiy Kolodyazhnyy
4 mins ago
You will also want to review how the error was made in the first place, because writing out
sudo followed by rm -rf followed by an unintended directory name followed by * should not be something your brain allows to happen. Corrective action/changes to behaviours may be required to avoid much worse problems in the future.– Lightness Races in Orbit
6 mins ago
You will also want to review how the error was made in the first place, because writing out
sudo followed by rm -rf followed by an unintended directory name followed by * should not be something your brain allows to happen. Corrective action/changes to behaviours may be required to avoid much worse problems in the future.– Lightness Races in Orbit
6 mins ago
@LightnessRacesinOrbit I think this comment should be placed under OP's question, but I do agree - user has to know what they type and avoid doing
rm -rf without checking and ensuring that they remove the right thing first.– Sergiy Kolodyazhnyy
4 mins ago
@LightnessRacesinOrbit I think this comment should be placed under OP's question, but I do agree - user has to know what they type and avoid doing
rm -rf without checking and ensuring that they remove the right thing first.– Sergiy Kolodyazhnyy
4 mins ago
add a comment |
Hossein Hosseinvand is a new contributor. Be nice, and check out our Code of Conduct.
Hossein Hosseinvand is a new contributor. Be nice, and check out our Code of Conduct.
Hossein Hosseinvand is a new contributor. Be nice, and check out our Code of Conduct.
Hossein Hosseinvand is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1099511%2faccidentally-deleted-var-lib-apt%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown