LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-04-2019, 10:12 AM   #1
rijo79
LQ Newbie
 
Registered: Oct 2013
Posts: 8

Rep: Reputation: Disabled
Boot problem with /boot partition on usb stick


So here's what I'm trying to do:

I've left some free space on the main ssd of my laptop so I want to install a second distro there in an encrypted LVM and put the /boot partition on a USB stick so that the stick is needed to boot the system, otherwise it boots into the main Debian system on the ssd without any indication that there is another OS on this computer...

I'm using Parrot OS which is based on Debian so has a very similar installer. I've created a new partition with encrypted LVM in the free space on the ssd for / and swap in logical volumes and created a 1GB partition on a USB stick for /boot and set the mount points accordingly in the partitioner. And I did set the bootable flag on /boot. During install, I'm asked if I want to install GRUB to the MBR of the first disk. I choose 'no' and get a list of devices to choose manually where to put it. I choose the USB drive with /boot on it...

Trying to boot the system after install, I open the boot menu in the firmware and choose the USB drive. From here, apparently, no bootable device is found so it boots the main Debian system instead...

I've read of systems being setup this way in the past and thought it wouldn't be problematic but something isn't working and the computer will not boot the new OS. Did I miss something or is it not possible to boot a system configured this way?

Thanks in advance.
 
Old 09-04-2019, 02:08 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
I'm not following your plans exactly, but this may help:

The bios boots a usb drive by starting at the first sector, and the iso has to be able to handle that, and meet it with a kernel. If it encounters a partition table it will puke.

When you go through grub and try to load a kernel on the usb drive, that will puke. It's looking for an internal drive, and can't access the BIOS code. So it's a Catch-22. There's loads of threads here on this. Search them.
 
1 members found this post helpful.
Old 09-04-2019, 02:40 PM   #3
rayfward
Member
 
Registered: May 2009
Location: Leeds Uk
Distribution: Linux Mint 20.2
Posts: 136

Rep: Reputation: 17
Hi rijo79
It's an interesting concept. I cannot describe exact procedure on how to do it but the principle should be strait forward.
Go into the bios (Del,F2) and locate the boot order. Change the boot order from HD to USB. Your flash drive is searched first and HD next.
Grub. You say will installing another Linux distribution. In this case going through installation selecting manual (Partitioning the disk) will allow to select the disk to put grub on. In this case your USB flash drive. Now reboot and see what happens. At least one of your installations should come up. Using update-grub I gain access to external drives but I get multiple from grub which every time the kernel update I have to update-grub to get the boot options again.
See how it goes.
Regards
Ray
 
Old 09-04-2019, 02:56 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,981

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
Usually you can access grub on this flash drive to correct or find the bootable media. The problem I suspect is that when you installed your covert distro and tried to set the usb as loader and or /boot it now changed when you rebooted to select usb. Just fix your loader and maybe then off to other naming.

Grub(2) has a command line to select usually. Guess it is possible you are trying a different loader too.
 
Old 09-04-2019, 04:41 PM   #5
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
A separate partition - especially an encrypted one is a dead giveaway.

Why not have an encrypted main distro which contains a differently encrypted hidden data volume?
You could give away the keys to the main distro without necessarily compromising your hidden vault.
 
Old 09-04-2019, 04:51 PM   #6
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
Is this an efi system? If yes create two partitions on the usb.
The first a 300mb partition fat32 flagged as esp mounted at /boot/efi. The second an ext4 partition at least 512mb mounted at /boot
 
Old 09-05-2019, 03:08 PM   #7
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
I also do not fully understand your issue.
What I understood is that you can boot into grub on your USB stick, but not into the encrypted partition.

What I recall it's that you can use the grub commands line to get the current disks and partitions. You could check if it is there.
If it is not recognized by grub you might need to increase grub's awareness of other position types.
It used to have multiple stages of the bootloader in which the later stages are bigger and support more different peripherals.

If grub is aware of the partition and you can issue a boot command that fails, you might want to look into initial ram disks (initrd).
 
Old 09-06-2019, 07:54 AM   #8
rijo79
LQ Newbie
 
Registered: Oct 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
Welp, got it fixed... Here's how:

I setup a recovery environment while logged into the Debian system by mounting the encrypted partition and boot partition first, then mounting needed parts of the Debian system into the mounted root partition for the disabled system.. For the encrypted partition, I simply opened it in a file manager and was prompted for the encryption key and my root password. The rest is as follows, using the UUID of the encrypted partition:

Code:
mount /dev/sdc1 /media/rijo/(UUID)/boot

mount --bind /dev /media/rijo/(UUID)/dev
mount --bind /sys /media/rijo/(UUID)/sys
mount --bind /proc /media/rijo/(UUID)/proc
mount --bind /run /media/rijo/(UUID)/run
Using the UUID of the partition, I chrooted into the partition with:

Code:
chroot /media/rijo/(UUID)
Then ran:

Code:
grub-install /dev/sdc
update-grub
update-initramfs -uk all
I then rebooted, chose the USB drive from the boot menu and it worked... An important detail is that you install GRUB to /dev/sdc, not /dev/sdc1.. It goes to the MBR, not the first partition...

It seems the installer just isn't capable of setting up GRUB properly in this manner and it just needs a re-install after completing the system install...

Last edited by rijo79; 09-06-2019 at 08:07 AM.
 
2 members found this post helpful.
Old 09-06-2019, 03:12 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,981

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
" An important detail is that you install GRUB to /dev/sdc, not /dev/sdc1."

Loaders and installers have been subjecting linux users to this problem for decades. There usually is some advanced install path on top end distro's to be more precise on all locations.
 
  


Reply

Tags
boot failure, debian 10, grub 2, usb boot



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Android on a Stick, or how to install Android-x86 on a USB stick LXer Syndicated Linux News 0 03-28-2015 05:10 AM
Mounting a bootable USB stick makes the stick non-bootable PeterSteele Red Hat 6 03-15-2013 01:44 PM
Hauppauge wintv-hvr h006 - dvb-t tuner - usb-stick - hybrid tv stick Xeratul Linux - Hardware 5 12-23-2012 09:47 AM
LXer: Installing "Sugar on a stick" (Strawberry Release) On A USB Stick LXer Syndicated Linux News 0 08-04-2009 03:50 PM
mount/umount usb stick - PQI Intelligent Stick 2.0 sandbag Linux - Software 5 05-06-2005 11:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration