Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
When get back to ssh I find that /etc/default/grub doesn’t exist.
grub.cfg and menu.lst does.
When I do an ‘uname -r’ I see the current active kernel but when I check grub.cfg it doesn’t show up. But it does in menu.lst.
Questions:
Must a ubuntu16.04 have an /etc/default/grub?
and
Must grub.cfg file contain the active kernel ?
When get back to ssh I find that /etc/default/grub doesn’t exist.
grub.cfg and menu.lst does.
When I do an ‘uname -r’ I see the current active kernel but when I check grub.cfg it doesn’t show up. But it does in menu.lst.
Questions:
Must a ubuntu16.04 have an /etc/default/grub?
and
Must grub.cfg file contain the active kernel ?
Welcome to LQ dspit1664,
Grub is not an operating system, it is a bootloader.
Therefore it is incorrect to say that Ubuntu 16.04 boots into grub prompt. Ubuntu either boots into Ubuntu Linux or it fails to boot and you have been left at the grub prompt. Please explain if this is what you're experiencing.
Yes correct what I should have said was:
Have working Ubuntu 16.04 however recently after applying recent kernel update and rebooted. Reboot did not return to Ash but in to grub prompt.
After working out how to exit at grub cli rebooted in to ssh however am concerned that if I reboot again it will go back into grub prompt again so after some debugging identified as I posted.
Any thoughts ?
Must a ubuntu16.04 have an /etc/default/grub?
and
Must grub.cfg file contain the active kernel ?
1. I guess not strictly, but I've never seen one with grub installed that doesn't have that file.
2. It should after running 'grub-mkconfig -o /boot/grub/grub.cfg'
I meant (I’m still learning) - worked out how to see below
I meant I worked out how to use find and set where it could find the kernel and issuing a boot (I think it is) it rebooted from grub to regular ssh login prompt.
Thanks for info I may try it but it’s a work system and I need to be sure it won’t barf again.
after applying recent kernel update and rebooted. Reboot did not return to Ash but in to grub prompt.
What do you mean by Ash?
The Linux shell?
Also, what kernel version did you update to?
And did that work? Please check the kernel version you are running if you can.
Quote:
Originally Posted by dspit1664
After working out how to exit at grub cli rebooted in to ssh
ssh is a protocol, you either are stuck at the grub prompt, or the Linux kernel loaded. If there are network services, and the protocol is enabled, you may be able to use ssh. Sounds as if this is how you access the system, it boots and you can perform an ssh to remotely attach to it. Is this correct?
Quote:
Originally Posted by dspit1664
After working out how to exit at grub cli ... am concerned that if I reboot again it will go back into grub prompt again
What did you do when you worked out how to get out of the grub prompt? Do you remember what you typed? And what was the result? Did Linux boot? Or do you not know? Did you try a few commands, end up rebooting, and just got lucky?
I feel this may result in a recommendation for you to inspect your boot logs and determine if they show anything unusual. They may show that there was a point where the system needed to recover, and did so, or they may show a recurring problem where once you fix it, it will no longer be a problem.
I fully understand your concern that you are wary that this can occur again. Best I can recommend is to see if you can recall how you dealt with it before and if there were specific commands which got the system operating, please retain those for future reference as well as including them with your question here. Next, if you do not know what got things working, or even further, if the system seems to boot now without getting stuck at the grub prompt, then I do suggest checking the boot logs to see if there are any existing complaints as the system boots.
Lol apologies using iPhone to type meant 'ssh'.
Yes I meant - I'll work out the cmds I used soon not at work now.
I got it to boot from grub using a available cmds in grub (there are I believe some limited options ) anyhow it booted back in to the kernel and was able to login using ssh.
I'll try and work out what cmds I used and update the post with more info.
This seems like maybe your 16.04 was installed in addition to a previously installed Linux OS that was using Grub Legacy instead of Grub2. Then something went wrong WRT bootloader update and/or partitioning to break the 16.04 bootloader. Grub Legacy uses menu.lst, which constitutes the entirety of boot configuration, and does not use either grub.cfg or /etc/default/grub.
If you upload output from bootinfoscript we can see if this suspicion applies, and other things relevant to getting your normal 16.04 booting recovered.
There is also a possibility, though very slight, that your 16.04 was being booted by Grub Legacy, as a result of having existed as a result a series of upgrades dating back many years. 9.04 was the last to use it by default, while Debian and some of its variants can still use it instead of Grub2 even now.
This seems like maybe your 16.04 was installed in addition to a previously installed Linux OS that was using Grub Legacy instead of Grub2. Then something went wrong WRT bootloader update and/or partitioning to break the 16.04 bootloader. Grub Legacy uses menu.lst, which constitutes the entirety of boot configuration, and does not use either grub.cfg or /etc/default/grub.
This is a system built as Ubu16.04 to my knowledge it's a single boot 16.04.
Quote:
If you upload output from bootinfoscript we can see if this suspicion applies, and other things relevant to getting your normal 16.04 booting recovered.
So if I upload the above and run it the output will provide detail?
[/QUOTE]
Quote:
There is also a possibility, though very slight, that your 16.04 was being booted by Grub Legacy, as a result of having existed as a result a series of upgrades dating back many years. 9.04 was the last to use it by default, while Debian and some of its variants can still use it instead of Grub2 even now.
Here is the output:
Seems that `grub` is being used and `grub2` at least from the first bit below?
Boot Info Script 0.77 [10 June 2018]
============================= Boot Info Summary: ===============================
=> Grub Legacy (v0.97) is installed in the MBR of /dev/xvda and looks on the
same drive in partition #1 for /grub/stage2 and /grub/menu.lst.
=> libparted MBR boot code is installed in the MBR of /dev/xvdb.
--------------------------------------------------------------------------------
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-legacy-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 3
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu
# Pretty colours
#color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a ro console=hvc0
## default grub root device
## e.g. groot=(hd0,0)
# groot=2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=elevator=noop
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## specify if running in Xen domU or have grub detect automatically
## update-grub will ignore non-xen kernels when running in domU and vice versa
## e.g. indomU=detect
## indomU=true
## indomU=false
# indomU=true
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
--------------------------------------------------------------------------------
#
# 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 recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; 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
}
terminal_input console
terminal_output console
if [ "${recordfail}" = 1 ] ; then
set timeout=0
else
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=0
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=0
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}"
if [ "${1}" = "keep" ]; then
set vt_handoff=vt.handoff=7
else
set vt_handoff=
fi
}
if [ "${recordfail}" != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
menuentry 'GNU/Linux' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 0dc09b69-6144-4a25-b1ca-455b33ca8bd5
else
search --no-floppy --fs-uuid --set=root 0dc09b69-6144-4a25-b1ca-455b33ca8bd5
fi
linux /vmlinuz-4.15.0-23-generic root=UUID=2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a ro console=tty1 console=ttyS0
initrd /initrd.img-4.15.0-23-generic
}
submenu 'Advanced options for GNU/Linux' $menuentry_id_option 'gnulinux-advanced-2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a' {
menuentry 'GNU/Linux, with Linux 4.15.0-23-generic' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-23-generic-advanced-2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 0dc09b69-6144-4a25-b1ca-455b33ca8bd5
else
search --no-floppy --fs-uuid --set=root 0dc09b69-6144-4a25-b1ca-455b33ca8bd5
fi
echo 'Loading Linux 4.15.0-23-generic ...'
linux /vmlinuz-4.15.0-23-generic root=UUID=2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a ro console=tty1 console=ttyS0
echo 'Loading initial ramdisk ...'
initrd /initrd.img-4.15.0-23-generic
}
menuentry 'GNU/Linux, with Linux 4.15.0-23-generic (recovery mode)' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-23-generic-recovery-2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a' {
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 0dc09b69-6144-4a25-b1ca-455b33ca8bd5
else
search --no-floppy --fs-uuid --set=root 0dc09b69-6144-4a25-b1ca-455b33ca8bd5
fi
echo 'Loading Linux 4.15.0-23-generic ...'
linux /vmlinuz-4.15.0-23-generic root=UUID=2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /initrd.img-4.15.0-23-generic
}
menuentry 'GNU/Linux, with Linux 4.4.0-128-generic' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-128-generic-advanced-2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 0dc09b69-6144-4a25-b1ca-455b33ca8bd5
else
search --no-floppy --fs-uuid --set=root 0dc09b69-6144-4a25-b1ca-455b33ca8bd5
fi
echo 'Loading Linux 4.4.0-128-generic ...'
linux /vmlinuz-4.4.0-128-generic root=UUID=2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a ro console=tty1 console=ttyS0
echo 'Loading initial ramdisk ...'
initrd /initrd.img-4.4.0-128-generic
}
menuentry 'GNU/Linux, with Linux 4.4.0-128-generic (recovery mode)' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-128-generic-recovery-2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a' {
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 0dc09b69-6144-4a25-b1ca-455b33ca8bd5
else
search --no-floppy --fs-uuid --set=root 0dc09b69-6144-4a25-b1ca-455b33ca8bd5
fi
echo 'Loading Linux 4.4.0-128-generic ...'
linux /vmlinuz-4.4.0-128-generic root=UUID=2fcba7a1-77bf-4d12-b01b-d1ff410d1a0a ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /initrd.img-4.4.0-128-generic
}
}
### 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 ###
--------------------------------------------------------------------------------
=================== xvda1: Location of files loaded by Grub: ===================
# Added by Cloud Image build process
LABEL=cloudimg-bootfs /boot ext3 defaults,relatime 0 0
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
# Mount the metadata disk for cloud-init, if present
LABEL=METADATA /var/lib/cloud/seed/config_drive vfat defaults,nofail 0 0
LABEL=SWAP-xvdb1 none swap sw,comment=cloudconfig 0 2
none /dev/shm tmpfs nosuid,nodev,noexec 0 0
--------------------------------------------------------------------------------
=================== xvda2: Location of files loaded by Grub: ===================
Seems that `grub` is being used and `grub2` at least from the first bit below?
Grub Legacy is being used, installed to the MBR of the drive. The problem or interesting part of Grub Legacy on this system is that Ubuntu has been using Grub2 on all its releases for 10 years, beginning with release 9.10. So the question is, how did Grub Legacy get there? Your grub.cfg file menuentry lists "GNU/Linux" as the OS rather than Ubuntu which I've never seen before on an Ubuntu installation. THis should not prevent booting as it is just the title and the kernel and initrd lines are different in grub.cfg compared to menu.lst. Check which kernel version(s) you have. You should be able to re-install grub2 using the methods described at the Ubuntu site at the link below under Section 2.2 under Contents.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.