LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-13-2017, 01:44 PM   #1
bilkay
LQ Newbie
 
Registered: Aug 2006
Location: Hopewell Junction, NY
Distribution: RedHat 9 (Shrike)
Posts: 23

Rep: Reputation: 0
How to make thumbdrive bootable


I've copied an upgraded system (ubuntu 16.04) to a thumbdrive and want to make it bootable. I mount the thumbdrive (/dev/sdc1) and chroot to it. I make necessary changes to /etc/fstab to mount the thumbdrive as /. I then run mkinitramfs to create a new initrd.img-{version}. The problem is trying to install grub in /dev/sdc. When I try, I get "grub-install: error: cannot find a device for /boot/grub (is /dev mounted?)." In a normal installation, the fstype of /dev is udev, but I don't know how to make that happen in these circumstances. Any help will be appreciated.
 
Old 11-13-2017, 04:08 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 17,101

Rep: Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552Reputation: 2552
Most modern usb flash drives can be made bootable. Might take some steps. Can you see if syslinux will install?

Otherwise I'd remove internal hard drive and install Ubuntu from DVD to this usb and see if that works. A normal install. If it then boots correctly then maybe copy over your install.

Guess you could try reducing the original partition and use a clone program/distro.

Might try using grub command to install to the usb may assume you have the /sdb1 mounted maybe.
 
Old 11-13-2017, 09:27 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 12,776
Blog Entries: 17

Rep: Reputation: 3313Reputation: 3313Reputation: 3313Reputation: 3313Reputation: 3313Reputation: 3313Reputation: 3313Reputation: 3313Reputation: 3313Reputation: 3313Reputation: 3313
Have you looked at unetbootin?
 
Old 11-13-2017, 10:02 PM   #4
colorpurple21859
Senior Member
 
Registered: Jan 2008
Location: florida panhandle
Distribution: slackware64-current, puppy, ubuntu
Posts: 2,189

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
did you run the following before chroot?
Code:
mount --bind /dev /<sdc1 mountpoint>/dev
mount --bind /proc /<sdc1 mountpoint/proc
mount --bind /sys /<sdc1 mountpoint/sys

Last edited by colorpurple21859; 11-13-2017 at 10:06 PM.
 
Old 11-14-2017, 11:20 AM   #5
bilkay
LQ Newbie
 
Registered: Aug 2006
Location: Hopewell Junction, NY
Distribution: RedHat 9 (Shrike)
Posts: 23

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by colorpurple21859 View Post
did you run the following before chroot?
Code:
mount --bind /dev /<sdc1 mountpoint>/dev
mount --bind /proc /<sdc1 mountpoint/proc
mount --bind /sys /<sdc1 mountpoint/sys
Thanks! I should have remembered that - and would have 50 years ago. Now I have good news and bad news:

The good news: The mounts did what I wanted.

The bad news: grub-install didn't work - gave me the following errors:
Code:
grub-install: warning: your embedding area is unusually small.  core.img won't fit in it..
grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists.
Would this be possible with a newer thumbdrive?
 
Old 11-14-2017, 11:36 AM   #6
colorpurple21859
Senior Member
 
Registered: Jan 2008
Location: florida panhandle
Distribution: slackware64-current, puppy, ubuntu
Posts: 2,189

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Is this an efi system, is the usb gpt or msdos layout, are you installing to sdc or sdc1?
 
Old 11-14-2017, 12:04 PM   #7
bilkay
LQ Newbie
 
Registered: Aug 2006
Location: Hopewell Junction, NY
Distribution: RedHat 9 (Shrike)
Posts: 23

Original Poster
Rep: Reputation: 0
To answer my own question, judging by the reviews on a usb 3.0 flash drive at Best Buy, it is bootable.
 
Old 11-14-2017, 12:45 PM   #8
colorpurple21859
Senior Member
 
Registered: Jan 2008
Location: florida panhandle
Distribution: slackware64-current, puppy, ubuntu
Posts: 2,189

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
grub-install: warning: your embedding area is unusually small. core.img won't fit in it
Grub core.img is larger then the mbr boot loader space and grub uses the empty space between the mbr and the first partition for the core.img on a msdos disk installing grub-i386pc(legacy mode). A gpt disk doesn't have that empty space and have to create a small boot-bios partition for grub to install in legacy mode. Some partition tools don't leave enough space between the mbr and first partition to fit the core.img. Maybe try using syslinux or lilo as boot loader.
 
1 members found this post helpful.
Old 11-14-2017, 03:26 PM   #9
bilkay
LQ Newbie
 
Registered: Aug 2006
Location: Hopewell Junction, NY
Distribution: RedHat 9 (Shrike)
Posts: 23

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by colorpurple21859 View Post
Is this an efi system,
Are you referring to the flash drive?
Quote:
Originally Posted by colorpurple21859 View Post
is the usb gpt or msdos layout,
It came as vfat, reformatted as ext4.
Quote:
Originally Posted by colorpurple21859 View Post
are you installing to sdc or sdc1?
/dev/sdc
 
Old 11-14-2017, 04:15 PM   #10
bilkay
LQ Newbie
 
Registered: Aug 2006
Location: Hopewell Junction, NY
Distribution: RedHat 9 (Shrike)
Posts: 23

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by colorpurple21859 View Post
Grub core.img is larger then the mbr boot loader space and grub uses the empty space between the mbr and the first partition for the core.img on a msdos disk installing grub-i386pc(legacy mode). A gpt disk doesn't have that empty space and have to create a small boot-bios partition for grub to install in legacy mode. Some partition tools don't leave enough space between the mbr and first partition to fit the core.img. Maybe try using syslinux or lilo as boot loader.
Lilo certainly brings back memories. I'll give it a shot.
 
Old 11-15-2017, 12:56 PM   #11
bilkay
LQ Newbie
 
Registered: Aug 2006
Location: Hopewell Junction, NY
Distribution: RedHat 9 (Shrike)
Posts: 23

Original Poster
Rep: Reputation: 0
I couldn't apt-get lilo after chroot to /mnt so I installed it in the un-upgraded system and ran liloconfig. Following is the /etc/lilo.conf file with (most) changes I think I need. Not sure about the line "map = /boot/map". I'm guessing it might be "/mnt/boot/System.map-4.4.0-93-generic".


Code:
# /etc/lilo.conf  -   systemwide LILO configuration (LILO 23)
# details see in manpages: lilo(8) and lilo.conf(5)

# +-------------------------------------------------------------+
# |                        !! Reminder !!                       |
# |                                                             |
# | Don't forget to run 'lilo' after you make changes to this   |
# | conffile or you have installed a new kernel.                |
# +-------------------------------------------------------------+


# #################### LILO global section ######################

# With all newer systems (until year 2004) you can use the RAM
# above 15 MB. This option allows the use of this range of RAM.
#large-memory

# With all newer systems you can boot from any partition on disks 
# with more than 1024 cylinders. This option allows the use of 
# partitions above 1024 cylinders.
lba32

# Specifies the boot device.  This is where Lilo installs its boot
# block.  It can be either a partition, or the raw device, in which
# case it installs in the MBR, and will overwrite the current MBR.
# With newer kernel you should use the ID of the boot device, which
# can be found here: /dev/disks/by-id/ata*.
#boot = /dev/sdd
boot = /dev/disk/by-id/usb-SanDisk_Ultra_4C530001170919109453-0:0

# This option may be needed for some software RAID installs.
#raid-extra-boot = mbr-only

# Enable map compaction.  This tries to merge read requests for 
# adjacent sectors into a single read request. This drastically 
# reduces load time and keeps the map smaller.  Using 'compact' 
# is especially recommended when booting from a floppy disk.  
# It is disabled here by default because it doesn't always work.
#compact

# Set the verbose level for bootloader installation. Value range:
# 0 to 5. Default value is 0.
#verbose = 1

# Specifies the location of the map file. Lilo creates the (sector) 
# map file of direct sector addresses which are independent of any
# filesystem.
map = /boot/map

# ---------------------------------------------------------------

# Specifies the menu interface. You have the choice between:
#   text: simple text menu with black background and white text
#   menu: configurable text menu with background and text colors.
#   bmp:  graphical menu with 640x480 bitmap background.
install = menu

# A) Customized boot message for choice 'text'.
# For the simple text menu you can set an extra message in the 
# created file. Its text will be displayed before boot prompt.
#message = /boot/message.txt

# B) Configuration of the scheme for choice 'menu'.
# Use following coding: <text>:<highlight>:<border>:<title>
# The first character of each part sets the text frontcolor, 
# the second character of earch part sets the text backcolor,
# an upper-case character sets bold face text (frontcolor).
# i.g. 'menu-scheme=wm:rw:wm:Wm'. Possible colors: 
# k=black, b=blue, g=green, c=cyan, r=red, m=magenta, y=yellow, w=white.
menu-scheme = Wb:Yr:Wb:Wb
#menu-title = " DESDEMONA Boot-Manager "

# C) Configuration of the image for choice 'bmp'.
# For the graphical menu you need a bitmap file, which needs a special
# menu configuration in the file header (see: lilo -E). Ideally you 
# use one of the delivered images of the lilo package.
#   with 16 colors:    onlyblue, tuxlogo, inside
#   with 256 colors:   coffee
#   for Debian:        debianlilo, debian, debian-de
#bitmap = /boot/tuxlogo.bmp

# ---------------------------------------------------------------

# Specifies the number of deciseconds (0.1 seconds) how long LILO 
# should wait before booting the first image.  LILO doesn't wait if
# 'delay' is omitted or set to zero. You do not see the defined menu.
#delay = 20

# Prompt to start one certain kernel from the displayed menu.
# It is very recommeded to also set 'timeout'. Without timeout boot 
# will not take place unless you hit return. Timeout is the number
# of deciseconds (0.1 seconds) after there the default image will 
# be started. With 'single-key' alias numbers for each menu line can
# be used.
prompt
timeout = 100
#single-key

