LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How to install for USB booting (https://www.linuxquestions.org/questions/debian-26/how-to-install-for-usb-booting-4175611406/)

joboy 08-05-2017 09:22 PM

How to install for USB booting
 
Hi there,

I installed Debian 8 on an internal hard drive as usual, and I put the drive in an USB enclosure to transfer data to another PC, I forgot to change the boot sequence which was set to USB boot, and I successfully boot up the OS, it was not my intention but finding, so I decided to install a dedicated USB drive for portable boot and it has become my daily work drive I carry around, this way is far better than install USB flash boot, I can have much more space, at the same time I can use the hard drive for internal boot.

Recently I reinstalled the new Debian 9 the same way, but it won't boot on USB with this error :

"error : file '/boot/grub/i386-pc/normal.mod' not found
Entering rescue mode...
grub rescue>"

I also tried install to USB drive directly but same result, I am sure I installed the grub loader on the correct drive, I wonder if something has changed on the new version to prevent USB booting, I could use the USB flash boot install method but I still want to be able to boot 'both ways', any comment ?

AwesomeMachine 08-06-2017 09:15 AM

It looks like it could be an architecture conflict. Is one of the machines 32-bit?

IsaacKuo 08-06-2017 01:55 PM

Another possibility is that the Debian installer was used on an EFI boot system, and as such it installed the EFI boot files only (no i386-pc files - thus missing).

I'm not sure how the 32-bit vs 64-bit issue might play out, but...maybe? I mean, when I accidentally try to boot with initrd/vmlinuz mismatched with the main OS, it'll try to boot but a lot of hardware simply won't work - USB devices included. So, I could see some situation where maybe the bootloader wants to use 64-bit mode but...okay, I'm just out of my depth here. I don't know whether this sort of failure mode even makes sense.

Anyway, I'd first look to see if /boot/grub/i386-pc even exists. If not, then copying the files over from /usr/lib/grub/i386-pc may work (if it even exists there)...

colorpurple21859 08-06-2017 04:01 PM

What is on the prefix= line when
Code:

set
is ran at the grub rescue prompt? Maybe prefix= is pointing to the wrong location.

joboy 08-07-2017 11:41 AM

I put the non booting USB drive on my ThinkPad and it boots normally, although I installed it on a Dell desktop everything worked on the ThinkPad too ! I need to dig deep into the BIOS to see what could have caused the problem on the Dell. My previous install was done on the ThinkPad, and it booted no problem on the Dell, the only difference was the OS version slightly older I can not recall exactly the detail.

colorpurple21859 08-07-2017 12:29 PM

maybe the disk/boot order of the internal drive and usb changes for some reason

joboy 08-08-2017 02:03 AM

I reinstall the OS on the ThinkPad via USB, when I boot it on the Dell I got different error :

error : invalid arch-independent ELF magic.
Entering rescue mode...
grub rescue>
grub rescue> set
cmdpath=(hd0)
prefix=(hd0,msdos1)/boot/grub
root=hd0,msdos1

I then check the BIOS on the Dell but couldn't find anything that could have caused this problem, it is a Pentium Dual Core E5400, where the ThinkPad is with an i5.

IsaacKuo 08-08-2017 03:53 AM

This error indicates it is related to EFI boot or something like that. The relevant BIOS settings would be to enable MBR booting and/or disable secure boot EFI (at least on USB).

Alternatively, your problem might be fixed by booting up on the ThinkPad and installing grub-efi:
Code:

apt-get install grub-efi
I enable traditional boot on my computers; I think even newer computers generally allow traditional boot at least on USB devices (as a possible setting in the BIOS).

AwesomeMachine 08-08-2017 06:10 AM

The problem can be caused by installing Debian on a machine set for UEFI boot, and then booting with the machine set to BIOS boot. So, the problem is probably solved by setting all machines concerned to BIOS boot.

This demonstrates that a portable drive is probably not reliable to boot on all machines without some adjustment.

joboy 08-09-2017 03:44 AM

I installed the portable drive on a ThinkPad T440p with win10 dual boot and secure boot disabled, I do not use grub to dual boot coz it doesn't work, I simple select boot drive via BIOS that worked perfectly. I occasionally boot windows and don't know if it will alter the secure boot, but as far as I can see on the BIOS secure boot stays disabled. I also installed grub-efi as suggested but that didn't change thing, or I need to alter some settings as well please advise. I know portable boot is not reliable I use it only for convenience, I also have a portable flash drive that boots on almost any computer w/o problem, but I did not install it as a hard drive but install with YUMI multi boot.

joboy 08-10-2017 04:04 AM

So can I modify the grub.cfg or something to make it boot properly ?

IsaacKuo 08-10-2017 08:49 AM

Honestly, I have only one computer that can even do secure boot, so I have little experience getting it to work. I simply did what AwesomeMachine suggested ages ago - I disabled secure boot on that one computer, and I just use BIOS boot on all computers.

Looking up EFI and UEFI boot on Debian, it looks really complicated to me and I don't really understand it. I think it would be best to go with AwesomeMachine's suggestion of disabling secure boot on all computers.

colorpurple21859 08-10-2017 09:32 AM

Quote:

So can I modify the grub.cfg or something to make it boot properly ?
It depends on if /boot/grub has either i386-pc or x86_64-efi directory and if your booting in efi mode or bios mode. If your booting in bios mode and have the /boot/grub/i386-pc/* directory, you should be able to boot from the grub command prompt . There is a chance that if the correct modules needed to access the partition filesystem that /boot/grub/ resides on are not built into the grub mbr bootloader will cause problems, but that doesn't happen very often. Some distros separate grub into grub-i386-pc and grub-x86_efi packages and will only allow to have one are the other installed on the system at a time.

joboy 08-11-2017 01:22 AM

I checked the non booting Dell and couldn't find anything related to Secure Boot, and my ThinkPad that used to install the portable drive already disabled Secure Boot. If I install the drive on the Dell w/o secure boot it should boot normally but that's not the case.

Quote:

Originally Posted by colorpurple21859 (Post 5746716)
It depends on if /boot/grub has either i386-pc or x86_64-efi directory and if your booting in efi mode or bios mode. If your booting in bios mode and have the /boot/grub/i386-pc/* directory, you should be able to boot from the grub command prompt . There is a chance that if the correct modules needed to access the partition filesystem that /boot/grub/ resides on are not built into the grub mbr bootloader will cause problems, but that doesn't happen very often. Some distros separate grub into grub-i386-pc and grub-x86_efi packages and will only allow to have one are the other installed on the system at a time.


joboy 08-11-2017 01:24 AM

I checked the non booting Dell and couldn't find anything related to Secure Boot, my ThinkPad that used to install the portable drive already disabled Secure Boot. If I install the drive on the Dell w/o secure boot it should boot normally on itself but that's not the case, I am referring to USB boot, SATA boot always work.

I checked the drive and find two folders, efi and grub amongst other files, there is nothing on the efi not even hidden files, and a grub.cfg on the grub folder, I wonder if "set root" has anything to do with the booting :

====================================================================================
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}

if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_msdos
insmod ext2
set root='hd4,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1 03122b4f-b8a6-4bb4-9560-eec9f6a5d68a
else
search --no-floppy --fs-uuid --set=root 03122b4f-b8a6-4bb4-9560-eec9f6a5d68a
===============================================================================================

Quote:

Originally Posted by colorpurple21859 (Post 5746716)
It depends on if /boot/grub has either i386-pc or x86_64-efi directory and if your booting in efi mode or bios mode. If your booting in bios mode and have the /boot/grub/i386-pc/* directory, you should be able to boot from the grub command prompt . There is a chance that if the correct modules needed to access the partition filesystem that /boot/grub/ resides on are not built into the grub mbr bootloader will cause problems, but that doesn't happen very often. Some distros separate grub into grub-i386-pc and grub-x86_efi packages and will only allow to have one are the other installed on the system at a time.



All times are GMT -5. The time now is 02:17 PM.