[solved] USB Stick Bootloader Problems

Kernels & Hardware, configuring network, installing services

[solved] USB Stick Bootloader Problems

Postby verrain » 2018-05-07 20:41

Hello Guys,

I'm an advanced beginner regarding to Debian, but relative new regarding to Linux booting from USB.

While the installation I had problems while installing grub, so I skipped that. When I'm starting my laptop now, I can boot from efi file, and then everything is fine. But the USB Stick can't boot automatically. Few days ago I tried to boot this stick from an old windows 7 desktop pc, but my stick was not found in the boot manager, and on this old PC, there was no option to boot from grub.

The stick is sdb and here my outputs from lsblk

Code: Select all
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465,8G  0 disk
├─sda1        8:1    0  1023M  0 part
├─sda2        8:2    0   360M  0 part /boot/efi
├─sda3        8:3    0   128M  0 part
├─sda4        8:4    0   451G  0 part
├─sda5        8:5    0   903M  0 part
├─sda6        8:6    0  10,4G  0 part
└─sda7        8:7    0     2G  0 part
sdb           8:16   1  29,4G  0 disk
├─sdb1        8:17   1   512M  0 part
├─sdb2        8:18   1  21,7G  0 part /
└─sdb3        8:19   1   7,2G  0 part [SWAP]
mmcblk0     179:0    0    29G  0 disk
└─mmcblk0p1 179:1    0    29G  0 part


sdb1 is the efi partition. But I want, that sdb2 will be boot automatically. I tried several things to install manually the bootload while installation, but nothing works and i tried to install the bootloader via syslinux with several commands, but it's still not booting automatically. Please help me.

Thanks a lot
Last edited by verrain on 2018-05-09 22:41, edited 1 time in total.
verrain
 
Posts: 3
Joined: 2018-05-07 19:58

Re: USB Stick Bootloader Problems

Postby bw123 » 2018-05-07 21:25

I don't think you can make the usb boot automatically on every system. That is controlled by each system bios or efi implementation?

I don't really have any experience running a usb install. I did that for a short time but not on any efi systems. The better way to do it would maybe be a debian live system with persistence?
User avatar
bw123
 
Posts: 3392
Joined: 2011-05-09 06:02
Location: TN_USA

Re: USB Stick Bootloader Problems

Postby verrain » 2018-05-08 08:21

Yeah, I have also a live system (but without persitence) and this boot automatically without problems.

But what should be the difference? Why can the live system boot automatically and the non-live version not? I mean this shouldn't be a question of the kernel or os? Rather it should be a question of the bios boot settings and the installed boot properties by programs like syslinux, I thought.

Nevertheless thx for your answering
verrain
 
Posts: 3
Joined: 2018-05-07 19:58

Re: USB Stick Bootloader Problems

Postby p.H » 2018-05-08 09:40

verrain wrote:I had problems while installing grub, so I skipped that

Which problems ?
verrain wrote:When I'm starting my laptop now, I can boot from efi file, and then everything is fine.

Then it looks like you did not completely skip the installation of GRUB.
What EFI path/file do you select ?

You say that sdb1 is the EFI partition on the USB stick, but the installation in sdb2 does not use it : it uses sda2 as the EFI partition instead.
What is installed on sda ?

This is obviously an EFI installation. In order to boot in EFI mode from a USB stick, you must :
- Use the EFI partition on the stick, i.e. mount it on /boot/efi. Replace the UUID of sda2 with the UUID of sdb1 in /etc/fstab, unmount and remount /boot/efi.
- Install GRUB EFI in the "removable device path" (default boot loader) on the USB stick with
Code: Select all
grub-install --removable


Note that GRUB EFI can only boot on a UEFI machine with EFI boot enabled. In order to boot on a BIOS machine or UEFI machine with EFI boot disabled and legacy boot enabled, you must install a BIOS boot loader such as GRUB PC :
- install the package grub-pc-bin
- install the boot loader with
Code: Select all
grub-install /dev/sdb # assuming sdb is the USB stick

Notes :
- If the USB stick has a GPT partition table (which I do not recommend), you'll have to create a small (100 kB to 1 MB) partition with type "BIOS boot" before installing GRUB PC to allow embedding, or add the --force option to allow using blocklists.
- Some BIOS firmwares require that a partition in the legacy DOS partition table of the MBR has the boot flag set. With GPT, you must set the boot flag on the protective GPT partition, not on a real partition. Unfortunately, some UEFI firmwares won't boot in EFI mode if the boot flag is set, because it is considered invalid per the GPT specification. This is why I recommend against GPT on a USB drive intended for booting on most PCs.
p.H
 
Posts: 595
Joined: 2017-09-17 07:12

Re: USB Stick Bootloader Problems

Postby verrain » 2018-05-08 22:18

Which problems ?


There was no specification, the installer said only, that the grub installation failed.

You say that sdb1 is the EFI partition on the USB stick, but the installation in sdb2 does not use it : it uses sda2 as the EFI partition instead.
What is installed on sda ?


Ah, that's interesting. I saw already during the installation, that this can not be correct. I remember that I've tried it once in my several experimentations tries, to mount it manually to sdb1. But their was another mounting problem with the cdrom, that I had solved also with manually mounting to read in the install cdrom and manually umounting after installing the base system and before installing the system components. Only then the installation did work. So I think, when I fixed these cdrom problem, I dot take care of this bootloader mounting problem.

sda is the hard drive of the HP Laptop, that I used for installation (but I loaded the Installation from mmcblk0p1, which is a SD-Card.

The /etc/fstab said me:
Code: Select all
# /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/sdb2 during installation
UUID=549ed166-0445-47cf-ae97-ac100d3d3f9c /               ext4    errors=remoun$
# /boot/efi was on /dev/sda2 during installation
UUID=0C61-9D54  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/sdb3 during installation
UUID=4f71c1e1-0dbe-41ef-87b7-7a0b66912150 none            swap    sw           $
/dev/mmcblk0p1  /media/cdrom0   udf,iso9660 user,noauto     0       0


So here we can see, that you're right: It boots from false drive and false partition due to presets from installation.

Thx a lot, I will try your suggestions now, and answere then, if everything is fine :)

edit:
Great, this was a professional and perfect solution! It boots now automatically.

Thx you a lot for your help!
verrain
 
Posts: 3
Joined: 2018-05-07 19:58


Return to System configuration

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable