[SOLVED] grub2-mkconfig: line 42: basename: command not found
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2018
    Location
    Florida
    Posts
    2

    grub2-mkconfig: line 42: basename: command not found

    Hi, I reinstalled Fedora 26 on a dual boot system along with Windows 10. Grub only showed the Fedora menu entry, so I tried to get it to find the windows installation (lsblk still shows the partitions) and I get:

    bash-4.4$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    [sudo] password for rabbit:
    /sbin/grub2-mkconfig: line 42: basename: command not found
    bash-4.4$ basename ~
    rabbit

    so the grub2-mkconfig script can't run 'basename', but I can run it from the bash prompt.
    Line 42 is:

    self=`basename $0`

    Any suggestions will be appreciated.

    Dave

  2. #2
    Join Date
    Oct 2011
    Posts
    1,863

    Re: grub2-mkconfig: line 42: basename: command not found

    This is very strange, I am wondering from where you are trying to run `grub2-mkconfig`. Since the binary exists the issue is probably that `PATH` environment variable does not contain the directory location where `basename` command is located.

    Check your `/etc/sudoers` file does contain `secure_path` set to valid locations and also `/etc/sudoers.d/` does not contain anything, or if it does that it is valid.

    As a workaround, you can also try something like:

    Code:
    sudo PATH=/usr/bin:$PATH /usr/sbin/grub2-mkconfig
    Also `basename` should be a command located in `/usr/bin`.
    Code:
    $ which basename
    /usr/bin/basename

  3. #3
    Join Date
    Jan 2018
    Location
    Florida
    Posts
    2

    Re: grub2-mkconfig: line 42: basename: command not found

    Thank you srakitnican! When I installed java and tried to add java-related things, I nuked everything that was already in PATH
    Fixed the path and everything works fine

  4. #4
    Join Date
    Jun 2005
    Location
    Montreal, Que, Canada
    Posts
    5,400

    Re: grub2-mkconfig: line 42: basename: command not found

    If basename is missing, which it should not be, then

    sudo dnf install basename
    Leslie in Montreal

    Interesting web sites list
    http://forums.fedoraforum.org/showth...40#post1697840

Similar Threads

  1. grub2-mkconfig not completing.
    By lsatenstein in forum F27 Development Forum
    Replies: 1
    Last Post: 13th November 2017, 08:36 AM
  2. grub2-install: command not found similar command is 'grub2-install'
    By RichG in forum Installation, Upgrades and Live Media
    Replies: 3
    Last Post: 31st August 2017, 12:07 PM
  3. booting Fedora from grub2 command line
    By gordon64 in forum Guides & Solutions (Not For Questions)
    Replies: 0
    Last Post: 8th May 2017, 02:02 PM
  4. [SOLVED]
    grub2-mkconfig command not working (fixed)
    By thorn in forum Installation, Upgrades and Live Media
    Replies: 0
    Last Post: 30th September 2013, 06:32 AM
  5. Replies: 0
    Last Post: 27th January 2013, 09:34 AM

Tags for this Thread

Posting Permissions

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