I have a laptop with 1TB drive for /dev/sda. Four partitions named sda1, sda2, and sda3, plus linux swap. After my wife tried learning Ubuntu 15.10 in the quick with some keyboard and touch pad issues, and passing the laptop over a table with lid up, causing some more mistypes, I found that only sda1 was still sane. sda2 and sda3 were no longer accessible via the GUI and would neither mount or umount. So I fired up gparted.
gparted had problems too, but the "/device/attempt data rescue" and using "sda2 view". But prior to this, bparted wanted me to install fpart, si I dis "sudo apt-get -y install gpart". I found that the data was intact. But sda3 showed that it could not be mounted Read-Only. So I worked with "Partition" i gparted, but it said the partition table overlapped another partition. That's dangerous, so I deleted sda3 and did "new", and put it back as it had been with an auto "format". I then quit gparted, mounted sda2 and sda3 in the GUI, entered a Terminal and typed the following:
cd /m*// # a shortcut way to get to /media//
dir # just to verify sda2 and sda3 both got mounted
sudo cp -rfp sda2/ sda3/ # copy the now-good sda2's contents to the new sda3
This process took hours as I have over 200GB data on each partition. No errors were reported. But it turns out, nothing got copied. The original folders and files on sda3 showed up instead. How this happened I don't know. This step may have been unnecessary, or maybe it played a role in the recovery process.
I then located and installed Ubuntu boot-repair. I could run in from the good partition of sda1, but created a script file of the commands to install and run it and copied it to /m*//sda2/home//. That worked. But sda3 failed to be copied too. So I went back to gparted and did another data rescue on sda3. and this time the original folders showed up. only I did not know that then. This time I could copy the script file file to my iser account on /m*/*/sda3/home//
I ran a mix of the following commands several times. To run them. I first decided to become root and eliminate the need to type sudo repeatedly, or sudo -i at least once, and be timed out on after 10 minutes or whatever the time is adjusted to be.
It's simple, just enter "sudo su root". You keep $HOME and $PATH as they were, but "~" becomes /root. Now no more timeouts and no need to know root's password, although you could change the root password with "sudo passwd root". You just need administrative powers as a user, and you have control when you needit. Son;t overdo though, as you have the power to ruin or destroy as well. So here atr the mix of commands to run as super user or root:
apt-get -f install # fix lingering problems or identify unresolved issues and suggest courses of action, not all as simple as suggested.
apt-get -qq update # needed to run once to get update listings from the various repositories covered in /etc/apt/sources.list, any *.list files in the /etc/apt/sources.list.d folder, or the PPAs that were added at some point. Always a good thing to run before every effort to do an upgrade.
apt-get -qq -y dist-upgrade # best choice of the three (upgrade and full-upgrade, as update just does package add-ons but does not update the kernel (that's the real Linux core), and fupp-upgrade takes you up to the latest release.
like going from 14.04 to 15.10 was too big a jump. and to get around this I had to remove 14.04 completely using a LiveCD or other partition leaving only /home and its contents behind ("cd /m*///home", or "cd /m///home;pwd" and verify that you are on the right partition). To geg rid of the system folders only, you type "sudo rm -r ../![h]*". and this will delete everything except files in ../ that start with "h", and all folders in ../ that don't start with "h" plus their contents. Then you install the new version of Ubuntu 15.10 or later.
The reason you have to do it this way is as failing of the LiveCD or LiveUSB process, or the "sudo apt-get install full-upgrade" or Sortware Updater processes, and how they handle inter-dependencies. All these inter-dependencies were done incrementally and in a certain order, and were properly resolved at key points by "sudo apt-get -f install", , which forced some dependents, such as libraries, to be installed before their appeared to be a need for them.
The opposite of "sudo apt-get -f install" is "sudo apt-get -y remove", but you have to actually name all the dependents or packages to be removed on the same line as this command with a space separator. You can first try removing them individually, perhaps in a script list, but when two or more get hung, you need to hammer at them with a single remove command until they are finally removed in the right order. "sudo apt-get autoremove" works for most obsolete packages. files, and libraries, but tells you when it can't do the job, and suggest you run "sudo apt-get install -f" instead.
The position of flags like "-f" is not critical, as long as it comes after the apt-get.
The -qq just removes routine progress results, but may hide some critical details about which actions did not get acted on. In the install process, it can also suggest other packages that you might want as well. The best course of action is to add " | less " behind these commands so that you can scroll through the output afterwards, or redirect the output to a temporary file using " > filename" or " >> filename", The ">" would start a new file or delete and existing file of whatever name you use in place of filename, and the ">>" would either start a new file of that name if it does not exist, or append to an existing file of that name. You would not use "-qq" if you go this route.
In place of ">" and ">>" you can use " | tee filename" and " | tee -a filename". This splits the output so that it both goes to the file and returns to the StfOut as well, which normally appears on the screen unless redirected again by another "]", ">", ">>", or possibly a "<". These are called pipes, and used to redirect StdIn, StdOut, and StdErr.
The importance of getting the results into a file is that it can be processed by a script or other app, program, or utility like grep, awk, sed, cut, and so on. Or write your own in Python, Perl, C/C++, truebasic, or what have you. You can eliminate the standard returns in the file which follow a pattern, and focus on the problem areas which have their own patterns.
You can strip out the significant portions and determine the next steps to take, then program those steps into their own script file, act on them immediately, or report them as unresolved. That's what progrsmming is about, making the computer do its best for us. We aply our smarts in a way that the computer can understand and follow, then anybody can do it. Not having done all that yet, which takes time, I just kept throwing the problems back into apt-get's lap until they sorted themselves out.
One solution "apt-get -f install" used to offer was to use "sudo dpkg --configure -a" as a way of putting a band-aid on a failing system by having it verify what was still alive and sane and discarding broken packages if they could not be healed. But dpkg has been altered and --configure is no longer supported, and I don't know if there is a suitable replacement or not. Fortunately I did not need it this time around. but it is unsettling to know that it is gone.
As wonderful as apt-get is, what bothers me is that it can suggest a course of action, but does not act on its own suggestions. Why doesn't it just take the steps and fix the problem for me? I've lamented this lack before. And another problem is that one pass of any apt-get install or Sortware Updater may not be enough. Remember that the upgrades have to come in a certain order, and going through the Repositories and other sources may not occur in that order. Hence use "apt-get -f install" and try again, and repeat if there were any changes made in the last pass.
Since none of the existing update/upgrade process go to this extent, you have to either write your own or wait until someone does it for you.
But back to my final results. Two recovered partitions, onesuppose to be a clone of the other, but somehow brought back to good health instead. But there is a problem: The /etc/fstab file did get replaced. Using simolar techniques to the above, I used "dir /dev/disk// to get all the ways the drives and partitions are referenced and copied these into a text file, then used "blkid /dev/dis/sd" and got a complete breakdown on each one. I then used "sudo gedit /m*/*/*3/etc/fstab" and replace the UUID for root ( / ) with the UUID given for sda3, and changed the "instally installed" comment to sda3 as well. For grub that would have been enough. But not for grub2. I got here by searching for what other change is needed. Now I know by reading the above.
There is comment made that boot-rescue would find and fix this problem. Nope, doesn't work. Nor does the combination of "sudo update-grub && grub-install /dev/sda". What was happening was for sda3, I was getting the ogiginal folders and files back (mostly), but neither boot-rescue nor update-grub were verifying that sda3 had /boot on it, a /etc/fstab file, where the / was suppose to be or that there was a bootable image file on it. No, they went with the previous determinations by grub2. I was getting the /home folders for sda3, but the actual root was still sda2. This raises some interesting possibilities for quick recovery if a partition fails to boot by just switching to another partition for root (/), or using the same root and setting up /home on different partitions.
Rather than do the grub2 file manually, it makes more sense to script the process or have prepared substitutions in place in case a given partition fails to act as it should. Either the system files or the user accounts could be remoted or put on an external drive. The possibilities are huge if you think about it.
having covered so much ground, here are a few more tips:
(1) If on a laptop with a backlit screen, you can install xbacklight and automate the intensity of the light.
(2) For any monitor/graphics card. install and run xrandr, This identifies and allows you to change screen resolutions to sizes that agree with the card's capabilities. You can switch resolutions on the fly by manual commands, which can of course be scripted. The resolutions effect all users and all work spaces, but you can set .profile or other start-up scripts so that logging in under a different userid can assume their favorite setting.
(3) Using gnome-session-fallback or gnome-session-flashback (aka Gnome Session Manager), you get a 3-in-1 interface choice. One is your present interface, which is the default. The most informative and organized interface found so far is Metacity, which is the 2nd choice. Under Metacity, all login choices are listed under the top rightmost button. By clicking on any one, you are instantly able to switch to it, but your existing login continues to run. No need to log out and back in as the other user anymore. It's like the terminal entry "su user" command, but done via the GUI. Very handy. Makes it easy to share a PC without disrupting work in progress.
(4) When it comes to getting eyeglasses or contacts, the better way is to so it online. New glasses for as little as $9, but more if you want frames with style, which they also carry. Decent good-looking glasses for as little as $35 - $40.
They fit you for the frames online and one site can even correctly determine the PD, or distance between the pupils. I verified its measurement by using on screen rulers (screenruler and kruler) and used gimp to rotate my head and displayed credit/debit card (a standard in these measurements) which I glued temporarily to my forehead with Elmer's rubber cement (wait for it to dry on the card then stick, don't put the cement on you forehead as it will sting).
Some sites invite you to email the image to them and they will do the measurements for you. Most rulers are inches and Centimeters, but they want millimeters, which are 1/10th of a centimeter. To go from inches to millimeters, just use simple math: Inches + n/m fractions of an inch gives you a whole number. Then multiply the whole number by 25.4 and you have millimeters. My careful efforts, repeated with several selfies (I had to remember to look off into the distance), found that center to center, my PD was 62.8mm. The assumption is that close up vision like reading, the pupils wiil be about 3mm closer together. For anything closer, you need custom glasses with a separate PD measurement.
The online system said 63mm, which is what 62.8mm rounds up to. You can\t get closer than that. Much more precise than someone in a eyeglass store holding a short mm gauge before your distance-focused eyes and moving their head back and forth, trying for a perfect 90 degree angle into the exact center of each pupil as you eyes try to avoid shifting, and their hand wanders slightly. The only thing lacking in the online process is the eye exam itself, where they have a machine and try different correction lenses and you tell them what looks better to each uncovered eye. That they can't duplicate.
What I did not know at the start is that the field involving vision correction has a lock on federal and state laws. They are unregulated and can charge whatever they want for eye exams, lenses, and frames. They even keep their own hours, and may have a separate entrance into their shop. Corporations like Walmart, Target, Sears, Lenscrafters, and such may enter into agreements or contracts with them, but can do little to nothing to control their management, prices, or practices.
And the staff is paid on commission, meaning spike the price when and where you can. and sell the customer on upgrades like anti-glare, non-reflective, scratch resistant, tinted, or a different, more expensive lens material. One of the best optical materials is simply referred to as plasric, and is 1/4th the cost of the next material up the ladder. They won't quote you a price up front, unless you insist on knowing. If this happens, they may quote you a orice per lens, so that when you try to settle up, those treatments cost you twice as much as you were quoted. People pay because they need the glasses, feel they are committed, or think they are paying what everybody else pays. True on one, false on the other two.
You can try on franes online as well. You can user the existing lens width - bridge width - temple length engraved somewhere on your existing frams, or you can be fitted online using a selfie photo without glasses or getting a shot with your webcam. Nobody has asked for a profile to determine temple length though. which is from the front outer edge of the frame all the way to the tip of the end where it falls behind your ear. Since heads tend to be round. they can roughly estimate temple length based on a front view of your head and something like a credit/debit card to judge distance by. Some sites prefer to see the card held in front of your mouth. All prefer the white side forward to more distinctly determine the width across. To work with machines, credit, debit, ATM, and other cards have to have a uniform size, and almost everybody has one or the other. As found online with a search:
"The size of credit cards is 85.60 × 53.98 mm (3.370 ×2.125 in) and rounded corners with a radius of 2.88–3.48 mm, in accordance with ISO/IEC 7810#ID-1, the same size as ATM cards and other payment cards, such as debit cards."
The best prices are online, and this even goes back before there was an internet, at least 85 years back. Back then it was word of mouth, ads, telephone calls, and smail. My family could go into NYC, visit one of these places, have an eye exam done, and be out with new glasses within an hour. The company occupied a whole floor of a building on Wall Street and was looking to expand.
I quit going when I joined the military and started getting it all for free. If you are a military retiree or Vet and want to go the free government route, I would not bother. Scheduling is hard, getting approval even harder, and you get three ugly frame choices with lacks to each one. And no special treatments for the lenses. Dependents have no eyeglass coverage through the government, unless you are some kind of person with special needs, like living below the poverty level and a child whose future is at risk because you can't see to read. No programs exist for the elderly, who won't be around that long, and whom nobody cares about, the kids all having families of their own to care for, or whom know that they can't deal what is really wrong with you, like aging, becoming sixkly, and dying.
(5) I see we are on the verge of extending human life to 1,000 years or more, and much of that time we will be fit and vigorous, Like we aren't overcrowding this earth enough already, and there isn't a long enough line for available jobs. What are we going to have to do, work 500 years to earn enough to retire on for another 500 years and more? We live with inflation, at an ongoing rate, and government spending out of control, and hust imagine the swelling of the government welfare programs as there are too many bodies and not enough opportunities to go around. Imagine going to a paradise resort and finding it crowded with the equivalent of 58 years of normal vacationers. You think our cities and highways are packed now? TGhere wull be no comparison. And every year you live your earned retirement slips further in value as inflation continues to run its course.
What's going to happen is that government is going to step in, and long life will be regulated and controlled so that only the brightest, most gifted, most attractive, most wealthy, and most powerful will have access to it. There is no other way it can work. But there will be a blaxk market in the knowledge and means to make it happen, and that is going to really cause some problems. Most thinking people reject the idea of getting high on drugs or alcohol, preferring an uncluttered and uncompromised mind that can deal with facts.
But a lot of people are ready to get high on the prospects of long life for themselves and their loved ones. Only life here on earth will lose its appeal. However the prospects of converting large asteroids to interstellar space homes and vehicles, then taking generations to scoot off to other solar systems may seem appealing. Lot's of solitude, lot's of time, and just getting there is the goal.
Just a few things I thought to share. Hard to find a place to share them from though. At least with spots like this, I find thinking people that want answers, which I did provide. In some cases for questions not yet asked, But when you don't know something, how do you know that you don't know it? Or that you don't know that you don't know it? The answer is most often a chance encounter. Unsought, unplanned for, if it happens it happens. Maybe this is your chance encounter for the day.