Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Ubuntu Server will not boot: Error unknown command '['

  1. #1
    Join Date
    Nov 2010
    Beans
    41

    Ubuntu Server will not boot: Error unknown command '['

    Hello,

    A few months back my Ubuntu server crashed. I can't remember what exactly happened, but when I tried to boot it I got the following error messages:

    error: unknown command '['
    error: unknown command 'load_env'
    error: unknown command '['
    error: unknown command 'save_env'
    error: unknown command 'save_env'
    error: unknown command 'search'
    error: unknown command 'search'

    I tried a few things trying to get grub working again from a live CD, but with no luck. Then I tried boot-repair. It gave me the following logs, which I suppose are probably pertinent: http://paste.ubuntu.com/8189419 But I'm still getting the same errors on boot. Basically, that's the first thing I ever see, then it returns to the Grub menu. Trying any of the boot options will return to a similar error message. I can't get my machine to boot.

    Thanks for any ideas!

  2. #2
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    14,193
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Ubuntu Server will not boot: Error unknown command '['

    liste; Humm ??

    Those indicators do seem to come from grub's config file,
    Might be of interest to take a look at it and see if we can see a malformed line, before trying to purge/(RE-)install grub.
    What does the file look like ?
    Code:
    cat /boot/grub/grub.cfg
    Maybe a easy fix, maybe, not so easy as that file is made up from several other files.

    all we can do is try
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

  3. #3
    Join Date
    Nov 2010
    Beans
    41

    Re: Ubuntu Server will not boot: Error unknown command '['

    Thanks for the reply! I ran the cat command from Live CD and here's the output:

    cat: /boot/grub/grub.cfg: No such file or directory

    But I'm wondering - is that looking in /boot on my hard drive or on the CD? At this point I have also tried to re-install Grub using Rescatux but to no avail. The same error occurs.

    Actually, to be a little more precise, that error is what occurs after the computer first boots. I see a black screen for several seconds to a minute (haven't timed) then that error shows up. After that, I get the Grub menu. If I try to proceed from there, I get the error exactly as described in this post: http://ubuntuforums.org/showthread.php?t=1809562 Like that poster, I can neither boot Windows (same error) nor enter MemTest (similar errors). I could post it if it's pertinent.

  4. #4
    Join Date
    Apr 2012
    Beans
    7,256

    Re: Ubuntu Server will not boot: Error unknown command '['

    The contents of the installed system's /boot/grub/grub.cfg are included in your boot-repair pastebin i.e.

    Code:
    =========================== sda5/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
    set default="0"
    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
    
    .
    .
    .
    based on which I don't see anything out of the ordinary

  5. #5
    Join Date
    Nov 2010
    Beans
    41

    Re: Ubuntu Server will not boot: Error unknown command '['

    Thanks for finding that, steeldriver! So if there's nothing wrong in my grub file, is it likely a hardware issue? I can boot live CD no trouble, so could it be something corrupted on the hard drive; yet I can still access the files on the hard drive - it just won't boot beyond grub. Are there other boot files I can check or try to correct? It seems to me that all hardware is in working order.

  6. #6
    Join Date
    Apr 2012
    Beans
    7,256

    Re: Ubuntu Server will not boot: Error unknown command '['

    ... fwiw the first 44 lines (including the load_env and save_env stanzas) appear to be the same as the /boot/grub/grub.cfg on my 12.04 box

    However I don't know enough about grub to know whether that is good or bad (for example, if the grub.cfg syntax has changed)

  7. #7
    Join Date
    Nov 2010
    Beans
    41

    Re: Ubuntu Server will not boot: Error unknown command '['

    Alright - well I'm also running 12.04 (as you saw) server, but my live CD I tried to restore Grub from was 14.04 Ubuntu Desktop. So I'm guessing that if my lines are the same as yours, that's good. Something of interest (perhaps). Here is the list I get from the grub> prompt when I double tab:

    authenticate background_color background_image boot break clear continue export gettext insmod loadfont ls lsfonts menuentry normal normal_exit return set setparams shift submenu terminal_input terminal_output unset

    That's the full list, which seems too small to me, or am I out to lunch? My 14.04 box has a much bigger list (albeit Grub 2.02)

  8. #8
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    14,193
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Ubuntu Server will not boot: Error unknown command '['

    liste; steeldriver. sorry,
    My bad for not thinking it through and realizing that info was provided. I too see nothing wrong with "grub.cfg".
    I see however there are many kernels installed. However, I do not see that we are suffering space constraints:
    /dev/sda5 ext4 18G 6.5G 10G 40% /mnt/boot-sav/sda5
    Maybe, anyway, do some cleanup and see what results if we attempt to manually boot from grub using particular kernel images ?
    I am all for a learning experience trying to isolate where the corruption is occurring .

    inquiring minds want to know
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

  9. #9
    Join Date
    Nov 2010
    Beans
    41

    Re: Ubuntu Server will not boot: Error unknown command '['

    Alright - I've got it! This page was really helpful https://help.ubuntu.com/community/Grub2/Troubleshooting

    So I discovered that I was missing the linux module which I loaded using:

    insmod (hd0,5)/boot/grub/linux.mod

    Then I followed the Extended Fix steps:

    1. set root=(hd0,5)
    2. linux /vmliuz root=/dev/sda5 ro
    3. initrd /initrd.img
    4. boot

    During boot it did some sort of file checking and asked if I wanted to fix disk errors automatically (F2) or manually, etc. I just automatic, the computer rebooted, and voilą! Grub was working normally again!

    Thank you both for your help! It's really appreciated. I still don't know why or where it went wrong, but I guess I'll never know (unless there are some logs somewhere I could check) ?

    Edit: how do I "do some cleanup", by the way? I thought it did it automatically with upgrades.

  10. #10
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    14,193
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Ubuntu Server will not boot: Error unknown command '['

    liste; Hey !

    You do good work !

    As to house cleaning, in That release the old kernels must be removed manually,
    then using apt one can remove obsolete and orphaned files and as well clear out the cache.
    Know the kernel you are booting; MUST not remove it !
    Code:
    uname -r
    get a list all all kernels installed ( images and headers):
    Code:
    dpkg -l | grep linux-
    There exist all kinds of means to remove these kernels, the slower sure way - IF your are careful:
    For an instance/example ! for each kernel installed a whole bunch of them -
    Keep the current booting kernel and one other that is known to boot ( preferably the kernel version just under the booting kernel)
    Code:
    sudo apt-get --purge remove linux-image-3.2.0-31
    sudo apt-get --purge remove linux-image-3.2.0-31-generic 
    sudo apt-get --purge remove linux-image-3.2.0-31-generic-pae
    sudo apt-get --purge remove linux-headers-3.2.0-31
    sudo apt-get --purge remove linux-headers-3.2.0-31-generic
    one can get handydandy with the code and combine all of them in one command, but will not confuse the issue at this time.

    then general housecleaning:
    Code:
    sudo apt-get autoclean
    sudo apt-get autoremove
    sudo apt-get clean
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    In 14.04 the command "autoremove" will now also remove the obsolete kernels !

    Once done you are clean and up-to-date.

    Every once in a while
    just something you do
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •