LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-22-2017, 08:11 AM   #1
themakaris
LQ Newbie
 
Registered: Dec 2017
Posts: 4

Rep: Reputation: Disabled
Cannot run Debian from USB


I'm trying to run Debian 9 from a bootable USB but can't get it to load; the pc detects the USB and reports "Attempting to boot from USB" but then pretty much hangs, merely putting occasional sporadic random characters and small rectangular shapes onto the screen. If anybody is willing to offer any thoughts on cause or solution I'd be very grateful. This is what I've done:

I'm using a Windows 7 pc and, for clarity, have no access to a working Unix environment. [Nor, as may be obvious, have I ever installed or used Unix before.]

I created an installation disk under Windows using Rufus with the amd64 iso. This gave no problems and allows me to boot into the standard Debian Installation package; I have been using the Graphical Installation option, for simplicity, almost entirely with default options. Under the Guided Partition step I can select a second USB on my pc (in my instance "dev/sdc"), partition it, make the primary partition bootable, and install Grub into the MBR. All looks fine until I then try to use this second USB to boot Debian, which fails as described above.

I have re-run the installation routine multiple times, with different parameters for partitioning and file system, for example, but with no effect on the end result.

I have tried to investigate using the TestDisk utility from CGSecurity; this lets me view the contents of the USB from within Windows. The partitioning and directory structures look fine and grub configuration is there. Testdisk offers the option of rewriting the MBR with a "test" version; trying this option doesn't cure the problem, suggesting to me that the issue isn't with the MBR, but maybe with the Grub configuration or even some driver issue.

I would be grateful for any suggestions.
 
Old 12-22-2017, 09:07 AM   #2
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,399

Rep: Reputation: 1595Reputation: 1595Reputation: 1595Reputation: 1595Reputation: 1595Reputation: 1595Reputation: 1595Reputation: 1595Reputation: 1595Reputation: 1595Reputation: 1595
boot the installation usb, hit alt-f2 to open another terminal, with both usb's plugged in post the output of
Code:
fdisk -l
that is a small L

Last edited by colorpurple21859; 12-22-2017 at 09:08 AM.
 
Old 12-22-2017, 01:15 PM   #3
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,525

Rep: Reputation: Disabled
Sounds like grub may be looking for the system on the wrong partition.

Check the grub config file & make sure it is booting from sda1, which is what your boot drive is, (it is likely looking for the files on sdc1, which is where you initially installed it to).

Last edited by fatmac; 12-22-2017 at 01:16 PM.
 
Old 12-22-2017, 07:06 PM   #4
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Make sure that /boot/grub/grub.cfg and /etc/fstab are pointing at a valid location. Using UUIDs for this works better as device names can shuffle when connected to usb. root=UUID=abcdefga-... for grub and UUID=abcdefga-... for fstab, where root=/dev/... and /dev/... would otherwise be.

$ sudo blkid

Otherwise disable secure boot and enable CSM/Legacy, unless you did extra steps to make it UEFI friendly. For my new-ish HP laptops I had to delete UEFI keys for it to go USB boot.
 
Old 12-22-2017, 10:52 PM   #5
LinksysWRT54G
LQ Newbie
 
Registered: Dec 2017
Posts: 20

Rep: Reputation: 0
I'm gonna be controversial here and say that if you have never touched linux before then Debian (side note: it is the combined names of Debra and Ian if that gives you a clue on how to pronounce it) may or may not be very good to start with... Many users rank Debian as a "Medium" on the technical scale. It requires more under the hood work than the ones ranked easy.

If you want a user friendly linux try "Linux Mint" or maybe even "Kubuntu" both of these behave a tad bit more like windows or mac.
 
Old 01-01-2018, 01:43 AM   #6
themakaris
LQ Newbie
 
Registered: Dec 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks to all who replied - apologies for my delayed response.. Sadly, no success to report.

I have independently created a Debian Live boot USB which works perfectly. So that proves my pc will boot from USB and it does mean I can run Unix on my pc, which is helpful for diagnostics.

All references in grub.cfg on the original USB were indeed to /dev/sdc1, which I see can't be expected to work, but editing these to sda1, or sda2, or to the appropriate UUID parameter, haven't had any effect; similarly, changing references to "hd2, msdos1" as appropriate. In fact, it now seems to me, my system can't even be loading grub.cfg, since if it were I should be seeing the boot menu options listed in the grub.cfg scripts without there being any question yet of whether it can or can't then find vmlinuz... and initrd... ; isn't that true?

One thing may be relevant: the Debian Live boot USB is structured with an EFI file and partition; by contrast, the installation scripts for the Full Debian installation are creating standard partitions and a standard MBR on my USB. Given that my Hard Disk and Windows have always booted from Bios, surely thic can't be an issue?


fdisk -l gives the following (where sdb is the Live Debian boot and sdc the Full Debian disk we're discussing):

Code:
Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb006752f

Device     Boot    Start       End   Sectors   Size Id Type
/dev/sda1  *        2048  18814975  18812928     9G 27 Hidden NTFS WinRE
/dev/sda2       18814976 488394751 469579776 223.9G  7 HPFS/NTFS/exFAT

Disk /dev/sdb: 28.9 GiB, 31037849600 bytes, 60620800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x13358552

Device     Boot Start     End Sectors  Size Id Type
/dev/sdb1  *        0 4615775 4615776  2.2G  0 Empty
/dev/sdb2        1540    2371     832  416K ef EFI (FAT-12/16/32)


Disk /dev/loop0: 2 GiB, 2180808704 bytes, 4259392 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 28.9 GiB, 31037849600 bytes, 60620800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x62c0bd95

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sdc1  *        2048 50790399 50788352 24.2G 83 Linux
/dev/sdc2       50792446 60618751  9826306  4.7G  5 Extended
/dev/sdc5       50792448 60618751  9826304  4.7G 82 Linux swap / Solaris
 
Old 01-01-2018, 10:12 AM   #7
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,525

Rep: Reputation: Disabled
Perhaps the original downloaded file was corrupted, so didn't install properly - try downloading again. (There should be md5sum checksums where you download from.)

Else, try installing from a 'live' distro such as AntiX.
http://antix.mepis.org/index.php?title=Main_Page
 
Old 01-02-2018, 04:36 AM   #8
themakaris
LQ Newbie
 
Registered: Dec 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
Now solved - thanks for the suggestions and guidance. For completeness I'll just record the two things that seemed to go wrong. It did come down to the bootloader.

Firstly, in the section of the installation "Install the Grub Boot Loader on a Hard Disk" it seems to be important not merely to select the relevant USB - obviously! - in my case "/dev/sdc" - but to type that identity using the "Manual" option rather than merely to select the relevant entry as listed on the page of the installer. In my experience, doing the latter created an MBR with virtually no boot code and no reference at all to the GRUB bootloader. Doing this correctly does cause the Grub bootloader screen and menu options to load - though there is a very long pause - about one minute - before it does!

Secondly, even when you've got the MBR right, grub.cfg automatically records the source from which the linux system will be subsequently loaded as having the same name as the destination to which you wrote the installation. [This was inferred by fatmac above.] This doesn't necessarily work properly. In my case, I was writing the Debian system correctly onto /sdc (because /sda was my hard disk and /sdb was my installation USB) but, of course, when I subsequently attempt to boot Debian using the USB I have just written then, because the installation disk is no longer present, there is no longer any /sdc available to load the system from. As a temporary fix, I have simply edited the few references in grub.cfg directly (from /sdc to /sdb).
 
Old 01-02-2018, 05:24 AM   #9
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
If you use labels and uuids, you bypass that adjust to units / ports that have storage devices thing. In debian there's update-grub that generates the grub.cfg. This runs each time the kernel updates if you have grub installed. One caveat I found is that you should populate your /etc/fstab BEFORE installing grub to the MBR. Or manually install it again after you update /etc/fstab. If you use UUID=... (or LABEL=...) instead of /dev/... in your /etc/fstab it will use UUIDs automagically(when update-grub runs, and if you installed grub after updating /etc/fstab). At least on versions of debian less than a decade old.

The short answer is that /boot/grub/grub.cfg and /etc/fstab need to point at the same (and valid) place for it to be bootable. The UUID is partition specific, so if you go that route you can boot the drive on almost any computer with the same CPU type. With the /dev/ route, you plug in one too many storage device and you're rolling the dice if you can boot it at all.
 
Old 01-02-2018, 02:32 PM   #10
themakaris
LQ Newbie
 
Registered: Dec 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks.. I understand UUID but haven't really got my head round fstab yet. At least I can boot and the rest should follow! So far so good without needing to touch fstab myself, whose contents currently show the following:

Code:
# / was on /dev/sdc1 during installation
UUID=b99d44be-8570-44ca-a274-577220ff6b21 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sdc5 during installation
UUID=d84d81ab-27fd-4b03-a9cf-6da0dba83836 none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
 
  


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
Best-easy way to run windows XP under debian, specifically for USB printer JonathanWilson Linux - Virtualization and Cloud 2 07-04-2013 01:08 PM
[SOLVED] Errors when trying to run Debian from a USB disk CheatCat Debian 7 11-08-2009 10:18 AM
Member's of LQ that run Debian Live from usb? linus72 Debian 26 08-04-2009 02:44 PM
HP Deskjet 5550 (usb) - HPLIP can't run in Debian sarge ch_music Linux - Hardware 4 02-12-2005 08:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:52 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