How to get Update Manager to load packages from USB stick?

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
all41
Level 19
Level 19
Posts: 9520
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

How to get Update Manager to load packages from USB stick?

Post by all41 »

I keep an updated copy of /var/cache/apt/archives on a usb stick. When I bring up a new machine
I copy these files to that same directory and apt update. Then the update manager installs the packages
from the archive without having to re-download.

Is there a way to get update manager search for packages directly from the usb stick, or on a different hd partition?

Thank you.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Everything in life was difficult before it became easy.
gm10

Re: How to get Update Manager to load packages from USB stick?

Post by gm10 »

Sure, create a file in /etc/apt/apt.conf.d with these contents:

Code: Select all

Dir::Cache::archives "/path/you/want/to/use/";
If you only want this to be a temporary change (apt won't work if the path is unavailable), you can instead pass the path as a parameter to apt:

Code: Select all

apt install <packagename> -o "Dir::Cache::archives=/path/you/want/to/use/"
User avatar
all41
Level 19
Level 19
Posts: 9520
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: How to get Update Manager to load packages from USB stick?

Post by all41 »

gm10 wrote: Mon Dec 17, 2018 3:36 pm Sure, create a file in /etc/apt/apt.conf.d with these contents:

Code: Select all

Dir::Cache::archives "/path/you/want/to/use/";
If you only want this to be a temporary change (apt won't work if the path is unavailable), you can instead pass the path as a parameter to apt:

Code: Select all

apt install <packagename> -o "Dir::Cache::archives=/path/you/want/to/use/"
I just updated a fresh Tessa Mate beta using apt cache previously downloaded and copied to a usb stick.
I used the 1st method--excellent--Thank you.

The second method is also interesting--but uncertain how to include every <packagename> within a directory.
Everything in life was difficult before it became easy.
gm10

Re: How to get Update Manager to load packages from USB stick?

Post by gm10 »

all41 wrote: Mon Dec 17, 2018 5:38 pm The second method is also interesting--but uncertain how to include every <packagename> within a directory.
<packagename> is not a filename. If you just want to install all .deb packages in a directory then you need none of the above, instead simply do

Code: Select all

apt deb /path/to/directory/*.deb
WharfRat

Re: How to get Update Manager to load packages from USB stick?

Post by WharfRat »

You can also use dpkg with the --recursive option to install from a directory.
User avatar
all41
Level 19
Level 19
Posts: 9520
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: How to get Update Manager to load packages from USB stick?

Post by all41 »

@gm10
@WharfRat

This just keeps getting better.

Since I keep updated backups of the archives anyway my thinking is to reduce write cycles to ssd.
Plus saving metered data and download time. Also not needing to apt clean to recover storage space.

Thanks again.
Everything in life was difficult before it became easy.
gm10

Re: How to get Update Manager to load packages from USB stick?

Post by gm10 »

all41 wrote: Mon Dec 17, 2018 7:54 pm Also not needing to apt clean to recover storage space.
You can just disable the archive cache by creating the file I suggested in my first reply to you, but with an empty path "" instead.
User avatar
all41
Level 19
Level 19
Posts: 9520
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: How to get Update Manager to load packages from USB stick?

Post by all41 »

gm10 wrote: Mon Dec 17, 2018 8:04 pm
all41 wrote: Mon Dec 17, 2018 7:54 pm Also not needing to apt clean to recover storage space.
You can just disable the archive cache by creating the file I suggested in my first reply to you, but with an empty path "" instead.
I know it's Christmas time--I keep getting new toys.
This will be useful for systems I keep around here.
tnx
Everything in life was difficult before it became easy.
gm10

Re: How to get Update Manager to load packages from USB stick?

Post by gm10 »

all41 wrote: Mon Dec 17, 2018 8:21 pm I know it's Christmas time--I keep getting new toys.
Heh, if you want to play around a bit more, have a good read through man apt.conf to see what's possible and apt-config dump to see your current aggregate apt configuration. The package management system is wonderfully flexible. :)
User avatar
all41
Level 19
Level 19
Posts: 9520
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: How to get Update Manager to load packages from USB stick?

Post by all41 »

gm10 wrote: Mon Dec 17, 2018 8:32 pm
all41 wrote: Mon Dec 17, 2018 8:21 pm I know it's Christmas time--I keep getting new toys.
Heh, if you want to play around a bit more, have a good read through man apt.conf to see what's possible and apt-config dump to see your current aggregate apt configuration. The package management system is wonderfully flexible. :)
It will still be Christmas in July (the July following Mint 21 release) :D

Also thanks to the mod team for modifying the subject of this topic to elicit such excellent replies.
Everything in life was difficult before it became easy.
User avatar
all41
Level 19
Level 19
Posts: 9520
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: How to get Update Manager to load packages from USB stick?

Post by all41 »

gm10 wrote: Mon Dec 17, 2018 6:16 pm
all41 wrote: Mon Dec 17, 2018 5:38 pm The second method is also interesting--but uncertain how to include every <packagename> within a directory.
<packagename> is not a filename. If you just want to install all .deb packages in a directory then you need none of the above, instead simply do

Code: Select all

apt deb /path/to/directory/*.deb
How would packages that are already up to date on the target be handled in this scenario?
Everything in life was difficult before it became easy.
WharfRat

Re: How to get Update Manager to load packages from USB stick?

Post by WharfRat »

With dpkg the -E option prevents the installation of the package if the same version of the package is already installed

And the -G option will not install a package if a newer version of the same package is already installed.

So using dpkg -E -R -G -i /path/to/debfiles/* should provide what you're attempting to accomplish.
User avatar
all41
Level 19
Level 19
Posts: 9520
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: How to get Update Manager to load packages from USB stick?

Post by all41 »

WharfRat wrote: Tue Dec 18, 2018 9:35 am With dpkg the -E option prevents the installation of the package if the same version of the package is already installed

And the -G option will not install a package if a newer version of the same package is already installed.

So using dpkg -E -R -G -i /path/to/debfiles/* should provide what you're attempting to accomplish.
Excellent--I will try this out today.
Thank you
Everything in life was difficult before it became easy.
User avatar
all41
Level 19
Level 19
Posts: 9520
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: How to get Update Manager to load packages from USB stick?

Post by all41 »

@WharfRat
this definitely works--installed every remote package-- the whole enchilada--not just the updates.
Almost like a Timeshift restore--but better. Thanks for expanding my knowledge.
But for my immediate needs I have scripted the /etc/apt/apt.conf.d file suggestion and that works perfectly for my needs.
Thank you WharfRat and gm10,
Merry Christmas.
Everything in life was difficult before it became easy.
Locked

Return to “Software & Applications”