Tag Archives: grub

Grub cannot be started after Linux is installed

Why can’t you stop buying 618?From the technical dimension to explore>>>

After using unetbootin to make a startup USB disk and install Linux, there is a problem in the installation process. After restart, it will display:
error: invalid arch independent elf magic.
grub rescue & gt

The solution is as follows:

After booting with USB flash drive

1. Check the partition

sudo fdisk -lu /dev/sda

The display is as follows:

Disk /dev/sda: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0xde6c93b8

Device Boot Start End Blocks Id System

/dev/sda1 63 58589054 29294496 83 Linux

/dev/sda2 58589184 976773119 459091968 5 Extended

/dev/sda5 58591232 967903231 454656000 83 Linux

/dev/sda6 967905280 976773119 4433920 82 Linux swap/Solaris

2. Mount the system as a partition of Linux

Sudo mount/dev/sdax/MNT # x is the partition where/is located

Sudo mount/dev/sdax/MNT/boot ᦇ when/boot is a separate partition

If there is no/MNT/boot, you can use MKDIR to create it

3. Repair grub

sudo grub-install –root-directory=/mnt /dev/sda

References:

http://blog.sina.com.cn/s/blog_ a2d4803001013vqk.html

When there is no file or command when using grub install, try the following methods:
reason: grub does not find the command file in the partition where the system is located
1. Restart grub save # the error message is error: file not found
2. Use set command to view prefix and root
3. Use LS command to view hard disk partition # display (HD0, msdos1)
(HD0, Msdos1) is equivalent to sda1, and so on
4. Find the location of the system and grub command file one by one on the hard disk partition
system search: LS (HD…)/# be careful not to lose ‘/’
# if there are many system files in the result, it may be the partition where the system is located
# but in most cases, because the partition has been selected when installing the system, Therefore, this step is mainly to verify the
grub command file search: LS (HD…)/boot/grub
?If there are a large number of mod files, it is the location of grub command file
5. According to the results of the previous step, set prefix and root
set prefix = (HD…)/boot/grub # grub command file location
set root = (HD…) # system file partition
6 Insmod normal # load normal module
7, normal # enter normal mode
8, insmod Linux # load Linux command module
9, Linux/boot/vmlinuz -… Root =/dev/sdxy ro # load Linux core
# vmlinuz -… File should be in system file/boot, you can use tab to automatically complete
# sdxy is the partition of the system, such as sda1. It should be determined according to the previous search results
# do not lose the last ‘ro’
10, initrd/boot/initrd -… # load initrd
11, boot # start the system
12, the previous changes are not actually written to grub, so you need to save the settings in the boot system
you can use updata grub and grub install to repair

Reference materials:
1 https://help.ubuntu.com/community/Grub2/Troubleshooting

Attachment: in addition to the above methods, you can use boot repair
boot repair is a grub repair tool with graphical interface
it is recommended to download ISO file, burn boot disk or make boot U disk
for specific information, please refer to: https://help.ubuntu.com/community/Boot-Repair

Ubuntu Resolution Change xrandr Failed to get size of gamma for output default

1.Questions

Version information description: Ubuntu 16.04 lts

After installing Ubuntu, resolution and display do not match . The xrandr command cannot give relevant information. So we tried different methods.

2.Xrandr — addnewmode

This is the most frequently answered method on stackoverflow

gtf 1920 1080 60

1920×1080 resolution, 60Hz refresh rate

So you get a modeline:

"1920x1080_60.00"  172.80  1920 2040 2248 2576  1080 1081 1084 1118  -HSync +Vsync

Copy this line and run it

xrandr --newmode "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync

Add one more:

xrandr --addmode VGA1 "1920x1080_60.00"

Here, vga1 can be HDM and others (have no idea about this)

Finally:

xrandr --output VGA1 --mode "1920x1080_60.00"

But their own is to run xrandr can not give a response, there are errors. So it doesn’t work.

3.xorg.conf

1 sudo vim /etc/xorg.conf

Copy the following:

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
        HorizSync   28.0 - 70.0
        VertRefresh     56.0 - 75.0
EndSection


Section "Device"
        Identifier  "VMware SVGA"
        Driver      "vesa"
EndSection


Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes     "1920x1080_60.00"
        EndSubSection
EndSection

: WQ! (save)

Restart and it’s successful.

4.Postscript

You also see a way to change the grub startup file. But it didn’t work for me.