LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-24-2017, 08:30 PM   #1
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Rep: Reputation: 33
Unhappy Tasksel bricked my computer...


I really hope someone can help.

I used to have Linux Mint 17.3 installed on my desktop computer. Today I decided to install a LAMP server because I wanted to run a local installation of Wordpress and Drupal. I read online that the easiest way to install LAMP was to use tasksel.

It took almost an hour and asked me to create a MySQL password so i thought it was working. However later on when i checked it, I saw the status reading "removing" and lots of important stuff afterward like Cinnamon and Mono. There was no cancel button, so I had no choice but to let it "remove" everything, even though all i wanted was to install something, not remove! After the install completed I noticed almost all my program icons missing, such as Libre Office, VLC, and my image programs like Gimp. When I tried to reboot, my computer now shows only a black screen with Ubuntu and four dots underneath. It just sits there and i can't do anything. I tried forcing off and on but that black screen is all i get now.

I guess Mint has been uninstalled. I am panicking because this was my primary computer and has/had all my work and photos on it. I don't know what to do. Is my computer toast? If not, how can i recover it?

Last edited by Avatar; 11-28-2017 at 08:45 AM. Reason: add info
 
Old 11-24-2017, 08:58 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Never heard of it, so went looking for the doco - did you ?.
Quote:
Originally Posted by tasksel
Already-installed tasks will have an asterisk beside their name. Select a task by scrolling down and pressing space. This will put an asterisk beside the selected task and mark it for installation. Removing an asterisk marks the task for removal. Once "ok" is selected the task installations and/or removals will take place using apt-get.
They are only packages, your data should be safe - check the filesystem(s) from a liveCD. Should be able to recovery that and either re-install the (meta-)packages you removed, or just start again.

Note my sigline.
 
Old 11-24-2017, 09:30 PM   #3
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
Thanks for the reply. I usually only read the docs if I'm confused about how the program works. This one seemed really easy to use, but I guess I made a dangerous assumption.

Still, there were only two things already selected, print server and samba server. I figured I was unselecting them because tasksel wanted to install them by default, but even if they were already installed, I don't use them and wouldn't miss them if they were removed. I certainly didn't see anything about office, fonts, my graphics programs, Cinnamon, or my entire OS.

Do you think all my programs and my OS are really gone?
 
Old 11-24-2017, 11:38 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by Avatar View Post
I certainly didn't see anything about office, fonts, my graphics programs, Cinnamon, or my entire OS.
Anytime you remove something, you've got to carefully check the dependency list. When it happens automatically, you're riding your luck.
Quote:
Do you think all my programs and my OS are really gone?
Sure, why not - that's what package managers do. I'm only an infrequent user of apt, but I'd be pretty confident it has a history of what happened.
 
Old 11-25-2017, 04:30 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
https://forums.linuxmint.com/viewtopic.php?t=92643
yep, it's scary.
but your data is not lost.
what you need to do to recover it - have a live bootable medium (usually usb stick with some - any - linux live distro) plus separate storage (can be an internal partition or another usb storage).
boot live, and access your files. make sure they're in a safe location so they won't get erased when you reinstall.
 
Old 11-25-2017, 09:53 AM   #6
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
ondoho, thanks for the link. Yes, I had an old copy of parted magic laying around and I can see my data, I only have a NTFS USB stick right now but I'm trying to format it for linux so I can save my files on it.

