LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 09-29-2018, 08:55 AM   #1
Fazolette
LQ Newbie
 
Registered: Sep 2018
Posts: 1

Rep: Reputation: Disabled
Install Debian on external drive (postable install with bootloader included)


Hello,

I have a 2TB external USB on which I would like to install Debian on one of the partition. This is what I have done:

1) With Gpart I have resized and created a 200GB free partition
2) I booted on Debian live usb, and chosen the install
3) II chosen the "Manual partitioning" option and selected my free partition on my external HDD
- it created for me the root / (ext4) and a swap partition on that 200GB free partition I had
4) Then the install went through with success. I was a bit puzzled because it did not ask me where to install the boot loader ??

After I restarted my Macbook (on which I had installed rEFind) and can see it added the "Debian" entry and I can boot on my Debian perfectly.

Now, however, If I plug this external HDD on an other Macbook I have (Still with rEFind on it), I cannot see the Debian entry en the boot menu


So my question is, Did I forget to do something ? Is it possible to have a fully portable Debian install on my external HDD so that I can plug it in any computer and boot on it ?

Thank you!
 
Old 10-01-2018, 11:51 AM   #2
masinick
Member
 
Registered: Apr 2002
Location: Greenville, SC
Distribution: Debian, antiX, MX Linux
Posts: 636
Blog Entries: 16

Rep: Reputation: 104Reputation: 104
If you put this external drive on another system, you will have to add a boot entry that reflects the organization and naming convention on that system. Note that it MAY be different than the other system, so first find out what the other system uses as the name I the disk and the partition order, then edit the boot entry to reflect this information.

It may be similar or completely different depending on how each system recognizes and names its devices and partitions.
 
Old 10-01-2018, 05:36 PM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,503

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
I've never used a Mac so I'm not sure how this would work. With a standard PC, you would have a separate EFI partition. Do you have an EFI partition on the Mac? On a PC, the EFI partition would likely be on the primary drive and the EFI files for Debian would be placed there rather than on the external drive. If Macs are similar, you would also need an EFI partition on the secondary drive on which you installed Debian. You could use the Debian install usb to check the external drive for an EFI partition or the Mac drive. Hopefully, someone familiar with Macs will see your post.
 
Old 10-01-2018, 07:19 PM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
I've never used the Debian LiveCD, so I don't know for sure how it does an install - I have, however, used the standard Debian installer netinst CD many times. Most of my experience is with old fashioned PC clone type hardware with traditional MBR installs. I have one Mac, though, and I have done some UEFI type installs.

My experience with my Mac Mini is that I did NOT want to modify the internal drive's bootloader at all. Since I had no experience with EFI installs, I didn't want to mess things up. Especially since I had no idea how I might rescue the Mac's OSX bootloader if I screwed things up.

So, I decided to boot Debian using an external USB drive instead. At the time I did my first install, this was before Debian had really good EFI support, so it asked me what sort of bootloader I wanted to do. I specified grub on the USB drive, which worked...sort of.

Okay, here's an annoying thing about Macs. Apple does not let us specify a boot order, so there is no way to make the system boot a USB bootloader by default! You MUST press "alt" when the screen is grey, and hold it just right so that it will bring up a boot menu - at which point I can manually select the "Windows" USB drive to boot from. This is very annoying, but I live with it.

The fact that you don't mention anything like this means that you're booting from the internal drive's EFI bootloader.

Here's where my experience with UEFI type installs comes in handy. I have noticed that on the latest Debian installers, it does NOT ask you where you want to install the bootloader, if it detects UEFI. It'll just install a Debian menu choice on the internal drive's EFI bootloader. This is okay, if you never want to boot up your USB drive on any other computer. But if you do want to boot up your USB drive from another computer? Whoops, you're out of luck!

Okay, so that's annoying. But you can fix things! You want to install GRUB on your USB drive, so it has its own bootloader and can boot up on any computer (not just Macs - it'll work on other computers also). The basic steps are:

Code:
1) Boot up to your Debian install

2) Open up a terminal, and log in as root with "su" (or "sudo su" if you have an Ubuntu style install - that's an option for recent versions of Debian, for better or worse).

3) Install the grub package with:

apt-get install grub-pc

4) Update the grub menu with:

update-grub

5) Install the bootloader onto the MBR of your USB drive with:

grub-install /dev/sdb
Note that I'm assuming your USB drive is /dev/sdb. Make sure this is correct! You can confirm this with the following command:

Code:
fdisk -l
This will list all of the connected drives. Study the output of "fdisk -l" very carefully to ensure you are installing the GRUB bootloader onto the correct device.

At this point, your Debian install will be able to boot up on other computers.

However, since your other computer is a Mac, life is still not so simple. You'll need to press and hold the "Alt" or Apple key to bring up a boot menu when you boot up. Then, you'll see the USB drive as a "Windows" drive to boot from.
 
Old 10-03-2018, 02:33 AM   #5
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,808
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
Quote:
Originally Posted by IsaacKuo View Post
Okay, here's an annoying thing about Macs. Apple does not let us specify a boot order, so there is no way to make the system boot a USB bootloader by default! You MUST press "alt" when the screen is grey, and hold it just right so that it will bring up a boot menu - at which point I can manually select the "Windows" USB drive to boot from. This is very annoying, but I live with it.
It is infuriating, unintuitive, and unnecessary. Once rEFInd is installed, a boot menu is automatically produced that by default preselects the last booted OS.
 
Old 10-03-2018, 04:26 AM   #6
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by mrmazda View Post
It is infuriating, unintuitive, and unnecessary. Once rEFInd is installed, a boot menu is automatically produced that by default preselects the last booted OS.
I may just do that, since I've been using my Mac Mini exclusively for linux for years now.

My only concern is the ease with which I can return the Mac Mini to a pure stock state. Right now, it's extremely simple - I just remove the USB thumbdrive (which has a GRUB boot entry to RAMBOOT off of an nfs share...custom initrd and stuff).

If I install rEFInd, then I'd need some way to return the internal hard drive's bootloader to its original stock state. The following discussion thread seems to describe a way to do this, although it seems to apply to if you installed a (GRUB) MBR rather than restoring EFI after installing rEFInd.

http://hints.macworld.com/article.ph...91111185717745

I'm just wary because of my lack of familiarity, and because I burned myself with doing stuff without being 100% familiar with how OSX does things differently. I originally did a dual boot install by shrinking the OSX partition and making an ext3 partition for Debian in the space created. I did not know there wouldn't be a way to grow the OSX partition later, after I decided the slow 2.5" hard drive was bogging down the system (MUCH faster to run off an nfs shared SSD, and even faster to run off an internal tmpfs ramdisk). I eventually sorted things out, but it was a painful experience.

So, if I knew 100% how to definitely return the MacOS bootloader to its original state, I'd be a lot more comfortable with changing it.
 
Old 10-03-2018, 05:20 AM   #7
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
during the partitioning stage create an efi partition on the external drive and set it's mount point to /boot/efi
 
Old 10-03-2018, 11:45 AM   #8
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,808
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
Quote:
Originally Posted by IsaacKuo View Post
if I knew 100% how to definitely return the MacOS bootloader to its original state, I'd be a lot more comfortable with changing it.
Maybe read the uninstallation instructions for rEFInd?
 
1 members found this post helpful.
Old 10-03-2018, 01:46 PM   #9
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by mrmazda View Post
Thanks for the tip! Wow, what a rabbit hole. It looks like the installation process would be the more complex part; if I figure out the installation process, then reversing the steps shouldn't be as hard.

Reading around, it looks like my strategy would be to copy my customized initrd and vmlinuz onto the vfat EFI partition itself (on this Mac Mini, this is simply /dev/sda1 on the internal 2.5" hard drive). Then, I can fashion a custom menu entry something like this:

Code:
menuentry DebianNFSRamboot {
    icon /EFI/refind/icons/debian.png
    volume ???
    loader /EFI/refind/vmlinuz.pxe
    initrd /EFI/refind/initrd.pxe
    options "root=/dev/nfs nfsroot=192.168.1.1:/srv/nfs/snow rw quiet"
}
I'm not sure what to put for "volume" or even if that line would be necessary at all if the vmlinuz and initrd files are on the EFI partition itself.

But in any case...I'm getting a bit more comfortable with the whole idea.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian install running KDE can't see external DVD-RW drive KYJazzyJeff Linux - Hardware 8 06-25-2018 03:14 PM
How to install bootloader to partition after install; use Windows bootloader to boot Xenphor Fedora 3 07-27-2013 11:56 PM
problem with installing debian onto external hard drive/grub bootloader error "21" mf93 Linux - Software 5 07-22-2009 06:10 PM
How do I install a bootloader to a USB Flash Drive? pxumsgdxpcvjm Linux - General 6 04-06-2008 09:55 AM
Cannot install bootloader on hard drive?? turnbui Linux - Software 3 07-08-2006 06:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 08:11 AM.

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