Debian This forum is for the discussion of Debian Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-21-2022, 10:35 AM
|
#1
|
Member
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241
Rep:
|
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.
|
|
|
12-22-2022, 02:58 AM
|
#2
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,656
|
|
|
|
12-22-2022, 09:14 AM
|
#3
|
Member
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241
Original Poster
Rep:
|
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.
|
|
|
12-22-2022, 02:39 PM
|
#4
|
Senior Member
Registered: Apr 2005
Location: Heaven
Distribution: Debian Sid/RPIOS
Posts: 4,919
|
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.
|
12-22-2022, 06:55 PM
|
#5
|
Senior Member
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: KDE Neon
Posts: 1,283
|
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.
|
12-25-2022, 12:23 AM
|
#6
|
Member
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241
Original Poster
Rep:
|
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!
|
|
|
12-26-2022, 01:49 PM
|
#7
|
Member
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241
Original Poster
Rep:
|
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!
|
|
|
12-29-2022, 01:33 AM
|
#8
|
LQ Newbie
Registered: Dec 2022
Posts: 2
Rep:
|
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?
|
|
|
12-29-2022, 12:03 PM
|
#9
|
Member
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241
Original Poster
Rep:
|
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.
|
|
|
12-29-2022, 10:02 PM
|
#10
|
LQ Newbie
Registered: Dec 2022
Posts: 2
Rep:
|
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.
|
|
|
12-30-2022, 12:12 PM
|
#11
|
Member
Registered: Apr 2003
Location: Greenwood Mississippi
Distribution: Debian.
Posts: 241
Original Poster
Rep:
|
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 02:30 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|