You are not logged in.

#1 2017-08-11 15:22:01

s-rod
Member
From: Kansas City, Missouri
Registered: 2015-10-09
Posts: 39

(SOLVED) external usb drive errors

New install of Debian 9.1.  With no external usb drive attached the pc boots fine.  Once the system is up the external drive can be plugged in and shows as /dev/sdb.  If I try to boot the pc with the external drive attached I get dropped to an "initramfs" prompt.

Lines preceeding the prompt are
/dev/sda1: clean
mount: mounting /dev/ on /root/dev/ failed: no such file or directory
run-init: opening console: no such file or directory.
No init found. Try Passing init= bootarg.

After this error I booted with a live dvd (with the external drive attached). This time the external drive was /dev/sda with the internal drive being /dev/sdb. Fstab uses UUID to mount / and swap. Gparted was used to check both sda and sdb. The fsck did not resolve the issue.

Any suggestions for troubleshooting a fix so I can boot with the external drive attached?

Last edited by s-rod (2017-08-11 20:07:40)

Offline

#2 2017-08-11 16:11:10

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: (SOLVED) external usb drive errors

Please post the full content of /boot/grub/grub.cfg & /etc/fstab and the output of:

sudo blkid

(with the USB drive attached)

Offline

#3 2017-08-11 17:47:52

s-rod
Member
From: Kansas City, Missouri
Registered: 2015-10-09
Posts: 39

Re: (SOLVED) external usb drive errors

On another reboot I noticed an error message, that did not affect the normal boot up.

A tpm error (7) occurred attempting to read a pcr value

This lead me to look at the BIOS settings. For the external drive I was using a usb3 PCIx1 card. Under the BIOS security settings - I found that "Slot Security" had been enabled  - disabling it resolved the issue.

Offline

#4 2017-08-11 19:14:59

s-rod
Member
From: Kansas City, Missouri
Registered: 2015-10-09
Posts: 39

Re: (SOLVED) external usb drive errors

Spoke too soon.  The bios setting I changed, actually disabled the slot completely - no external usb.   

boot/grub/grub.cfg

# 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='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  623e1cac-3eba-4278-8208-149d2a8186fa
else
  search --no-floppy --fs-uuid --set=root 623e1cac-3eba-4278-8208-149d2a8186fa
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=5
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=5
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
	set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-623e1cac-3eba-4278-8208-149d2a8186fa' {
	load_video
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod part_msdos
	insmod ext2
	set root='hd0,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  623e1cac-3eba-4278-8208-149d2a8186fa
	else
	  search --no-floppy --fs-uuid --set=root 623e1cac-3eba-4278-8208-149d2a8186fa
	fi
	echo	'Loading Linux 4.9.0-3-amd64 ...'
	linux	/boot/vmlinuz-4.9.0-3-amd64 root=/dev/sda1 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-4.9.0-3-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-623e1cac-3eba-4278-8208-149d2a8186fa' {
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-3-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-3-amd64-advanced-623e1cac-3eba-4278-8208-149d2a8186fa' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  623e1cac-3eba-4278-8208-149d2a8186fa
		else
		  search --no-floppy --fs-uuid --set=root 623e1cac-3eba-4278-8208-149d2a8186fa
		fi
		echo	'Loading Linux 4.9.0-3-amd64 ...'
		linux	/boot/vmlinuz-4.9.0-3-amd64 root=/dev/sda1 ro  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.9.0-3-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-3-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-3-amd64-recovery-623e1cac-3eba-4278-8208-149d2a8186fa' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  623e1cac-3eba-4278-8208-149d2a8186fa
		else
		  search --no-floppy --fs-uuid --set=root 623e1cac-3eba-4278-8208-149d2a8186fa
		fi
		echo	'Loading Linux 4.9.0-3-amd64 ...'
		linux	/boot/vmlinuz-4.9.0-3-amd64 root=/dev/sda1 ro single 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.9.0-3-amd64
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

/etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=623e1cac-3eba-4278-8208-149d2a8186fa /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=a2b4c11b-a5ed-46ef-8191-a22b29b99258 none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

blkid

/dev/sda1: UUID="623e1cac-3eba-4278-8208-149d2a8186fa" TYPE="ext4" PARTUUID="69dce16f-01"
/dev/sda5: UUID="a2b4c11b-a5ed-46ef-8191-a22b29b99258" TYPE="swap" PARTUUID="69dce16f-05"

Offline

#5 2017-08-11 19:26:07

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: (SOLVED) external usb drive errors

s-rod wrote:

boot/grub/grub.cfg

menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-623e1cac-3eba-4278-8208-149d2a8186fa' {
	[...]
	linux	/boot/vmlinuz-4.9.0-3-amd64 root=/dev/sda1 ro  quiet

I think that is your problem — the kernel is being instructed to find the root filesystem on /dev/sda1 but that has been assigned to your USB drive instead of your internal drive.

Test this theory by adding a stanza to /etc/grub.d/40_custom (*do not* overwrite the file, just add this to the end):

menuentry 'Debian (PARTUUID)' {
    set root=(hd0,msdos1)
    linux /vmlinuz root=PARTUUID=69dce16f-01 ro  quiet
    initrd /initrd.img
}

Once the file is saved, use this command to update grub.cfg:

sudo grub-mkconfig -o /boot/grub/grub/cfg

If that doesn't work, try root=UUID=623e1cac-3eba-4278-8208-149d2a8186fa instead (the PARTUUID stays the same if the partition is re-formatted and so should probably be preferred).

EDIT: changed 40_custom to point to /vmlinuz & /initrd.img rather than the numbered images in /boot

Last edited by Head_on_a_Stick (2017-08-11 19:29:58)

Offline

#6 2017-08-11 19:40:52

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: (SOLVED) external usb drive errors

Thinking about this, /etc/default/grub has an option to use UUIDs so you should probably do that.

Looks like you have to set GRUB_DISABLE_LINUX_UUID to "false", see https://www.gnu.org/software/grub/manua … figuration

@others, please correct me if I'm wrong, I don't trust `grub-mkconfig` enough to use it myself...

Offline

#7 2017-08-11 20:07:15

s-rod
Member
From: Kansas City, Missouri
Registered: 2015-10-09
Posts: 39

Re: (SOLVED) external usb drive errors

Appending /boot/grub.d/40_custom as directed worked.

To test second solution  I went back to orginal 40_custom file and updated grub. Setting GRUB_DISABLE_LINUX_UUID to false also worked.

I never cease to be amazed by the wealth of knowledge there is on this forum - THANKS

Offline

#8 2017-08-11 20:09:07

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: (SOLVED) external usb drive errors

You're welcome, glad you got it working  smile

Offline

#9 2017-08-12 00:35:11

DeepDayze
Like sands through an hourglass...
From: In Linux Land
Registered: 2017-05-28
Posts: 1,901

Re: (SOLVED) external usb drive errors

UUID's are very useful as when you set these UUID's in fstab kernel will look for the partition identified by that UUID rather than for a specific device. This makes it easy as partitions can and will change assignment order as devices are assigned in the order they are found.


Real Men Use Linux

Offline

#10 2017-08-12 06:40:24

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: (SOLVED) external usb drive errors

^ Don't forget though, that installing another distro on a separate partition may overwrite the swap UUID, so check that the swap in every fstab is matching.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

Board footer

Powered by FluxBB