2

I'm trying to install Ubuntu overwriting Windows on a Lenovo ideapad 320 (151IAP). I'm booting off a usb stick created using startup disk creator and an 18.04 image.

This will be a long post, because I've tried quite a few different things, but my hypothesis was that I have a working install of ubuntu and I just need to get it to boot properly; I'm not so sure that's the case anymore. Here is my latest boot-repair output.

Update: I tried booting from grub using these instructions and got errors "can't find /root in /etc/fstab" and "mounting /dev on /root/dev failed: No such file or directory" and same with run. Also, I saw that the /home/dustan/ directory is empty. I'm not really sure how the directory system is supposed to look after a proper install, so correct me if I'm wrong: this seems to me to be evidence against my hypothesis that I only need to repair grub. I tried making the usb stick using mkusb instead of the default startup disk creator; it still hangs on installing grub.

Here's the full story:

The first problem I ran into was the installer hanging on "configuring hardware". I eventually figured out how to disable secure boot and fast boot, per the advice given here, and the installer no longer hangs there.

Instead it hangs at Grub2, so I followed the advice given here (after several failed attempts) to specify the Ubuntu partition (sda2) separate from the boot partition (sda1). It still hung on Grub2 (didn't bypass it, so I'm not really sure what that answer was actually getting at).

In both the configuring hardware and the Grub2 hang cases, I have given the computer literally hours to install properly.

When I look at the log in the installer, it shows repeated instances of "invalid report id data", associated to using the touchpad. There is indeed a known problem with this touchpad and Ubuntu's drivers, but the touchpad has been working in spite of these errors, and I figure if I can ever actually get Ubuntu working I can likely deal with the driver problem later. And unfortunately these errors are probably obscuring any actual crippling errors.

So after many attempts to get that to work properly, I finally decided to attempt to repair Grub.

Before I list boot-repair errors, I forgot to mention another thing that I tried while installing in the midst of the above; once I figured out how to modify the boot line, I tried noacpi, nolapic, irqpoll, and noapic (I was somewhat using this as a reference, but I still had no idea what I was actually doing).

If I follow the recommended repair in boot-repair, it hangs without giving any feedback.

If I disable SecureBoot under advanced options in boot-repair and then run the recommended repair, it will set itself to purge grub, and then it says "Please open a terminal and type the following commands:"

sudo chroot "/mnt/boot-sav/sda2" dpkg --configure -a
sudo chroot "/mnt/boot-sav/sda2" apt-get install -fy
sudo chroot "/mnt/boot-sav/sda2" apt-get purge -y grub*-common grub-common:i386 shim-signed

Running the first command gives:

ubuntu@ubuntu:~$ sudo chroot "/mnt/boot-sav/sda2" dpkg --configure -a
Setting up grub-efi-amd64-signed (1.93+2.02-2ubuntu8) ...
Installing for x86_64-efi platform.
grub-install: error: efibootmgr failed to register the boot entry: Unknown error -1.
dpkg: error processing package grub-efi-amd64-signed (--configure):
 installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 grub-efi-amd64-signed
ubuntu@ubuntu:~$

I didn't expect the second command to work, but I tried it anyway, and it hung after this:

ubuntu@ubuntu:~$ sudo chroot "/mnt/boot-sav/sda2" apt-get install -fy
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 43 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up grub-efi-amd64-signed (1.93+2.02-2ubuntu8) ...
Installing for x86_64-efi platform.

Trying the terminal method here, the instructions for a separate boot partition are kind of vague, but here was my interpretation:

ubuntu@ubuntu:~$ sudo mkdir /mnt/ubuntu
ubuntu@ubuntu:~$ sudo mkdir /mnt/ubuntu/boot
ubuntu@ubuntu:~$ sudo mount /dev/sda1 /mnt/ubuntu/boot
ubuntu@ubuntu:~$ sudo grub-install --boot-directory=/mnt/ubuntu/boot /dev/sda
Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists.
ubuntu@ubuntu:~$ sudo umount /mnt/ubuntu/boot

Another terminal method.

ubuntu@ubuntu:~$ sudo mount /dev/sda2 /mnt
ubuntu@ubuntu:~$ sudo mount --bind /dev /mnt/dev && sudo mount --bind /dev/pts /mnt/dev/pts && sudo mount --bind /proc /mnt/proc && sudo mount --bind /sys /mnt/sys
ubuntu@ubuntu:~$ sudo chroot /mnt
root@ubuntu:/# grub-install /dev/sda
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
root@ubuntu:/# exit
exit
ubuntu@ubuntu:~$ sudo umount /mnt/sys && sudo umount /mnt/proc && sudo umount /mnt/dev/pts && sudo umount /mnt/dev && sudo umount /mnt

Trying again with sda1.

ubuntu@ubuntu:~$ sudo mount /dev/sda2 /mnt
ubuntu@ubuntu:~$ sudo mount /dev/sda1 /mnt/boot
ubuntu@ubuntu:~$ sudo mount --bind /dev /mnt/dev && sudo mount --bind /dev/pts /mnt/dev/pts && sudo mount --bind /proc /mnt/proc && sudo mount --bind /sys /mnt/sys
ubuntu@ubuntu:~$ sudo chroot /mnt
root@ubuntu:/# grub-install /dev/sda
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
root@ubuntu:/# exit
exit
ubuntu@ubuntu:~$ sudo umount /mnt/sys && sudo umount /mnt/proc && sudo umount /mnt/dev/pts && sudo umount /mnt/dev && sudo umount /mnt/boot && sudo umount /mnt

One more.

ubuntu@ubuntu:~$ sudo mount /dev/sda2 /mnt
ubuntu@ubuntu:~$ sudo mount /dev/sda1 /mnt/boot
ubuntu@ubuntu:~$ sudo mkdir -p /mnt/boot/efi
ubuntu@ubuntu:~$ sudo mount /dev/sda1 /mnt/boot/efi
ubuntu@ubuntu:~$ sudo mount --bind /dev /mnt/dev
ubuntu@ubuntu:~$ sudo mount --bind /proc /mnt/proc
ubuntu@ubuntu:~$ sudo mount --bind /sys /mnt/sys
ubuntu@ubuntu:~$ sudo chroot /mnt
root@ubuntu:/# apt-get install grub-efi-amd64
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 
root@ubuntu:/# sudo dpkg --configure -a
Setting up grub-efi-amd64-signed (1.93+2.02-2ubuntu8) ...
Installing for x86_64-efi platform.
grub-install: error: efibootmgr failed to register the boot entry: Unknown error -1.
dpkg: error processing package grub-efi-amd64-signed (--configure):
 installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 grub-efi-amd64-signed
root@ubuntu:/# exit
exit
ubuntu@ubuntu:~$ sudo umount /mnt/dev
ubuntu@ubuntu:~$ sudo umount /mnt/proc
ubuntu@ubuntu:~$ sudo umount /mnt/sys
ubuntu@ubuntu:~$ sudo umount /mnt/boot/efi
ubuntu@ubuntu:~$ sudo umount /mnt/boot
ubuntu@ubuntu:~$ sudo umount /mnt
  • 1
    You show Ubuntu installed to ESP - efi system partition. But the efibootmgr boot order still shows Linpus Lite as first in boot order. Use f12 or whatever key in UEFI chooses boot order and select the Ubuntu entry. If you have Boot-Repair, you do not need chroot methods. And you must mount efi partition (ESP) and only install the UEFI version of grub, not grub-pc which is for BIOS boot. See man efibootmgr for details, but you can delete the old UEFI entry with sudo efibootmgr -b XXXX -B where XXXX is entry you want to delete, or probably 0003. Use efibootmgr -v to confirm boot order. – oldfred May 21 '18 at 19:47
  • @oldfred That's strange, I see that the pastebin shows 0003 first, but when I listed efibootmgr -v just now, it showed 0000 first. sudo efibootmgr -b 0003 -B caused a segfault. – Dustan Levenstein May 21 '18 at 22:13
  • @oldfred It looks like the bootorder must have come from some of my boot repair efforts, and it was reset after I rebooted. – Dustan Levenstein May 21 '18 at 22:14
  • If you boot Ubuntu entry in UEFI mode, does it boot? Since only one install, it will not show grub menu by default. Can you get grub menu if you press escape after UEFI screen, but before grub finishes. If UEFI fast boot is on, you may not have time to press any key. What brand/model system? What video card/chip? – oldfred May 21 '18 at 22:34
  • @oldfred I think my computer is using bios actually? When I hit F2 at the startup screen I get the bios menu, where I've disabled both secure and fast boot as mentioned in the question. – Dustan Levenstein May 21 '18 at 22:39
  • @oldfred Okay, I think I understand that my bios settings are set to use UEFI, and presumably that's a normal way of doing things? "lspci | grep VGA" gives "00:02.0 VGA compatible controller: Intel Corporation Device 5a85 (rev 0b)". Here is a link to the output of "sudo lshw | grep product >brand_model.txt". I don't know how to install UEFI grub instead of grub-pc; when I was using boot-repair, I already had the two partitions delineated, which some websites indicate that's all you really need to do there. – Dustan Levenstein May 22 '18 at 00:16
  • @oldfred When I boot without the usb stick, it goes straight to the grub commandline. I don't know what is meant by "If you boot Ubuntu entry in UEFI mode, does it boot?" - how would I go about doing that? – Dustan Levenstein May 22 '18 at 00:18
  • You are default booting something. The UEFI boot menu is a separate key you press, often f10 or f12, you have to check manual. Many systems mention which keys to get into UEFI or boot menu on UEFI boot screen. But if fast boot is on in UEFI, you may not see a screen. See http://askubuntu.com/questions/869091/updated-ubuntu-and-it-messed-up-grub Some Lenovo have locked boot order setting. Some have Optimized Defaults. You may want to review all settings. Many Lenovo seem to need a work around like: http://askubuntu.com/questions/486752/dual-boot-win-8-ubuntu-loads-only-win/486789#486789 – oldfred May 22 '18 at 03:33
  • @oldfred Okay, F12 takes me to a boot manager which lists "ubuntu (ST1000LM035-1RK172)" and "EFI PXE Network". The former will take me to Grub, and the latter looks for media before redirecting me to Grub. The USB stick shows up as "Linpus lite (SanDisk)". – Dustan Levenstein May 22 '18 at 05:13
  • @oldfred Attempting to add a new UEFI hard drive boot entry, the command sudo efibootmgr -c -L "UEFI Hard drive" -l "\EFI\Boot\bootx64.efi" gave me a segfault. Same if I replace the backslashes with forward slashes - not sure whether that was a typo? I'll keep trying some of those workarounds - I think I have some understanding of what they're getting at. Thanks! – Dustan Levenstein May 22 '18 at 05:30
  • Boot-Repair should have copied shimx64.efi to be /EFI/Boot/bootx64.efi which is the fallback or hard drive boot entry. It used to be just for external drives, but then UEFI updated for internal drives also. If copied can you boot a hard drive entry. The PXE is a network boot. Since I never use that, I turn that off in UEFI, so system is not looking at network just to boot. – oldfred May 22 '18 at 13:48
  • @oldfred If I tried to boot from grub using these instructions, and got the errors "can't find /root in /etc/fstab" and "mounting /dev on /root/dev failed: No such file or directory" and same with run, am I correct in believing that means Ubuntu isn't properly installed and I should work on that? My /home/dustan/ directory is also empty, which seems to be another piece of evidence that my hypothesis that I only needed to fix grub was incorrect. – Dustan Levenstein May 31 '18 at 01:49
  • Do not confuse an ESP - efi system partition or your sda1 with a /boot partition. They are totally different. Your chroots seems to be using sda1 as /boot when it has to be mounted as the efi partition. Use Boot-Repair in UEFI mode and run the full uninstall/reinstall of grub and check the install of newest kernel also. – oldfred May 31 '18 at 03:29
  • @oldfred I feel like all of your suggestions have been starting with the assumption that I know these things well enough to figure out what to do from a vague description in words, and everything I've said has pretty clearly indicated that I really have no idea how anything works at this level at all. I'm just playing guessing games and searching the web. When I tried to boot from grub, it didn't work. Does that not mean that I need to figure out how to install Ubuntu properly, in a manner that doesn't hang on grub? – Dustan Levenstein May 31 '18 at 03:47
  • @oldfred re "Use Boot-Repair in UEFI mode" if that is done by specifying a /boot/efi partition under "GRUB location", that is what I have been doing. I'm trying again, I'll let you know if the result is any different, but I pasted detailed error messages from my original attempts in the question. – Dustan Levenstein May 31 '18 at 04:03
  • @oldfred I think boot-repair is just hanging on "Reinstall GRUB" now. My latest pastebin. – Dustan Levenstein May 31 '18 at 04:21
  • @oldfred Oh yeah, I forgot about the secure boot thing. When I disable that, I get exactly the same issues as before: It pops up a window telling me to run "sudo chroot "/mnt/boot-sav/sda2" dpkg --configure -a", and doing so gives an Unknown error -1. – Dustan Levenstein May 31 '18 at 04:30
  • Are you able to boot into grub menu with your hard drive entry? Some systems just have to use that "fallback" or hard drive entry. They violate UEFI spec that says not to use description and do not allow "ubuntu". Other work around is to change description of ubuntu entry. See IV:.Sony, HP & others workarounds: http://askubuntu.com/questions/486752/dual-boot-win-8-ubuntu-loads-only-win/486789#486789 – oldfred May 31 '18 at 13:27
  • @oldfred I haven't been able to see the grub menu without USB, no. I can only reach the GRUB command line. Is the advice you gave in that link geared specifically toward dual boots? I did try making a boot manager labeled Windows boot manager at one point, it didn't seem to fix anything. – Dustan Levenstein May 31 '18 at 15:29
  • I am still seeing your Linpus Lite as default boot 0003? Are you able in UEFI boot menu select Ubuntu or in UEFI change default boot order? – oldfred May 31 '18 at 20:35
  • @oldfred I did notice that; it seems to switch 0003 to the front when I've attempted a boot-repair. When I select Ubuntu in the UEFI boot menu, I get the Grub command line. – Dustan Levenstein May 31 '18 at 21:05
  • Which are you getting? grub> or grub rescue> ? Report is not showing grub.cfg in your install, even though one in ESP which is a configfile to the full grub.cfg in your install? does the full reinstall of grub & kernel also fail with Boot-Repair? – oldfred May 31 '18 at 22:43
  • @oldfred just grub>. As far as I can remember, boot-repair isn't able to reinstall grub either, but I'll see if I can get any more insight on those two issues later tonight my time when I get back to the computer in question; I wasn't aware that boot-repair was capable of reinstalling the kernel? – Dustan Levenstein May 31 '18 at 22:51
  • Boot-Repair does or has you type in a chroot. With that you can update system from inside it. Boot-Repair does not work in all cases, but does with most standard desktop configurations. – oldfred May 31 '18 at 23:30
  • @oldfred "Purge kernels then reinstall last kernel sda2" appears to be hanging. – Dustan Levenstein Jun 01 '18 at 02:41
  • @oldfred I'll be on chat if you happen to be around while I'm still up. No big if not. – Dustan Levenstein Jun 01 '18 at 02:42
  • 1
    There should be arabbit-hole tag. – Nonny Moose Jun 04 '18 at 22:24

2 Answers2

1

The solution was simple: change the bios settings: boot mode to legacy support, boot priority to legacy first. Then reinstall Ubuntu and it worked.

0

I would suggest a manual install using debootstrap.

Boot from the usb drive or rescue cd, then run:

apt update && apt install --yes debootstrap gdisk linux-headers-$(uname -r)

Find out the ID for your HDD, always use ID and not sda, sdb etc.

ls /dev/disk/by-id/

Delete old partitions and create new ones using fdisk (Search Linux Partitioning Scheme on Google)

Mount the root partition to /mnt

Install the OS: (download the latest debootstrap)

wget http://ftp.de.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.88_all.deb

dpkg -i debootstrap_1.0.88_all.deb
rm debootstrap_1.0.88_all.deb
apt install ubuntu-archive-keyring
chmod 1777 /mnt/var/tmp
debootstrap xenial /mnt

chroot into the OS:

mount --rbind /dev  /mnt/dev
mount --rbind /proc /mnt/proc
mount --rbind /sys  /mnt/sys
chroot /mnt /bin/bash --login

ln -s /proc/self/mounts /etc/mtab

install a text editor:

apt install nano

edit /etc/apt/sources.list and add:

deb http://archive.ubuntu.com/ubuntu xenial main universe deb-src http://archive.ubuntu.com/ubuntu xenial main universe

deb http://security.ubuntu.com/ubuntu xenial-security main universe deb-src http://security.ubuntu.com/ubuntu xenial-security main universe

deb http://archive.ubuntu.com/ubuntu xenial-updates main universe deb-src http://archive.ubuntu.com/ubuntu xenial-updates main universe

Setup keyboard language and locale:

apt update
locale-gen en_US.UTF-8
echo 'LANG="en_US.UTF-8"' > /etc/default/locale
dpkg-reconfigure tzdata

Install Ubuntu:

apt install --yes ubuntu-minimal
apt install --yes --no-install-recommends linux-image-generic

Set a password:

passwd

Install GRUB: Install GRUB to the disk(s), not the partition(s)!

apt update
apt install --yes grub-pc

(do not install grub, yet)

Edit /etc/default/grub

  • Comment out: GRUB_HIDDEN_TIMEOUT=0
  • Remove quiet and splash from: GRUB_CMDLINE_LINUX_DEFAULT
  • Uncomment: GRUB_TERMINAL=console
  • At the line GRUB_CMDLINE_LINUX add net.ifnames=0

Then Run:

update-grub

grub-install /dev/disk/by-id/YOUR HDD ID

if you have more HDD's install grub on them too!

Should say:

Installing for i386-pc platform. Installation finished. No error reported.

Now time for reboot:

exit
reboot

reboot -f (if it doesn't want to reboot)

You will now hopefully be inside a minimal Ubuntu.

From there you want to configure Swap and install all the programs you want. And install a sudo user so that you do not run as root.

Z3TA
  • 1