LinuxQuestions.org
Help answer threads with 0 replies.
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
 
LinkBack Search this Thread
Old 10-18-2012, 01:32 AM   #1
Weapon S
Member
 
Registered: May 2011
Location: Netherlands
Distribution: Debian
Posts: 143
Blog Entries: 1

Rep: Reputation: 12
Reinstall everything


This might be more of a technical exercise than really a necessity.
The problem: I had defective memory and that almost certainly has led to file corruptions. Also I (still) have random program crashes. I can't trust my system files (my personal files is another problem...).
Could I issue some command to apt or aptitude that redownloads and installs all packages, including kernel? If so: how? And can I trust that to work (with possibly corrupted system)?
Or can I get a list of all installed packages and then provide that to a clean new installation? I want some backports too... I just thought of this solution; I will start investigating.
I had finally got the set-up how I liked it I'd prefer to reinstall as unobtrusive as possible... I'd like to hear from people who have experience or have looked into the matter. Thanks for reading.
 
Old 10-18-2012, 02:42 AM   #2
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,667

Rep: Reputation: 112Reputation: 112
On the current system, do
Code:
dpkg --get-selections > selections.txt
Copy the resulting text file to your /home/<user> along with a copy of /etc/apt/sources.list and back up your data. Re-install Debian, but only a base system. Copy the backed-up sources.list back in place, then do:
Code:
aptitude update && aptitude install dselect && dpkg --set-selections < selections.txt && dselect install
You'll probably get a warning about untrusted sources if you use any non-free repo, authorize their use if you're sure these are safe. Depending on the number of packages and your connection, you'd make yourself a cuppa now
 
2 members found this post helpful.
Old 10-18-2012, 02:54 AM   #3
rizzy
Member
 
Registered: Mar 2004
Distribution: Debian
Posts: 283

Rep: Reputation: 65
you could get list of all packages you have and reinstall those
Code:
dpkg --list
aptitude --reinstall package
Although there is no guarantee for anything with faulty memory. A better option would be back up, reformat and clean debian install. With dpkg --list it won't take too long to bring the system back to original state, probably quicker than trying to fix.
 
1 members found this post helpful.
Old 11-05-2012, 02:38 AM   #4
Weapon S
Member
 
Registered: May 2011
Location: Netherlands
Distribution: Debian
Posts: 143
Blog Entries: 1

Original Poster
Rep: Reputation: 12
Dutch Master, it worked! Thanks.
 
Old 11-08-2012, 05:48 PM   #5
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,054

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
This is real interesting and could be a big time saver for me.

I have one problem though.

When running;
Code:
dpkg --get-selections > selections.txt
I indeed get a selections.txt. It is in my /home/<user name> directory.

This is in a Wheezy install and am pretty sure for this to work it would be elsewhere.

So, where does this need to be to work in the;
Code:
aptitude update && aptitude install dselect && dpkg --set-selections < selections.txt && dselect install
command?
 
Old 11-08-2012, 07:25 PM   #6
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,667

Rep: Reputation: 112Reputation: 112
Ok, you've created the selections.txt file. Now make a copy of the file /etc/apt/sources.list to your home dir:
Code:
cp /etc/apt/sources.list ~/sources.list
Once done, back up all data safely and once you've done that, your old system can be re-installed. Install a bare (minimum) Debian install. Log in and copy the sources.list and selections.txt files from the backup to your new system. As root, copy sources.list back to /etc/apt:
Code:
cp /home/<user-name>/sources.list /etc/apt/sources.list
Assuming you stay with the Debian version you had, now enter the one-liner I've posted and let it do its magic If you change versions, edit the sources.list file accordingly.

Mind that if you stick with standard Debian packages (no multi-media or other 3rd party repo's) copying the sources.list file isn't really necessary. And if you change versions, it might actually be a bad idea to do too!
 
Old 11-09-2012, 01:58 AM   #7
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,054

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Quote:
Originally Posted by Dutch Master View Post
Ok, you've created the selections.txt file. Now make a copy of the file /etc/apt/sources.list to your home dir:
Code:
cp /etc/apt/sources.list ~/sources.list
Once done, back up all data safely and once you've done that, your old system can be re-installed. Install a bare (minimum) Debian install. Log in and copy the sources.list and selections.txt files from the backup to your new system. As root, copy sources.list back to /etc/apt:
Code:
cp /home/<user-name>/sources.list /etc/apt/sources.list
Assuming you stay with the Debian version you had, now enter the one-liner I've posted and let it do its magic If you change versions, edit the sources.list file accordingly.

Mind that if you stick with standard Debian packages (no multi-media or other 3rd party repo's) copying the sources.list file isn't really necessary. And if you change versions, it might actually be a bad idea to do too!
Thanks for the reply.

I don't think I made myself clear though.

The only list I got from that command was /home/walt/selections.list.

Walt by the way is a generic user name for generic installs of Wheezy where I go to play with new ideas or commands. I am not there right now but mounted the / partition for it and there is no copy of this file anywhere there.

My impression was that this file would be in the root partition somewhere or would need to be there to use it to reinstall. Seeing how there doesn't seem to be where should I put it or do I just leave it where is is in the /home/walt directory?

I actually think this would be a great way to install a copy on another box of an OS that I worked on here for someone else. There are several people I have run into that are very willing, indeed enthusiastic, about using Linux ir they don't have to install or set it up in the first place.

If they are at a remote ranch somewhere it is not easy to get to them very often. Most would be quite willing to do the install if this was all that was needed to bet it up and running.

I have a UPS unit but most folks don't. Power outages are not frequent but do happen. Had big fires here this year and you couldn't trust the power to be on from one minute to the next. I was shocked by the fact, in 08, that when the power died and the box did not shut down correctly my Linux install would actually work.

MS never did that for me.

Folks around here kind of like that idea along with the cost of the system. I could Mail them a correct disk and email everything else. May have to supply some install disks for sources as many remote ranches are still on dial up. Heck, the USPS only delivers 2 or 3 days a week to a lot of folks. If they can afford it some do have satalite connection but most don't.

This would work great.

Also be nice for me as I experiment with other installs to find things I want to change and this would be great. After the base install I could go to where ever my production OS is, run boinc and do my other things while a chroot environment took care of the new install.

Just really need to know where that file needs to go. Looked at the man page for dpkg and it didn't give me an answer although it was pretty clear on the command and also "--set-selections".

May just need to give it a whack with the thing in the /home/<user name> directory. May be where it looks for that.

The sources.list is not a problem with me. I have one that I use for all installs of Debian. Just change the version name. Has some handy commented out things in it like the commands for getting gpg keys.

Some folks like to play games on their box. I like to play games with Linux, particularly Debian and its relatives.

Right now I actually need a new install of testing on my main drive. Perfect time to try this after I get it to work somewhere else first.
 
Old 11-09-2012, 07:58 AM   #8
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,667

Rep: Reputation: 112Reputation: 112
The file selections.txt is created in the directory where you are when giving the dpkg command to create it. I assumed you'd be in the /home/<user name> directory, but it can be anywhere in the tree. Mind that if you use the tilde (~) Linux assumes you want it in the users home dir. That user is root, so look for it in /root For dpgk it doesn't matter where the file is, as long as you specify the correct (full) path to it when you import the file in its "database" (it's not really a database, it's a flat file, but some people understand it better when using this analogy)

HTH!
 
Old 11-09-2012, 12:51 PM   #9
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,054

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Quote:
Originally Posted by Dutch Master View Post
The file selections.txt is created in the directory where you are when giving the dpkg command to create it. I assumed you'd be in the /home/<user name> directory, but it can be anywhere in the tree. Mind that if you use the tilde (~) Linux assumes you want it in the users home dir. That user is root, so look for it in /root For dpgk it doesn't matter where the file is, as long as you specify the correct (full) path to it when you import the file in its "database" (it's not really a database, it's a flat file, but some people understand it better when using this analogy)

HTH!
Got it. Thanks a bunch.

Will be playing with this very soon as both my favorite testing and Sid installs are a bit shaky right now but my newer installs of them are in great shape.

That is all tied up with my really poor video card and the end of fglrx support for such out of date cards.

Haven't tried the legacy fglrx driver because the FOSS driver is doing better than fglrx was anyway. Wasn't that way 2 years ago when those two were first installed.

I have been running testing with Xfce as my production OS with Sid as my backup. Right now I am running Sid as the production OS because it runs boinc better for me. The tasks page even redraws without having to keep the cursor moving with the mouse or holding down the down arrow key.

Thanks again. This looks like Fun.
 
Old 11-12-2012, 04:00 AM   #10
Weapon S
Member
 
Registered: May 2011
Location: Netherlands
Distribution: Debian
Posts: 143
Blog Entries: 1

Original Poster
Rep: Reputation: 12
One side note on the topic: the described way does not automatically install backports.
For distribution on a disc, look into making a repository. You should be able to only supply the packages you actually want to install on a disc. (Hopefully only as little as 2 DVD's, because otherwise, you'd have to set up named repositories Disk 1,2,3 etc.) I'm not very knowledgeable on that topic, but I wish you good luck
 
Old 11-12-2012, 08:54 AM   #11
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,667

Rep: Reputation: 112Reputation: 112
If you add the backports repo in your sources.list prior to making a copy, it gets added automatically. But it doesn't automatically install packages from that, for that you'd need apt-pinning. Is also copy-able as in Linux everything is a file (and thus copy-able ), just copy the file from your old system to the backup medium and copy it back in place on the new one before upgrading. It's just another step in preparation, but beyond the scope of this question...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Will "yum reinstall httpd" and "yum reinstall php" mess with my settings? trvo Linux - Server 2 03-30-2012 05:02 AM
Reinstall Slack's LILO after WIndows XP reinstall __spc__ Linux - Newbie 3 02-15-2009 09:04 AM
Can't reinstall XP Dasc General 4 11-01-2005 12:22 PM
To reinstall or not to reinstall...that's the question.. minike Slackware 3 09-17-2005 06:24 PM
reinstall windows, reinstall GRUB too? leupi Linux - Software 1 05-07-2005 10:50 AM


All times are GMT -5. The time now is 11:42 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration