<edit>
read next post first/this one only for interest.
</edit>
<sigh> removing lib packages was... uhm, brave. It is not possible to reconstruct your system at this point and you are in salvage mode. You will have to buy an empty USB stick or USB drive if you don't have one already. If buying a stick, buy one with the largest capacity available. A drive is a better investment and a much better idea because it will have the capacity to allow you to make future backups as well. This is probably a lesson that you have learned by now, but it doesn't hurt for me to emphasize it--if you value your data, back it up routinely and always before you do anything major to your system like upgrading. The first order of business is to plug in the stick/drive and see if your system recognizes it.
1. Once plugged in, at the command line, do:
If this command produces any output, you are in good shape. It means that your system recognizes the stick as another drive and can write to it. If no output whatsoever, then reboot your computer with the USB stick/drive plugged in and repeat above. We are looking for something like the following:
Code:
DuckHook@Big_Papa:~$ ls /media
Fairmont
In my case, the name of my USB stick is "Fairmont". If you have this result, then note the name of the drive and proceed to step 5 below.
2. If no response to 1 above then do:
Code:
cat /proc/partitions
This gives you a list of all the drives attached to your system. The sd[x] devices are what we are looking for. Your primary hard drive is likely sda and subsequent drives like USB sticks/drives will likely be sdb, sdc, sdd etc. Ignore any drives designated with sr[x]. If you have more than one hard drive attached to your system, The number on the third column is the size of the device in bytes, which serves as a very important double-check to make sure that we are referencing the proper drive. This is critical because the following steps may involve creating a filesystem on the USB stick/drive, and we want to make sure that we are doing so only on the USB drive. If you inadvertently format any other drive, you may delete the very data that you are trying to recover. Therefore, find the line that corresponds to the USB drive size you have and note the label under "name". This will likely be sdb, but it could be a higher letter.
3. These next procedures use the parted command, which is very powerful and must be used with care. It has the potential to nuke your system, so read each command twice to make sure they precisely match the instructions here before pressing <Enter>.
Do:
Code:
sudo parted sd? print
replacing the ? with whichever letter designates your USB stick. If you get an output that looks something like this:
Code:
Model: General USB Flash Disk (scsi)
Disk /dev/sdg: 1008MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 16.4kB 1008MB 1008MB primary fat16 boot
then all is well and we just need to do:
Code:
sudo mkdir /media/usb
Code:
sudo mount /dev/sd?1 /media/usb
replacing ? with the letter for your USB drive. Then skip to step 5.
4. If the output looks more like this:
Code:
Model: General USB Flash Disk (scsi)
Disk /dev/sdg: 1008MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
...with missing info in the second stanza, then your stick/drive is unpartitioned and you must partition it and give it a filesystem. Do the following in the stated order:
Code:
sudo parted /dev/sd?
You are now in the GNU partition editor. It no longer prefaces lines with your shell info but instead says: "(parted)" Do the following:
then:
Code:
Warning: The existing label on sdx will be destroyed and all
data on this disk will be lost. Do you want to continue?
Yes/No: yes
New disk label type? msdos
next:
then:
Code:
Partition type? primary/extended? primary
File system type? [ext2] fat32
Start? 1
End? -1
finally:
Code:
sudo mkdir /media/usb
Code:
sudo mount /dev/sd?1 /media/usb
replacing ? with the letter for your USB drive.
5. Whether we got here from step 1, 3, or had to detour through step 4, you now have a writable USB stick/drive that can be used to copy your /home directory. Your /home directory is where all of your personal data files are. If you know what these files are, then you can copy them individually or by whole directories to the usb stick that you have just mounted with the cp command. If your USB stick/drive is large enough to take your whole /home directory, then it may be easier to just copy your whole /home directory with:
Code:
cp -a ~/* /media/usb
If proceeding directly from step 1 above, then substitute the actual name of your USB stick instead of "usb" in the above code. If you got here going through steps 3 or 4, then you will have already defined this share as "usb" and the code should work without change.
Also, you must not do this last command unless you are sure that your USB media is large enough to hold your whole /home directory--another reason to invest in a USB drive. The cp command is not smart enough to do a sanity check beforehand, so if your media is not large enough, it will simply copy to the point where it runs out of space and then die. The form of the cp command is similar if you wish to go through file by file. Instructions and examples for using the cp command can be found here.
Enough for now. Let's get your data safe before proceeding onwards to making your system usable again.
Bookmarks