To be honest I am more concerned about the hours and days it will take to reinstall everything from scratch (I know, lesson learned in using unfamiliar tools!). I take religious backup images of Windows computers but I only know how to copy files in linux, not take images that can easily be restored, and never got around to learning it. (That's for another thread though!)

In the link you provided, I saw this post:
Quote:
Ok, here is some help to restore the system from "TTY_only" after tasksel removed important packages:

Code:
sudo apt-get install $(for i in $(cat /var/log/dpkg.log |grep -oP "(?<=`date +%Y-%m-%d`\s\d\d\:\d\d:\d\d\sremove)\s\S*\s"); do echo -n "$i "; done

Which basically looks in the dpkg.log for packages removed today and reinstalls them by handing the package-names over to apt-get.
It also restores other packages
Since my OS is already destroyed, I figure there is no harm in trying this. My question, since my OS will not boot, is it possible to run this command from a live CD? If not, is it possible to get TTY_only (not really sure what that is, I assume command line) on boot?
 
Old 11-25-2017, 12:53 PM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by Avatar View Post
My question, since my OS will not boot, is it possible to run this command from a live CD?
no, but you can use the central part to save a list of installed software, and then later use that list.
Code:
for i in $(cat /var/log/dpkg.log |grep -oP "(?<=`date +%Y-%m-%d`\s\d\d\:\d\d:\d\d\sremove)\s\S*\s"); do echo -n "$i "; done > list.txt
(not tested)

Quote:
If not, is it possible to get TTY_only (not really sure what that is, I assume command line) on boot?
yes.
the answer to "how" should be only a web search away.
 
Old 11-25-2017, 04:34 PM   #8
GentleThotSeaMonkey
Member
 
Registered: Dec 2016
Posts: 338
Blog Entries: 4

Rep: Reputation: 128Reputation: 128
Minor fyi: an apparently bogus copy&paste of original post by new user here, reported: https://www.linuxquestions.org/quest...ter-4175618336

Last edited by GentleThotSeaMonkey; 11-26-2017 at 03:38 AM.
 
Old 11-25-2017, 05:34 PM   #9
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
Hi ondoho, thank you for all your help. I did look at the log file and see all the packages it was removing (which I find completely incomprehensible that any tool would remove all those important packages without being told to!).

When I tried the given command, it gave me an error that GREP didn't understand option "P". I modified it and here is the exact command I used.

Code:
root@PartedMagic:/media/sdb2# for i in $(cat /media/sda1/var/log/dpkg.log |grep -o "(?<=`date +2017-11-24`\s\d\d\:\d\d:\d\d\sremove)\s\S*\s"); do echo -n "$i "; done > list.txt
Unfortunately the list.txt it produces is an empty file.

Edit: I found new instructions here:
https://serverfault.com/questions/38...apt-get-remove

I'll need to figure out how to get into TTY without doing grub-update, but I'll get there! I'll update my progress here.

Last edited by Avatar; 11-25-2017 at 05:55 PM.
 
Old 11-25-2017, 09:31 PM   #10
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
Thumbs up

Well, I am very happy to report that my computer has been completely restored and is back in business!

I'll outline the steps I did here since I followed some links, and also had to do a bit of searching around, and it might be useful to someone in the future.

I definitely couldn't have done anything without a Live CD so this was important! Luckily I had a really old copy of Parted Magic laying around (probably from 2009 or so!) and it did just what I needed.

From the Live CD I was able to access the apt-get logs and extract all the package names of the ones that had been removed (a shocking 654 of them!)

My host filesystem was mounted on /media/sda1, so change the path according to your own host filesystem. At the command line:
Code:
echo sudo apt-get install `grep Remove /media/sda1/var/log/apt/history.log | tail -1 | sed -e 's|Remove: ||g' -e 's|([^)]*)||g' -e 's|:[^ ]* ||g' -e 's|,||g'` >> restore
chmod +x restore
From https://serverfault.com/questions/38...apt-get-remove
This will select all removed packages from the apt history log, and save them in a file called "restore" in the current directory (so make sure you are in a directory on your HOST file system, not on the Live CD). This command also includes the "apt-get install" directives so it basically is a ready-made command file for reinstalling all your packages!

If your system is bootable, you can just run this file, however mine was not, so I had a few extra steps to do.

The next thing I had to do was figure out how to boot to a command line. Usually you can do this from the Grub menu but, my system did not show me a Grub menu on boot and since I couldn't boot my computer I couldn't update Grub to change this. Fortunately, you can press the Esc key on boot at just the right time to get to Grub. It took me several tries

At the Grub menu you can boot to "Recovery Mode" which brings you to a "single user" command line. Unfortunately the file system is read-only and does not have a network connection so we have to set those up. Run:

Code:
mount -o rw,remount /
and

Code:
vi /etc/network/interfaces
and add the line "iface eth0 inet dhcp" to it. Save with ":w" and exit with ":q"

Now you can run "ifup eth0" (or your network connection name) to get connected to download your packages.

Next I just ran /path/to/restore and ran the file I made earlier. It took a couple of hours (I have a slow Internet connection) but my computer is back to normal and everything is back where it should be.

Re-installing is also a viable option, but since my only computer didn't work, and the only other device I have is a clunky Windows tablet, I wouldn't have been able to download a new OS until I had access to another computer. This really saved my bacon!

Thank you to the people who took the time to help me out, and to those out in Internet-land who figured all this stuff out and posted it to help others.

Last edited by Avatar; 12-01-2017 at 01:30 PM. Reason: clarity
 
1 members found this post helpful.
Old 11-26-2017, 02:22 AM   #11
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Just run tasksel from the install DVD 'rescue' environment. Use rescue mode. Open a root shell. Make sure you check everything you want, even if it's already installed. I've used this method, and it works. There is no reason your data should be lost. But you might want to save it to an external drive just to be safe, before you run tasksel again.
 
Old 12-01-2017, 01:44 AM   #12
BashTin
Member
 
Registered: May 2003
Location: West Midlands, United Kingdom.
Distribution: Slackware 14.1, Centos 7
Posts: 278

Rep: Reputation: 32
I would just like to chip in and say thanks Avatar for your step by step explanation of your recovery process. It's a really helpful learning tool for others who have similar issues and is very much better than, 'solved, thanks a bunch everyone' which I have always thought of as lazy and certainly unhelpful to the greater community.
 
  


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] tasksel error r_s Linux - Newbie 4 03-05-2019 11:30 AM
[SOLVED] Install Linux Mint to bring bricked computer back to life? Kiff Linux - Newbie 21 01-26-2017 11:38 PM
[SOLVED] New set of speakers bricked my computer nutjob16 Linux - Hardware 3 01-08-2013 09:32 AM
tasksel, where is c/c++ development?? ykcorse Linux - Newbie 2 06-04-2006 12:25 AM
Tasksel Outabux Debian 3 04-14-2006 12:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:22 PM.

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