LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 12-21-2022, 10:35 AM   #1
Outabux
Member
 
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241

Rep: Reputation: 30
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.

Last edited by Outabux; 12-21-2022 at 08:15 PM.
 
Old 12-22-2022, 02:58 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
https://www.cyberciti.biz/faq/can-i-...-debian-linux/
 
Old 12-22-2022, 09:14 AM   #3
Outabux
Member
 
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241

Original Poster
Rep: Reputation: 30
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.
 
Old 12-22-2022, 02:39 PM   #4
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,887
Blog Entries: 28

Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
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
 
1 members found this post helpful.
Old 12-22-2022, 06:55 PM   #5
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: Ubuntu based stuff for the most part
Posts: 1,177

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
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.
 
1 members found this post helpful.
Old 12-25-2022, 12:23 AM   #6
Outabux
Member
 
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241

Original Poster
Rep: Reputation: 30
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!
 
Old 12-26-2022, 01:49 PM   #7
Outabux
Member
 
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241

Original Poster
Rep: Reputation: 30
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!
 
Old 12-29-2022, 01:33 AM   #8
yeahdeb
LQ Newbie
 
Registered: Dec 2022
Posts: 2

Rep: Reputation: 0
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?
 
Old 12-29-2022, 12:03 PM   #9
Outabux
Member
 
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241

Original Poster
Rep: Reputation: 30
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.
 
Old 12-29-2022, 10:02 PM   #10
yeahdeb
LQ Newbie
 
Registered: Dec 2022
Posts: 2

Rep: Reputation: 0
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?

Last edited by yeahdeb; 12-30-2022 at 03:26 AM.
 
Old 12-30-2022, 12:12 PM   #11
Outabux
Member
 
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241

Original Poster
Rep: Reputation: 30
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".
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2022-12-30 11-04-37.png
Views:	9
Size:	17.8 KB
ID:	40124  
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] What is the difference between "/etc/httpd/conf.d/" and "/etc/httpd/conf.modules.d/" directories? n00b_noob Linux - Server 7 03-06-2021 06:18 AM
echo 0:$(echo 8*35*37*47 | bc) | xxd -r && echo $(id -un) Linuxanity LinuxQuestions.org Member Intro 1 08-15-2012 06:30 PM
is self-compiled software more stable than binary .debs? lefty.crupps Linux - Software 2 12-22-2006 07:06 PM
/etc/rc.d/rc.inet1.conf debs equivelent master Debian 3 01-02-2006 04:13 PM
Kphone echo (echo echo) scabies Linux - Software 0 10-18-2004 02:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 01:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration