Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

efibootmgr: Could not set variable: No such file or directory #2

Open
ragkousism opened this issue Mar 19, 2018 · 1 comment
Open

Comments

@ragkousism
Copy link

ragkousism commented Mar 19, 2018

Hello, running make-secure-boot-keys as root on ubuntu 16.04 fails in the end with:

Generating grub configuration file ...
patching file /tmp/tmp.CuOB9NyrEo (read from /etc/ubuntu-secure-boot/10_linux.distrib)
Found linux image: /boot/vmlinuz-4.4.0-116-generic
Found initrd image: /boot/initrd.img-4.4.0-116-generic
Found linux image: /boot/vmlinuz-4.4.0-87-generic
Found initrd image: /boot/initrd.img-4.4.0-87-generic
Adding boot menu entry for EFI firmware configuration
done
Gathering GRUB modules... (please disregard any messages regarding network configuration...
Netboot directory for x86_64-efi created. Configure your DHCP server to point to /tmp/tmp.xHxB5wKqW0/boot/grub/x86_64-efi/core.efi
Signing GRUB modules... (this will take a minute)
Creating memdisk...
Building GRUB image...
writing RSA key
Signing GRUB image...
Adding bootloader to EFI configuration...
efibootmgr: Could not set variable: No such file or directory
efibootmgr: Could not prepare boot variable: No such file or directory

The part in which it fails is:

    DEVICE="$(df -T /boot/efi | sed -n 2p | awk '{ print $1}')"
    DISK="$(echo "$DEVICE" | sed 's|[0-9]||g')"
    PARTNUM="$(echo "$DEVICE" | sed 's|[^0-9]||g')"
    efibootmgr --quiet --create --disk "$DISK" --part "$PARTNUM" \
        --write-signature --label "$BOOTLOADER_ID" \
        --loader "\\EFI\\$BOOTLOADER_ID\\$EFI_FILENAME"

Any ideas what could be wrong?

@ragkousism
Copy link
Author

I found the problem. On my system I am using a nvm ssd, which means that df -T /boot/efi | sed -n 2p | awk '{ print $1}' evaluates to /dev/nvme0n1p1. The issue is that echo "$DEVICE" | sed 's|[0-9]||g' evaluates into /dev/nvmenp and echo "$DEVICE" | sed 's|[^0-9]||g' evaluates into 011 which is completely wrong. the correct values are DISK=/dev/nvme0n1 and PARTNUM=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant