First, I have some strategic questions:
- Ubuntu installers automatically call grub-install in UEFI mode on UEFI hardware, even if I want to install grub2 on an external SSD. Can I avoid this, that is, use grub2 boot in the classic BIOS / MBR mode? In my case, Ubuntu 2019.04 was installed on an external SSD in MBR mode on a UEFI laptop and pointed to the EFI partition on the Windows GPT EFI partition (/ dev / sdb1) so that I could only boot Ubuntu on that same laptop or on a PC. with the same Windows GPT EFI partition.
- Can Grub2 work perfectly with MBR partition tables converted to GPT by gdisk and for which no space has been reserved for EFI or grub2 partitions? Is it necessary to move existing partitions to free space for UEFI or grub2 partitions at the beginning of the disk?
How can I tell grub2 to copy the contents of a UEFI Windows partition to an SSD (external) drive in a suitable form so that it can boot autonomously as an external SSD on another PC? / laptop without Windows? Copying the partition with cp, tar or dd and calling grub-install did not work for me until now – which resulted in the errors below. Should the removable flag be used for SSD?
-
Ideally, I would like to create a multiple boot system with Windows 10 and different variants of Linux, all bootable with grub2. How do I do this to work as smoothly as possible?
a) What should I do before installing Windows 10? Should I create a small GPT partition for grub2 and mark it as such? Do I have to create different EFI partitions, for example for Windows and different variants of Linux?
b) Do I need to install Windows 10 before any Linux or vice versa?
c) Is it possible to place an EFI partition in the logical partition space of an MBR SSD, eg. like / dev / sda5?
d) Should an EFI partition or a small GPT partition for grub2 be the first on the disk / SSD (as some conflicting sources claim)?
e) Is there a simple way to embed a / boot partition in the main Linux installation and inform grub2 about it? I think the difficulty, once grub2's installation works, is to adapt the grub.cfg file accordingly and copy the files together into one partition.
I'm trying to fix a broken boot grub2 in / dev / sdb with one of the recent versions of Ubuntu: I've prepared these statements:
Configuration: / boot = / dev / sdb1, / = / dev / sdb3, UEFI = / dev / sdb4 (is created by this script)
sudo fdisk /dev/sdb # possibly convert to GPT; create partition 4 of type EFI: code ef
sudo gdisk /dev/sdb # create partition 4 of type EFI: code ef00
sudo partprobe
sudo mkdir -p /tmp/lin1/mnt/boot
sudo mount -o nouuid /dev/sdb3 /tmp/lin1
sudo mount -o nouuid /dev/sdb1 /tmp/lin1/boot
sudo mkdir /tmp/lin1/mnt/boot
sudo mkfs.fat /dev/sdb4
sudo mkdir -p /tmp/lin1/mnt/efi
sudo mount -o nouuid /dev/sdb4 /tmp/lin1/mnt/efi
sudo mount -o nouuid /dev/sdb1 /tmp/lin1/boot
sudo bash -c 'for i in /dev /dev/pts /proc /sys /run /sys/firmware/efi/efivars /bin /usr /var /etc; do mkdir -p /tmp/lin1$i; done'
sudo bash -c 'for i in /dev /dev/pts /proc /sys /run /sys/firmware/efi/efivars /bin /usr /var /etc; do mount -o nouuid -B $i /tmp/lin1$i; done'
sudo chroot /tmp/lin1/
sudo grub-install --efi-directory=/tmp/lin1/mnt/efi --boot-directory=/tmp/lin1/boot --target=x86_64-efi /dev/sdb
sudo bash -c 'for i in /dev /dev/pts /proc /sys /run /sys/firmware/efi/efivars /bin /usr /var /etc; do umount /tmp/lin1$i; done'
sudo umount /tmp/lin1/mnt/boot
sudo umount /tmp/lin1/boot
sudo umount /tmp/lin1/
sudo sync
sudo hdparm -Y /dev/sdb
I am experiencing these 7 problems (these problems all occur occasionally after an installation almost identical to the one described above, depending on the host system, the Ubuntu version, the additional Windows 10 UEFI partition, and the the SSD is connected internally or externally):
-
At startup: A startup job is running for / dev / disk / by-uuid / …. (also
after adapting block identifiers in / etc / fstab)
-
Ubuntu systemd: Received SIGRTMIN + 20 from PID (plymouthd) **
-
Ubuntu kernel: ucsi_ccg 0-0008: PPM reset failed!
- Ubuntu kernel: ucsi_ccg 0-0008: PPM initialization failed (-110)
- Grub: Error: file '/grub2/i386-pc/normal.mod' not found – Entering rescue mode (normal installation Ubuntu 2019.04 x64 EFI
the directory is / grub / x86_64-efi)
-
Grub boot: **
Failed dependency for file system check under / dev / disk / by-uuid / CA82-D0E8
Dependency failed for / boot / efi
-
chroot: failed execution of command '/ usr / bin / bash': No file or directory of this type:
Problematic part:
soc1@soc1-MS-7B17:/bin$ sudo chroot /tmp/lin1/ /usr/bin/bash
chroot: failed to run command ‘/usr/bin/bash’: No such file or directory
soc1@soc1-MS-7B17:/bin$ ll /usr/bin/bash
-rwxr-xr-x 1 root root 1113504 Nov 20 20:00 /usr/bin/bash*
soc1@soc1-MS-7B17:/bin$ ll /bin/bash
-rwxr-xr-x 1 root root 1113504 Jun 7 00:28 /bin/bash*
Diagnostic output:
soc1@soc1-MS-7B17:/bin$ strace -f chroot /tmp/lin1 /usr/bin/bash 2>&1
execve("/usr/sbin/chroot", ("chroot", "/tmp/lin1", "/usr/bin/bash"), 0x7fffe4c6c0f8 /* 62 vars */) = 0
brk(NULL) = 0x558749ead000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=74469, ...}) = 0
mmap(NULL, 74469, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fdf1d749000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "177ELF2113 3 > 1 260342 "..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2030544, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fdf1d747000
mmap(NULL, 4131552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fdf1d144000
mprotect(0x7fdf1d32b000, 2097152, PROT_NONE) = 0
mmap(0x7fdf1d52b000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7fdf1d52b000
mmap(0x7fdf1d531000, 15072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fdf1d531000
close(3) = 0
arch_prctl(ARCH_SET_FS, 0x7fdf1d748540) = 0
mprotect(0x7fdf1d52b000, 16384, PROT_READ) = 0
mprotect(0x55874974a000, 4096, PROT_READ) = 0
mprotect(0x7fdf1d75c000, 4096, PROT_READ) = 0
munmap(0x7fdf1d749000, 74469) = 0
brk(NULL) = 0x558749ead000
brk(0x558749ece000) = 0x558749ece000
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=10281936, ...}) = 0
mmap(NULL, 10281936, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fdf1c775000
close(3) = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/lin1", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
chroot("/tmp/lin1") = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0
read(3, "# Locale name alias data base.n#"..., 4096) = 2995
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=578, ...}) = 0
mmap(NULL, 578, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fdf1d75b000
close(3) = 0
write(2, "chroot: ", 8chroot: ) = 8
write(2, "cannot change root directory to "..., 43cannot change root directory to '/tmp/lin1') = 43
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
write(2, "n", 1
) = 1
close(1) = 0
close(2) = 0
exit_group(125) = ?
+++ exited with 125 +++