URL: <https://savannah.gnu.org/bugs/?57282>
Summary: Multiple Linux (Debian/Ubuntu 2018/2019, CentOS, Fedora) grub2 2.04 Installation and Booting Problems Project: GNU GRUB Submitted by: thomaspoetter Submitted on: Wed 20 Nov 2019 10:23:07 PM UTC Category: Booting Severity: Major Priority: 5 - Normal Item Group: Software Error Status: None Privacy: Public Assigned to: None Originator Name: Originator Email: Open/Closed: Open Discussion Lock: Any Release: Release: Git master Reproducibility: Intermittent Planned Release: None _______________________________________________________ Details: First, I have some strategic questions: 1. The Ubuntu installers automatically invoke grub-install in UEFI mode on UEFI hardware, even if I want to install grub2 on an external SSD. Can I avoid this, i.e. use the legacy BIOS/MBR-mode grub2 booting? In my case, Ubuntu 2019.04 installed itself on an external SSD in MBR mode on an UEFI laptop and pointed the EFI partition to Windows’ GPT EFI partition (/dev/sdb1) so that I can only boot Ubuntu on that same laptop or on PCs with the same Windows GPT EFI partition. 2. Can grub2 cope flawlessly with MBR partition tables that were converted by gdisk to GPT and for which no space was reseved for EFI or grub2 partitions? Is it required to move existing partitions to make space for UEFI or grub2 partitions at the beginning of the disk? How can I tell grub2 to copy to an (external) SSD disk the contents of a Windows UEFI partition in an adapted form so it can boot in standalone boot as external SSD on a different PC/Laptop without Windows? Copying the partition with cp, tar or dd and calling grub-install did not work for me so far – resulting in the errors below. Must the flag --removable be used for an SSD? 3. Ideally, I would like to create a multi-boot system with Windows 10 and different Linux variants – all bootable by grub2. How do I do this to run 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? Should I create different EFI partitions, e.g. for Windows and the different Linux variants? b) Should I install Windows 10 before any Linux or vice versa? c) Is it possible to put an EFI partition into the logical partition space on an MBR SSD, e.g. as /dev/sda5? d) Must an EFI partition or a small GPT partition for grub2 be the first one on the disk/SSD (as some contradictory sources claim)? e) Is there an easy way to integrate a /boot partition back into the main Linux installation and telling grub2 about it? I figure that the hard way – once the grub2 install works – is to adapt the grub.cfg file accordingly and copying the files together into one partition. I’m trying to repair a broken grub2 boot in /dev/sdb with any of the recent Ubuntu versions: I 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 run into these 7 problems (these problems all occur occasionally after pretty much the same grub-install as shown above, depending on host system, Ubuntu version, additional Windows10 UEFI partition present and if the SSD is connected internally or externally): 1. At boot time: a start job is running for /dev/disk/by-uuid/…. (also after adapting the block ids in /etc/fstab) 2. Ubuntu systemd: Received SIGRTMIN+20 from PID (plymouthd)** 3. Ubuntu kernel: ucsi_ccg 0-0008: failed to reset PPM! 4. Ubuntu kernel: ucsi_ccg 0-0008: PPM init failed (-110) 5. Grub: error: file ‘/grub2/i386-pc/normal.mod’ not found - Entering rescue mode (the normal Ubuntu 2019.04 x64 EFI install directory is /grub/x86_64-efi) 6. Grub boot:** Dependency failed for File System Check on /dev/disk/by-uuid/CA82-D0E8 Dependency failed for /boot/efi 7. chroot: failed to run command ‘/usr/bin/bash’: No such file or directory: 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, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\34\2\0\0\0\0\0"..., 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 +++ _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?57282> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/