Detecting downloaded (and not installed) packages with Synaptic / apt / dpkg?

Clash Royale CLAN TAG#URR8PPP
Is there any way to detect downloaded (in cache) and not installed packages using Synaptic, apt or dpkg? Do I have to create a specific filter for that? If so how do I do that? Where could I learn about that?
I know the apt or Synaptic cache is on /var/cache/apt/archives and it seems that if you install something using apt nothing goes to cache. On the other hand you have the option in Synaptic for downloading only and install later.
What I want is to know what is on that cache that is not installed already.
apt software-installation dpkg cache synaptic
add a comment |
Is there any way to detect downloaded (in cache) and not installed packages using Synaptic, apt or dpkg? Do I have to create a specific filter for that? If so how do I do that? Where could I learn about that?
I know the apt or Synaptic cache is on /var/cache/apt/archives and it seems that if you install something using apt nothing goes to cache. On the other hand you have the option in Synaptic for downloading only and install later.
What I want is to know what is on that cache that is not installed already.
apt software-installation dpkg cache synaptic
add a comment |
Is there any way to detect downloaded (in cache) and not installed packages using Synaptic, apt or dpkg? Do I have to create a specific filter for that? If so how do I do that? Where could I learn about that?
I know the apt or Synaptic cache is on /var/cache/apt/archives and it seems that if you install something using apt nothing goes to cache. On the other hand you have the option in Synaptic for downloading only and install later.
What I want is to know what is on that cache that is not installed already.
apt software-installation dpkg cache synaptic
Is there any way to detect downloaded (in cache) and not installed packages using Synaptic, apt or dpkg? Do I have to create a specific filter for that? If so how do I do that? Where could I learn about that?
I know the apt or Synaptic cache is on /var/cache/apt/archives and it seems that if you install something using apt nothing goes to cache. On the other hand you have the option in Synaptic for downloading only and install later.
What I want is to know what is on that cache that is not installed already.
apt software-installation dpkg cache synaptic
apt software-installation dpkg cache synaptic
edited Jan 10 at 18:58
Rui F Ribeiro
39.6k1479132
39.6k1479132
asked Jan 10 at 8:52
RookieOneRookieOne
112
112
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Quick and dirty:
PATH=/sbin:$PATH dpkg --no-act -iGE /var/cache/apt/archives/*.deb 2>&1 |grep -v skipping
This asks dpkg to pretend (--no-act) to install (-i) the packages in the cache, skipping packages for which the same version or a more recent version is already present (-GE). You don't need to be root for this, but you do need to have /sbin in your command search path because dpkg -i insists on having some utilities from /sbin in the path even though it won't use them in --no-act mode.
In my tests, this runs post-invoke hooks (in spite of--no-act).
– Stephen Kitt
Jan 10 at 9:33
add a comment |
I don’t think you can do this with Synaptic, but here’s a command which will query the state of all the packages in the cache and list the files which don’t match an installed package:
for deb in /var/cache/apt/archives/*.deb; do
package=$(dpkg-deb -f $deb Package)
if [ "$(dpkg-query -f '$Status' -W $package 2>/dev/null)" != "install ok installed" ]; then
echo $deb
fi
done
This looks at every *.deb file present in the cache, determines what package it contains, and checks the status of the package. It will list any file which corresponds to a package which isn’t fully installed and configured.
Gilles’ approach has a similar same effect, but operates en masse and ends up being substantially faster if your apt cache contains lots of packages. It has the advantage of listing upgrade candidates too, but it has the disadvantage of running certain dpkg hooks (in spite of the --no-act option).
The reason you don’t see packages in the cache after running apt (v. apg-get or Synaptic) is that apt cleans up after itself automatically.
Although the question doesn't explicit request it, I think it would be usually desirable to list available upgrades as well as packages that aren't installed.
– Gilles
Jan 10 at 9:26
Indeed, thanks @Gilles, that’s a good point.
– Stephen Kitt
Jan 10 at 9:33
This approach also doesn’t deal well with multiarch currently.
– Stephen Kitt
Jan 10 at 9:34
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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%2funix.stackexchange.com%2fquestions%2f493633%2fdetecting-downloaded-and-not-installed-packages-with-synaptic-apt-dpkg%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Quick and dirty:
PATH=/sbin:$PATH dpkg --no-act -iGE /var/cache/apt/archives/*.deb 2>&1 |grep -v skipping
This asks dpkg to pretend (--no-act) to install (-i) the packages in the cache, skipping packages for which the same version or a more recent version is already present (-GE). You don't need to be root for this, but you do need to have /sbin in your command search path because dpkg -i insists on having some utilities from /sbin in the path even though it won't use them in --no-act mode.
In my tests, this runs post-invoke hooks (in spite of--no-act).
– Stephen Kitt
Jan 10 at 9:33
add a comment |
Quick and dirty:
PATH=/sbin:$PATH dpkg --no-act -iGE /var/cache/apt/archives/*.deb 2>&1 |grep -v skipping
This asks dpkg to pretend (--no-act) to install (-i) the packages in the cache, skipping packages for which the same version or a more recent version is already present (-GE). You don't need to be root for this, but you do need to have /sbin in your command search path because dpkg -i insists on having some utilities from /sbin in the path even though it won't use them in --no-act mode.
In my tests, this runs post-invoke hooks (in spite of--no-act).
– Stephen Kitt
Jan 10 at 9:33
add a comment |
Quick and dirty:
PATH=/sbin:$PATH dpkg --no-act -iGE /var/cache/apt/archives/*.deb 2>&1 |grep -v skipping
This asks dpkg to pretend (--no-act) to install (-i) the packages in the cache, skipping packages for which the same version or a more recent version is already present (-GE). You don't need to be root for this, but you do need to have /sbin in your command search path because dpkg -i insists on having some utilities from /sbin in the path even though it won't use them in --no-act mode.
Quick and dirty:
PATH=/sbin:$PATH dpkg --no-act -iGE /var/cache/apt/archives/*.deb 2>&1 |grep -v skipping
This asks dpkg to pretend (--no-act) to install (-i) the packages in the cache, skipping packages for which the same version or a more recent version is already present (-GE). You don't need to be root for this, but you do need to have /sbin in your command search path because dpkg -i insists on having some utilities from /sbin in the path even though it won't use them in --no-act mode.
edited Jan 10 at 9:24
answered Jan 10 at 9:05
GillesGilles
533k12810721594
533k12810721594
In my tests, this runs post-invoke hooks (in spite of--no-act).
– Stephen Kitt
Jan 10 at 9:33
add a comment |
In my tests, this runs post-invoke hooks (in spite of--no-act).
– Stephen Kitt
Jan 10 at 9:33
In my tests, this runs post-invoke hooks (in spite of
--no-act).– Stephen Kitt
Jan 10 at 9:33
In my tests, this runs post-invoke hooks (in spite of
--no-act).– Stephen Kitt
Jan 10 at 9:33
add a comment |
I don’t think you can do this with Synaptic, but here’s a command which will query the state of all the packages in the cache and list the files which don’t match an installed package:
for deb in /var/cache/apt/archives/*.deb; do
package=$(dpkg-deb -f $deb Package)
if [ "$(dpkg-query -f '$Status' -W $package 2>/dev/null)" != "install ok installed" ]; then
echo $deb
fi
done
This looks at every *.deb file present in the cache, determines what package it contains, and checks the status of the package. It will list any file which corresponds to a package which isn’t fully installed and configured.
Gilles’ approach has a similar same effect, but operates en masse and ends up being substantially faster if your apt cache contains lots of packages. It has the advantage of listing upgrade candidates too, but it has the disadvantage of running certain dpkg hooks (in spite of the --no-act option).
The reason you don’t see packages in the cache after running apt (v. apg-get or Synaptic) is that apt cleans up after itself automatically.
Although the question doesn't explicit request it, I think it would be usually desirable to list available upgrades as well as packages that aren't installed.
– Gilles
Jan 10 at 9:26
Indeed, thanks @Gilles, that’s a good point.
– Stephen Kitt
Jan 10 at 9:33
This approach also doesn’t deal well with multiarch currently.
– Stephen Kitt
Jan 10 at 9:34
add a comment |
I don’t think you can do this with Synaptic, but here’s a command which will query the state of all the packages in the cache and list the files which don’t match an installed package:
for deb in /var/cache/apt/archives/*.deb; do
package=$(dpkg-deb -f $deb Package)
if [ "$(dpkg-query -f '$Status' -W $package 2>/dev/null)" != "install ok installed" ]; then
echo $deb
fi
done
This looks at every *.deb file present in the cache, determines what package it contains, and checks the status of the package. It will list any file which corresponds to a package which isn’t fully installed and configured.
Gilles’ approach has a similar same effect, but operates en masse and ends up being substantially faster if your apt cache contains lots of packages. It has the advantage of listing upgrade candidates too, but it has the disadvantage of running certain dpkg hooks (in spite of the --no-act option).
The reason you don’t see packages in the cache after running apt (v. apg-get or Synaptic) is that apt cleans up after itself automatically.
Although the question doesn't explicit request it, I think it would be usually desirable to list available upgrades as well as packages that aren't installed.
– Gilles
Jan 10 at 9:26
Indeed, thanks @Gilles, that’s a good point.
– Stephen Kitt
Jan 10 at 9:33
This approach also doesn’t deal well with multiarch currently.
– Stephen Kitt
Jan 10 at 9:34
add a comment |
I don’t think you can do this with Synaptic, but here’s a command which will query the state of all the packages in the cache and list the files which don’t match an installed package:
for deb in /var/cache/apt/archives/*.deb; do
package=$(dpkg-deb -f $deb Package)
if [ "$(dpkg-query -f '$Status' -W $package 2>/dev/null)" != "install ok installed" ]; then
echo $deb
fi
done
This looks at every *.deb file present in the cache, determines what package it contains, and checks the status of the package. It will list any file which corresponds to a package which isn’t fully installed and configured.
Gilles’ approach has a similar same effect, but operates en masse and ends up being substantially faster if your apt cache contains lots of packages. It has the advantage of listing upgrade candidates too, but it has the disadvantage of running certain dpkg hooks (in spite of the --no-act option).
The reason you don’t see packages in the cache after running apt (v. apg-get or Synaptic) is that apt cleans up after itself automatically.
I don’t think you can do this with Synaptic, but here’s a command which will query the state of all the packages in the cache and list the files which don’t match an installed package:
for deb in /var/cache/apt/archives/*.deb; do
package=$(dpkg-deb -f $deb Package)
if [ "$(dpkg-query -f '$Status' -W $package 2>/dev/null)" != "install ok installed" ]; then
echo $deb
fi
done
This looks at every *.deb file present in the cache, determines what package it contains, and checks the status of the package. It will list any file which corresponds to a package which isn’t fully installed and configured.
Gilles’ approach has a similar same effect, but operates en masse and ends up being substantially faster if your apt cache contains lots of packages. It has the advantage of listing upgrade candidates too, but it has the disadvantage of running certain dpkg hooks (in spite of the --no-act option).
The reason you don’t see packages in the cache after running apt (v. apg-get or Synaptic) is that apt cleans up after itself automatically.
edited Jan 10 at 9:32
answered Jan 10 at 9:14
Stephen KittStephen Kitt
168k24379457
168k24379457
Although the question doesn't explicit request it, I think it would be usually desirable to list available upgrades as well as packages that aren't installed.
– Gilles
Jan 10 at 9:26
Indeed, thanks @Gilles, that’s a good point.
– Stephen Kitt
Jan 10 at 9:33
This approach also doesn’t deal well with multiarch currently.
– Stephen Kitt
Jan 10 at 9:34
add a comment |
Although the question doesn't explicit request it, I think it would be usually desirable to list available upgrades as well as packages that aren't installed.
– Gilles
Jan 10 at 9:26
Indeed, thanks @Gilles, that’s a good point.
– Stephen Kitt
Jan 10 at 9:33
This approach also doesn’t deal well with multiarch currently.
– Stephen Kitt
Jan 10 at 9:34
Although the question doesn't explicit request it, I think it would be usually desirable to list available upgrades as well as packages that aren't installed.
– Gilles
Jan 10 at 9:26
Although the question doesn't explicit request it, I think it would be usually desirable to list available upgrades as well as packages that aren't installed.
– Gilles
Jan 10 at 9:26
Indeed, thanks @Gilles, that’s a good point.
– Stephen Kitt
Jan 10 at 9:33
Indeed, thanks @Gilles, that’s a good point.
– Stephen Kitt
Jan 10 at 9:33
This approach also doesn’t deal well with multiarch currently.
– Stephen Kitt
Jan 10 at 9:34
This approach also doesn’t deal well with multiarch currently.
– Stephen Kitt
Jan 10 at 9:34
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f493633%2fdetecting-downloaded-and-not-installed-packages-with-synaptic-apt-dpkg%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