Difficulties in ubuntu

Source: Internet
Author: User

Statement

I recently accidentally found the author's personal website http://tiankonguse.com/many of the articles are reprinted by other websites, but the reprinted without declaring the source of the article or reference from the http://tiankonguse.com/website, therefore, the author adds this statement.

Solemnly declare: This record "ubuntu system difficult" Reprinted from the http://tiankonguse.com/this record: http://tiankonguse.com/record/record.php? Id = 677

Preface

I think of that sentence again. Since I have chosen to do this, I have to be ready to bear all the costs of doing this.

The entire boot partition is deleted due to an incorrect memory and operation.

An unintentional Undo operation causes a system dependency error.

Text background

Let's talk about the background first.

My computer has three systems installed: ubuntu12.04, ubuntu14.04 and centOS.

Ubuntu12.04 is a system I have been using. It took at least a year to install and use the system.

Ubuntu14.04 this system is overwritten when I delete windows.

CentOS has been installed for six months.

Now my ubuntu12.04 system has insufficient disks, so I want to delete the other two systems.

So I made a USB flash drive GParted software.

View partition information
Sda1 is the primary partition (previously windows7, but it is actually ubuntu14.04 ). Sda3 is my d disk in ntfs format. Sda4 is an ext4 format partition (boot partition ). Sda5 is a swap partition. Sda6 is an ext4 format partition (ubuntu 12.04 partition) sda7 is an ext4 format partition (Home partition ). Sda8 is a swap partition. Sda9 is an ext4 partition (centOS system ). Sda10 is a swap partition.
First misoperation

When I saw these partitions, I remembered one thing. When I installed ubuntu14.04, I separated the boot, home and root partitions to ensure system security.

So I decisively deleted the sda8 and sda4, and then I thought it would be useless to swap the partitions, so I also deleted the three swap partitions. For the home partition, I want to see if it is, after all, there may be important files.

So the system shut down and restarted, and then experienced a long-overdue grub rescue error.

New grub Error

The first row has an error.

/grub/i386pc/normal.mod not found.

Fortunately, I used to encounter this error many times, so found the record http://tiankonguse.com/record/record.php? Id = 194.

However, when insmod/boot/grub/normal. mod is executed, the system prompts that normal. mod cannot be found.

Fortunately, I tried to use insmod normal try, unexpectedly succeeded, the original current system, changed to/boot/grub/i386-pc/normal. mod.

Then I happily executed the normal command.

After the command is executed, the system prompts

error symbol 'grub_term_highlight_color' not found。

How can this happen?

Use 360 to search.

Find this forum (http://forum.ubuntu.org.cn/viewtopic.php? (T = 458570 ).
It is a system bug. You need to use the live system to reinstall grub2.

I made a USB flash drive for ubuntu.
Then copy the boot in the USB flash drive to my ubuntu 12.04 system.
After the instance is started, it is still grub rescue. After using the above method, it actually enters the USB flash drive system.
Grub has not been updated.

The following error is prompted during the update:

ubuntu@ubuntu:~$ sudo update-grub/usr/sbin/grub-probe: error: failed to get canonical path of /cow.ubuntu@ubuntu:~$ sudo grub-install /dev/sdaPath `/boot/grub' is not readable by GRUB on boot. Installation is impossible. Aborting.
Then I found a method on a ubuntu Forum (http://askubuntu.com/questions/197833/recovering-from-grub-rescue-crash)

Core commands
Sudo mount/dev/sdXY/mntsudo grub-install -- root-directory =/mnt/dev/sdXWhere/dev/sdX is the disk where Ubuntu is installed, and/dev/sdXY is the partition on the disk where Ubuntu is installed. in other words,/dev/sdXY contains/boot and so on. use fdisk-l to verify the Ubuntu installation location. but when I run the command, the prompt is displayed.
Ubuntu @ ubuntu :~ $ Sudo mount/dev/sda/mntmount:/dev/sda already mounted or/mnt busy see various solutions in the bug forum, you can go and have a look (https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1289977 ).
sudo fdisk -lAnd find your Ubuntu partition (should be /dev/sda1 if it is the first partition)sudo mount /dev/sda1 /mntsudo mount --bind /sys /mnt/syssudo mount --bind /proc /mnt/procsudo mount --bind /dev /mnt/devsudo chroot /mntNow reinstall Grub2sudo apt-get install --reinstall grub2
Blkid: view the UUID of each partition

At this point, I suddenly realized a problem. I am a USB flash drive, not a live system, and the files in it are naturally incomplete.

So I tried to fix another system and the result was okay.

Then go to the system and copy all the boot directories.

After you restart the system, you can access the new system.

Manually set partitions

At this point, I realized a problem. My old system has three partitions: Root partition, boot partition, and home partition.

There must be a place to store the three partitions and store them there.

Run this command

tiankonguse@tiankonguse:~$ sudo vi /etc/fstab
You can see the mount point of the partition.

The following is the content I fixed

# /etc/fstab: static file system information.## Use 'blkid' to print the universally unique identifier for a# device; this may be used with UUID= as a more robust way to name devices# that works even if disks are added and removed. See fstab(5).## <file system> <mount point>   <type>  <options>       <dump>  <pass># / was on /dev/sda1 during installationUUID=65a7fc16-a481-4f77-97b6-59731143f930 /               ext4    errors=remount-ro 0       1# swap was on /dev/sda12 during installation#UUID=7b08a45e-34f2-4ea2-900e-579c5a3bddca none            swap    sw              0       0# swap was on /dev/sda6 during installation#UUID=99d228d4-f996-4970-ba48-f6950e3a0b69 none            swap    sw              0       0# /home was on /dev/sda7 during installationUUID=aef790b3-32e8-4060-8542-bafeedcbac98 /home           ext4    defaults        0       2

You can use the blkid mentioned above to query the UUID.

tiankonguse@tiankonguse:~$ sudo blkid/dev/sda1: UUID="65a7fc16-a481-4f77-97b6-59731143f930" TYPE="ext4" /dev/sda5: LABEL="E" UUID="3816A47016A43134" TYPE="ntfs" /dev/sda6: UUID="aef790b3-32e8-4060-8542-bafeedcbac98" TYPE="ext4"

If you set it as needed, the home directory of the old system will be mounted to the new system.
According to this method, after I mount/mnt on the old system, modify the content of/mnt/etc/fstab and modify the corresponding items.
Then execute

sudo update-grub2

Then restart it.

Well, at least now I can go to ubuntu12.10.

New system problems

Wait, isn't it ubuntu12.04? How does it become ubuntu12.10.

Well, the background is incomplete.

At first, it was the ubuntu12.04 system. During the period before the partition was deleted, I upgraded it with the command line. I thought it would be upgraded to ubuntu14.04. Who knows it was just upgraded to ubuntu12.10.

The New grub problem is also caused by this new system.

The first time I enter the new system, I feel uncomfortable.

The resolution is relatively large, and the computer is very stuck.

Okay, I will upgrade it to ubuntu13.04 again.

So I run the upgrade command again.

Cancel system upgrade

The network speed is still very powerful, and the required file packages will soon be downloaded, but the installation time is very slow and slow. I remember it took several hours to upgrade from ubuntu12.04 to ubuntu12.10, and now it's noon, so I cruelly closed the window.

Then I close my computer and take a nap.

As soon as I woke up, my computer couldn't enter the desktop. After logging on to the desktop, the screen was black and there was only one mouse.

Then I use ctrl + alt + F1 to access the terminal. Fortunately, I can log on to the terminal. Unfortunately, I executed several cleanup commands.

sudo apt-get autoremovesudo apt-get autoclean

Then there was a lot of dependency problems. Fortunately, I have three previous dependency records.

A universal solution to dependency conflicts when installing software

Source issues: The following software packages have dependency that cannot be met
Various solutions: software packages are not fully installed or uninstalled

All attempts by that method are failed.

Then I try to manually install the dependency packages that do not exist.

So we first direct the error information to the file.

tiankonguse@tiankonguse:~$ sudo apt-get -f install > error 2>&1
Find a computer, search for the corresponding package on packages.ubuntu.com, and then store the package on the USB flash drive.

Run the following command to install

sudo dpkg -i *.deb
If the dependent versions are incorrect, I will change them to the appropriate values in/var/lib/dpkg/status.

Finally, I was prompted that it was correct.

Then I upgraded and installed several files and finally went to the desktop.

Returns to the bank

In fact, this is the next day.

I suddenly asked myself why I had a new ubuntu14.04 system attached to this old system and could mount the home directory. What else do I want?

I am quietly saying that I have installed a lot of software.

Okay, so execute

dpkg --get-selections > installed-software.log
Then enter the new system and unmount the old system.

Then recover the backup.

sudo dpkg --set-selections < ~/installed-software.log && apt-get dselect-upgrade

Then update the source and the NO_PUBKEY prompt is displayed.

Then find the corresponding method

Simply put, only three steps are required. Assume that the key is C2518248EEA14886.

sudo gpg --keyserver keyserver.ubuntu.com --recv C2518248EEA14886sudo gpg --export --armor C2518248EEA14886 | sudo apt-key add -sudo apt-get update 

Then when I poured into the package, I had to unload some files, I took a look at the installed-software.log, found some is deinstall, So I replaced with vi

:%s/deinstall/install/

A prompt is displayed during import.

dpkg: warning: package not in database at line 1086: lynx

Then I found the method here.

sudo apt-get install dselect$ sudo dselect    -> Update   -> Install

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.