# ---------------------------------------------------------------

# Specifying the VGA text mode that should be selected when booting.
# The following values are recognized (case is ignored):
#   vga=normal    80x25 text mode (default)
#   vga=extended  80x50 text mode (abbreviated to 'ext')
#   vga=ask       stop and ask for user input: choice of text mode
#   vga=<mode>    use the corresponding text mode number. A list of  
#                   available modes can be obtained by booting with  
#                   vga=ask'  and then pressing [Enter].
# Another way is the use of frame buffer mode. Then the kernel 
# will switch from the normal vga text mode (80x25) to the frame
# buffer mode (if frame buffer support is in the kernel):
#   vga=0x314      800x600 @ 16 bit
#   vga=0x317     1024x768 @ 16 bit
#   vga=0x318     1024x768 @ 24 bit
#vga = ask
vga = normal
#vga = 0x317

# ---------------------------------------------------------------

# Kernel command line options that apply to all installed images go
# here.  See 'kernel-parameters.txt' in the Linux kernel 'Documentation'
# directory. I.g. for start into 'init 5' write:  append="5"
#append = ""
 
# If you used a serial console to install Debian, this option should be
# enabled by default.
#serial = 0,9600

# Set the image which should be started after delay or timeout.
# If not set, the first defined image will be started.
#default = Linux


# ################### LILO per-image section ####################

# Each image is configured with the linux kernel (=image) and
# usually with the initrd file. Configure all GNU/Linux systems
# on other partitions, too.

image = /mnt/boot/vmlinuz-4.4.0-93-generic
	label = "Linux"
	#root = /dev/sdd1
	root = "UUID=4822fb51-8757-4525-9cd4-0ff1e14582aa"
	read-only
#	restricted
#	alias = 1
#	optional
	initrd = /mnt/boot/initrd.img-4.4.0-93-generic

Last edited by bilkay; 11-15-2017 at 01:06 PM.
 
Old 11-16-2017, 01:43 AM   #12
mrmazda
Member
 
Registered: Aug 2016
Location: USA
Distribution: openSUSE, Knoppix, Mageia, Fedora, Debian, more
Posts: 300

Rep: Reputation: Disabled
Shrike is over 14 years old! If the original installation was done with it, and the original partition "CHS" configuration remains, it explains lack of room for core.img, a combination of inadequate space in the legacy "boot track", and sdc1 starting immediately following the "boot track" instead of leaving 1MB of freespace to permit bootloader code to overflow the "boot track". If you start installation from scratch (wiping the stick first) with any modern distro, its partitioner will leave unpartitioned space following the "boot track" for core.img to use. Using GPT instead of MBR partitioning after wiping is an alternative.

To keep the old installation in place and functional, instead of sdc, you could try installing Grub to sdc1, and setting sdc1 active/bootable. Ignore Grub's complaint about unreliability of blocklists, as I do, in multibooting many PCs. All mine have Grub installed, but none have it installed to an MBR. Boot here is always initialized from a primary partition (no GPT disks here).
 
1 members found this post helpful.
Old 11-17-2017, 03:40 PM   #13
bilkay
LQ Newbie
 
Registered: Aug 2006
Location: Hopewell Junction, NY
Distribution: RedHat 9 (Shrike)
Posts: 23

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by mrmazda View Post
Shrike is over 14 years old! If the original installation was done with it, and the original partition "CHS" configuration remains, it explains lack of room for core.img, a combination of inadequate space in the legacy "boot track", and sdc1 starting immediately following the "boot track" instead of leaving 1MB of freespace to permit bootloader code to overflow the "boot track". If you start installation from scratch (wiping the stick first) with any modern distro, its partitioner will leave unpartitioned space following the "boot track" for core.img to use. Using GPT instead of MBR partitioning after wiping is an alternative.

To keep the old installation in place and functional, instead of sdc, you could try installing Grub to sdc1, and setting sdc1 active/bootable. Ignore Grub's complaint about unreliability of blocklists, as I do, in multibooting many PCs. All mine have Grub installed, but none have it installed to an MBR. Boot here is always initialized from a primary partition (no GPT disks here).
Great! I ran fdisk to delete the first partition and then add a primary partition. I reformatted it and copied everything back to it and viola! I was able to install grub.

Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Installing newer version of Ubuntu without a bootable floppy or thumbdrive DrDwayne Ubuntu 5 07-09-2014 05:07 PM
[SOLVED] how to make a thumbdrive bootable centguy Linux - Software 14 01-09-2014 09:55 PM
Fedora 16 Custom Bootable Thumbdrive Step-By-Step macemoneta Fedora 2 04-15-2012 04:42 AM
LXer: Creating A Bootable Ubuntu USB Thumbdrive From Windows With uSbuntu Live Creato LXer Syndicated Linux News 0 04-24-2009 04:00 PM
How to make RH9 detect my usb Thumbdrive! novkhan Linux - Newbie 5 12-29-2005 09:55 PM

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

All times are GMT -5. The time now is 12:34 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration