The efivar question

I have switched completely from Windows 10 to Linux Mint 19 a few years ago. Before that I used Ubuntu 14.0 and Windows 7 in dual boot. I was allured with the much fanfare of windows 10 and loaded windows 10 and was working in it till I became disgusted for its malware and viruses which caused me to format the HDD frequently. Finally I embraced Linux Mint 19.

At the time of installing it automatically created 537 mb fat efi partition. Total hardidsk partition was GPT.

I updated to Mint 19.1 and at the time of installtion from DVD I did not remove the Efi partition
–only created root in the remaining portion of the disk. In upgrading to 19.2, I did the same and was believing that my machine was booting in Efi mode.

But of late I found that in BIOS if I put efi booting option in 1st boot order I am getting GRUB
prompt.

So I used GRUB> ls and tried to fix with
'****************
GRUB> set prefix = (hd0,gpt2) /grub
GRUB> set root =(hd0,gpt2)
error: efivar is not present in your system

Then I tried with the live CD of Mint 19.2
$ sudo efibootmgr
E: efivar is not present in your system

I have no idea about this efivar neither of its location. I consulted Linuxquestion.Org forums pages
and in one place I found that the variable is a part of the mobo. But its absence is impossible as my
mobo is GA-B85M-D3H which is ultra durable dual boot mobo. I have throughly read its booklet .
I am depicting a schreenshot of BIOS Boot menu.

In another thread of Linux question.org I found that the variable should be present in Linux
Kernel. My active kernel is 5.3.9-19 which I believe is the current one. In BIOS, I set the 1st Boot
Order with the Hard Disk the system booted within 2 seconds.

Now my question is that “How my machine is booting in Legacy Bios or in Efi?”
I am giving a snapshot of the root partition of my machine for your convenience.

I read another post in Linuxquestion.org which is titled as “A Concern with efivars” . Below is the
page link:
https://forums.linuxmint.com/viewtopic.php?=216777#top

In this page I find “ It seems unlikely that a newbie will run into this bug. But the first thing that
came into my mind was accidental bugs may occur in any other software for example the one in
Steam some time ago”.

The last paragraph of the post is important to me: “The reason why I bring up this topic is because
not so long ago Steam had a Bug that executed the system the most dangerous command in linux
rm -rf / and as long as this problem exist in certain motherboards the chances that some random
bug in any software can brick a machine scares me a lot.”

In removing WINE folder from my computer I used the command $rm -rf / .I also used the said
command several times in some other occassion. I installed Windows 10 very recently in UEFI
mode. But overwritten it on the same day with Linux Mint 19.2 again. I installed Zorin OS core
15. It is very good but solely for persons just switching from Windows 7. I think I have passed that
stage though I am still a newbie. I installed Linux Mint 19.2 and I discovered the problem of efivar

Finally I want to know :

(1) How my computer is booting --LEGACY Or UEFI ?
(2) Have I deleted efivar variable myself by issuing the command $ rm -rf /
(3) Is it really a bug?
(4) If it is a bug will it be properly addressed in the next impending release of 19.3 ?
(5) Is there any way to recover efivar at this stage ?

I am 78 years old and my intellect and memory is in diminishing returns. Yet I am trying to learn
Linux mainly from your posts I receive in my email inbox. I have not deleted any mail. Rather I am
trying to compile a guide book for myself.

2 Likes
  1. You have to boot the installation medium explicitly in UEFI mode.
  2. You have to create or choose an existing EFI partition, formatted in FAT32.
  3. If you did not (need to) do either, you did not install in EFI mode. You have reinstall in UEFI mode, as described in the two points above.

That said:

Never delete or change anything that you don’t know about. If you don’t know what it is, let it be.

Changed the ownership of the thread to @ubhat

Dear Akito : you meant that I should have booted the installation medium in UEFI mode which I did not do because in Bios I could not find any. When I installed Mint 19 two years ago it automatically asked for booting in UEFI mode and created the fat partition.
Are you suggesting me now to reinstall LM 19.2 and create an Uefi partition in fat using Gparted using the option “something else” ?

1 Like

If the installer works correctly, it should create an ESP (EFI) partition automatically in “Guided” mode, if you actually booted the installation medium in EFI mode.

To be absolutely sure, the installation is progressing as desired, you could of course create a separate ESP (EFI) partition under Something else and choose it as the EFI partition mount point in the OS.

So basically you would for example create a root partition of 50GB and choose it as the root partition within the installation GUI. Then you would create a partition of 200MB and choose it as the ESP (or EFI) partition. If you do it like this and the installation continues without errors, then it definitely installs in UEFI mode, which means you are doing everything correctly.

P.S.:
If you boot the installation in UEFI mode and you try to continue the installation in “Something else” WITHOUT choosing/creating an ESP partition, then it will give you an error, that you need to create or choose an ESP parition.

P.P.S.:
ESP (EFI) partition is ALWAYS formatted as FAT or FAT32.

1 Like

Dear Akito. Thank you. It is clear to me now. I shall reinstall accordingly. But if I Continue now as it is will there be any problem?. LM 19.3 Is likely to come in the next month I shall prepare a DVD and make a new install. I always keep backup in a 1Tb external HDD.

Dear @ubhat,
In first place accept my apologies if my intervention in your thread would’t be what you need to solve your problem but I don’t have much knowledge about Linux.

I had a similar problem with Mint 19.2 when I tried to install it in UEFI mode. In my case, the installation create the ESP partition was empty.
My MINT install was different from yours but you could have same problem has I did.

I don’t know if you need to the same procedure when you install via DVD but I installed it via PEN DRIVE and, after POST ( before appears GRUB or windows) I need to press, in my case, F11 key to choose the boot option and choose between 2 options to PEN DRIVE:

  • USB: PEN DRIVE
  • UEFI: PEN DRIVE

If I don’t choose run PEN DRIVE in UEFI, the MINT installation was done in legacy BIOS

Please check if you can choose between these two options for DVD too

Take a look to my thread for more information.
It’s totally different from yours problem but please read the part about I can’t install MINT in UEFI MODE…

Once again, sorry about my intervention in your thread and please follow @Akito’s and @abhishek’s instructions

1 Like

Dear @Tech_JA,
Firstly, I want to thank you for your intervention. Though I have been using Linux for some years but I am still a novice. Your post and the manual of installation gave me a fair knowledge. I shall try to apply this with LM-3.
But when enter Bios by pressing F2 or entering in boot order by F12 I do not find Uefi option as described by you. Next time I shall try by creating Efi boot Partition at the time of installation.
I realise now that I am booting in Legacy mode. i. e. My first question is answered.
Regarding efivar is it generated if booting done in efi mode?
Abhishek advised me not to use the command rm - rf / without proper knowledge. What shall I do to delete a folder which is not empty?

2 Likes

I think efivars is a kernel module and used in UEFI mode to have access to EFI variables

Only @abhishek can answer to that question but maybe because this command is very “dangerous” because it deletes everything inside the directory or could be the way what you wrote the conmand

  • rm -rf /

You just add a slash which means you delete the root directory and everything inside it with this command

1 Like

Thank You @Akito and @Tech_JA both of you helped me much. I have learnt a lot form both of you. If I want to close this thread what I have to do. I want to start a new thread with some other topic.

2 Likes

it might help to know a little more about the rm command. there are plenty of places you can read the manual (man) page for rm online. this one is as good as any other. you can also issue the command man rm in a terminal to get the same information.

the basics are rm which is the command used to remove files or directories. the option -r is to make that command recursive and remove all of the directories inside the one you are trying to erase if it is not empty. the -f (or --force) option makes sure everything inside the directory gets removed. the last part of the command is the name of the file or directory you are trying to remove.

the dangerous part (like @Tech_JA has mentioned) is that in the examples you have given above of rm -rf /, the directory you are asking your computer to remove is your (/) root directory where everything is located from your personal files in /home/user to system files in /bin, /lib etc. if you successfully issue that command, it will begin removing your working system and leave it unusable.

if i am in my Downloads directory (/home/user/Downloads) and issue the command:

user@computer:$~/Downloads rm -rf test

that will just remove the test directory i have created and the directories inside of it.

in general rm can be used safely enough as long as you understand what file you are asking it to remove.

2 Likes

if there is a post that you feel is a solution to your question, you can click on the three dots to the left of Reply below the post and then click on the check box to the left of the word Solution.

1 Like

Dear @01101111 Thank you ver much for your expaining of rm command with the -rf option and also thank you fpr rm(1) - Linux man page which I read now and saved it in my tutorial folder.
In this connection I must add that the command rm -rf was issued by me following a guide in the link https://www.pcsuggest.com/install-wine-ubuntu/ . I am quoting its lines :

Extra - Uninstall Wine

If you think wine is no more useful, and want to uninstall, then it’s here.

Again We’ll use the apt command to uninstall wine from Ubuntu. Simply run the command below.

sudo apt-get purge wine wine-* sudo apt-get autoremove --purge

Finally remove the directory containing all run time data generated by wine.

rm -rf ~/.wine/ rm -rf ~/.local/share/applications/wine*
However, it is true that I have used blindly without knowing the implications.
Thank you again for all of you helping me in knowing a very basic problem.
I must thank @abhishek for his posts which helped me to learn the use of terminal in possible cases specially to install and uninstall a package and doing some basic works. I share this computer with my daughter and can use only when she is in her office. She was a window 10 lover but I have installed LM in this computer and she now asks me to find out packages similar to that of Windows she was using. I have done that and made her satisfied that almost all works can be done by Linux. I am closing this thread as solved so that I can start a new thread as I have so many things to know.

2 Likes

i am happy to try and help :slight_smile: it was helpful of you to be able to provide a link and quote for some context about the commands you had run.

do you see the differences between these two commands?
rm -rf ~/.wine/
rm -rv /

the first one has a ~ (tilde) before the / so it is slightly different from the second, but in an important way. linux uses ~/ as a shorthand for your home directory which is where your personal files are stored in directories like Documents, Downloads, Pictures or Videos (among others). it can also be typed out as /home/user (where user is the name you use to login to your computer). your Downloads directory could be either ~/Downloads or /home/user/Downloads.

the second one only has the / which is your root directory where almost all of your linux system is installed. this is why the second command is exceedingly more consequential than the first and should never be used. it would destroy your system.

/home is a directory inside of your root directory. and /home/user is a directory inside of your /home directory. this is a pretty good description of the linux directory structure if you are interested.

the . before a file or directory name (like ~/.wine or ~/.local in the examples above) indicates that is hidden.

i absolutely did the same when i started learning linux. it can take a while to figure out where to look for solid, verifiable answers when we first get going and want to see what the terminal has to offer.

1 Like

Dear @ubhat,
you can check if your DVD live install is running in legacy BIOS or in UEFI mode with this command, before install Linux MINT:

  • ls /sys/firmware/

If you obtain EFI listed, you are running the DVD in UEFI mode, other case you are running in legacy BIOS

I describe below both examples with PENDRIVE LM LIVE to you know the differences between them.

  1. Running PENDRIVE in Legacy:
    In my case, I pressed F11 after POST to choose boot device and choose USB: KingstonDataTaveler (Legacy BIOS MODE)
    pen_bios

After loading LM, I wrote in terminal ls /sys/firmware
term_legacy

you can see there is no reference to UEFI or EFI or EFIVARS

This LM is running in Legacy BIOS

  1. Running PENDRIVE in UEFI:
    After POST, I press F11 and choose UEFI: KingstonDataTRaveler (UEFI MODE)
    pen_uefi

After loading LM, I wrote in terminal ls /sys/firmware
term_uefi
Now I have efi directory and if I run ls /sys/firmware/efi I have efivars directory. These means LM LIVE is running in UEFI mode

In my opinion, the first test you need to do is running your DvD live distro and check if it runs in Legacy BIOS or UEFI because you need to run it in UEFI mode to install LM in your HD in UEFI mode too (I think you could be change manually but I don’t know how to that)

1 Like

Dear @01101111
I very much appreciate and welcome your writings. It actually is a very important lesson to me. I did not know what ~ stands for and space after the option -rf and slash would brick a computer system was really unknown to me.
When I installed LM 19 first time and was trying with terminal very often I was stuck with something or other and was writing to linuxQuestion Forum for solution. Getting my question off and on perhaps they in the forum became bored and advised me to download " Introduction to Linux " by Brandon Chisham. I downloaded and tried to read. But perhaps due to my age I feel sleepy whenever I have to go such Books or like that. . I feel that I should have tried the book sincerely. However there is a saying in Bengali( I hail from Bengal) “Jale na namile keha shike na Santar” It means unless one dips oneslf in a pond one cannot learn how to swim. So I took this method and plunged into the vast sea of Linux. There is another reason my time is also limited . I have the yearning to learn Linux before I die.
Thank you very much. I shall await for more of such advise.

2 Likes

Dear @Tech_JA
Your writing incited me to experiment immediatiely. So at first in my installed LM 19.2 I opened the terminal and issued the command $ ls /sys/firmware/ . The result is as you have given in the image :: acpi dmi memmap Then Certainly I am booting in Legacy Bios.
Next I inserted Live DvD LM 19.2 and came to Bios by Pressing F2 . I am appending the image below:-
image
I selected UEFI OS P4 and ran it. But I got Grub Menu
GRUB>
i issued ls command
GRUB> ls
(hd0) (hd0,gpt2) (hd0,gpt1) (Cd0,apple2) (Cd0,apple1) (Cd0,msdos2)
GRUB>
Really speaking I had no idea what to do next.
So I tried again from the beginning and Pressed F12 (Boot Order Menu). the image is as below.
image
This time I selected the last but one option i.e P4: WDC WD10EZRX and the computer started in perfect order.
Now please tell me whether I have any problem in Bios?

2 Likes

Dear @ubhat,
I think P4 is your hard disc.
You choose to start from your hard disc in UEFI mode
Please press F2 and choose ubuntu from to you pc starts correctly and try run if starts LM. If doesn’t run correctly, try the second ubuntu from the list.

After you repair your boot try this:

With DVD disc inserted in your DVD drive, press F12 and choose P5 ( is your DVD) and after load the LM LIVE enter the command:
ls /sys/firmware
and check if you have the EFI directory
Please give the feedback

1 Like

Dear @Tech_JA,
No way. I tried with 1st ubuntu then with 2nd ubuntu. in both the cases Grub> prompt came. I tried then with UEFI P5 the same Grub Menu came. Next time there was no P5 option. All were UEFI there were two UEFI:P4. I tried with one UEFI P4 and GRUB came as before. I removed the DVD and inserted SUPER GRUB Disk. Now wirhout showing UEFI boot Menu the computer booted and LM19.2 started asked for Password.

Dear @ubhat,
I’m so sorry but I’m lost…
Now you have your Linux Mint running from HDD, without any DVD disc inserted in drive, as usually you do?