LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' \ > /etc/apt/apt.conf.d/01keep-debs (https://www.linuxquestions.org/questions/debian-26/echo-binary-apt-apt-keep-downloaded-packages-true-%3B-%5C-etc-apt-apt-conf-d-01keep-debs-4175720044/)

Outabux 12-21-2022 10:35 AM

echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' \ > /etc/apt/apt.conf.d/01keep-debs
 
Following Apt News, I performed the operation in the title to configure apt to keep the packages in the archives. From observation, the switch autoclean whether apt or apt-get removes packages which are not downloadable, that is, those packages which are not represented in the repositories' /etc/apt/sources.list or equivalent.

Is there an easy script to remove debs from /var/cache/apt/archives which are not installed to keep things tidy--comparing the contents of all installed packages versus those found in the archive and then remove those that aren't installed?

Thanks.

pan64 12-22-2022 02:58 AM

https://www.cyberciti.biz/faq/can-i-...-debian-linux/

Outabux 12-22-2022 09:14 AM

Thanks. However, that autoclean behavior is not desired. Say for instance bzflag and its dependencies were installed and uninstalled, after an autoclean those packages would remain. After say, building an OS in a virtual environment, I copy all those debs over to a basic install and use dpkg to install those, then I get programs I didn't want.

I will have to learn scripting and such. Seems difficult now; however, after some studying and trials, I should be able to piece it together.

A basic flow would be to build a list of all installed packages, then compare each file in the archives, and delete those not in the list.

Thought someone here could just kind of spit it out or offer something or some things similar that I could modify or piece together.

craigevil 12-22-2022 02:39 PM

Different ways to backup packages:
Quote:

Debian backups

Programs

A quick way of backing up a list of programs is to run this:

dpkg --get-selections > ~/Package.list
sudo cp -R /etc/apt/sources.list* ~/
sudo apt-key exportall > ~/Repo.keys

It will back them up in a format that dpkg can read* for after your reinstall, like this:

sudo apt-key add ~/Repo.keys
sudo cp -R ~/sources.list* /etc/apt/
sudo apt-get update
sudo apt-get install dselect
sudo dselect update
sudo dpkg --set-selections < ~/Package.list
sudo apt-get dselect-upgrade -y

* You may have to update dpkg's list of available packages or it will just ignore your selections (see this debian bug for more info). You should do this before sudo dpkg --set-selections < ~/Package.list, like this:

apt-cache dumpavail > ~/temp_avail
sudo dpkg --merge-avail ~/temp_avail
rm ~/temp_avail

Settings and Personal Data

Before you reinstall, you should probably back up the settings from some of your programs, this can easily be done by grabbing folders from /etc and all the content from your user directory (not just the stuff you can see in nautilus!):

rsync --progress /home/`whoami` /path/to/user/profile/backup/here

After you reinstall, you can restore it with:

rsync --progress /path/to/user/profile/backup/here /home/`whoami`

So all together as a pseudo-bash script.

This assumes there is only one user on the machine (remove /'whoami' otherwise) and that you used the same username on both installs (modify dest. of rsync otherwise).

dpkg --get-selections > ~/Package.list
sudo cp -R /etc/apt/sources.list* ~/
sudo apt-key exportall > ~/Repo.keys
rsync --progress /home/`whoami` /path/to/user/profile/backup/here

## Reinstall now

rsync --progress /path/to/user/profile/backup/here /home/`whoami`
sudo apt-key add ~/Repo.keys
sudo cp -R ~/sources.list* /etc/apt/
sudo apt-get update
sudo apt-get install dselect
sudo dpkg --set-selections < ~/Package.list
sudo dselect

uteck 12-22-2022 06:55 PM

apt-clone will do the above in one command.
Quote:

Description: Script to create state bundles
This package can be used to clone/restore the packages on a apt based
system. It will save/restore the packages, sources.list, keyring and
automatic-installed states. It can also save/restore no longer
downloadable packages using dpkg-repack.

Outabux 12-25-2022 12:23 AM

Thanks! I will check out these options. Made a big booboo and having to image drive with an older backup. At least while I'm at it, I can adjust the size of the swap partition just in case hibernation comes back, or if running virtual machines needs to swap.

Again, thanks. Happy Holidays and New Year!

Outabux 12-26-2022 01:49 PM

Evil Craig, noice! Kinda-ish remember doing something like this years ago minus the rsync. I just downloaded all installed packages, placed them in the archives, and used dpkg -i *.deb IIRC after an update of course. Yup, it's a hack way of doing it. I am trying to learn a better approach.

Utek, apt-clone would have been another option to explore; but at this time, apt-clone is not part of Bookworm. I believe it and other packages are in a normal transition/migration and/or preparing for the planned freeze in February to become the new Stable. I will keep an eye out for it. Thanks again. Merry Christmas to me, Debian finally got (not the latest) Blender into Bookworm! It's been like a year!

yeahdeb 12-29-2022 01:33 AM

in vboxcan't download but in physial machine working
 
in vbox can't download from official repo but in physial machine working

the version debian 11 install in vm and laptop
when try install/download a packages in virtualbox it not working
but in laptop download running well

any advice?

Outabux 12-29-2022 12:03 PM

Although this post is marked solved, I'm no expert by any means, and I believe that you should start a new thread to get more visibility, let me ask a few questions. You never know, we might get lucky, and I could pass along the good blessings/tidings of those that were in the spirit to aid me.

1) Are you able to download or use the web from your vm?

2) During installation of Debian 11 on your vm, were you able to connect with server repositories?

3) If you were able to download from server repositories during installation, what did you select in Tasksel; that is, what did you check in configuring software?

4) Again, if you were able to connect and finish installation of software from repositories, does your vm have the same /etc/apt/sources.list as your host (physical laptop)? If not, please reply with contents of /etc/apt/sources.list of vm.

5) Post contents of /etc/network/interfaces of vm.

This will get diagnosis started. Maybe we will get it, or it will help others with better knowledge and experience get involved.

yeahdeb 12-29-2022 10:02 PM

Thank you so much

So the debian is ova file that i import to vbox and the interface text based not use gui. This connect to inet like ping and apt update, and version is last upgrade from official repository. The problem is when i download some packages like curl libnet its looks like not available in the repository.

If the laptop directly install to the hardisk and interface is gui. This connect to inet and its a last upgrade from official repository (same with debian that install in vbox above). When i try to download packages like curl or libnet its running well the packages install successful.

I so confuse whether the virtualbox (using version 7)or the repository that i take from wiki debian.
Any advice?

Outabux 12-30-2022 12:12 PM

1 Attachment(s)
From terminal input
Code:

$ ip addr show && cat /etc/network/interfaces
and post the results.

The thumbnail is output from of a virtual machine, Debian Bookworm, with only Basic System Utilities.
The only difference between our implementations is the use of Virtualbox vs. Virt-Manager.

Keeping it simple, you will need to edit and save this file from an elevated prompt, restart or use the correct commands in terminal to restart the networking services.

Code:

% sudo nano /etc/network/interfaces
-OR-
Code:

# nano /etc/network/interfaces
Great documentation Debian Network Configuration Wiki

If for some reason you install Network-Manager or it becomes a dependency, you will need to comment out or remove the lines in the section "The primary network interface".


All times are GMT -5. The time now is 04:50 PM.