Q4OS installation failure
Solvedjns55 -
Hello,
I am in the process of installing the Q4OS distribution based on Debian, but the installation stopped two-thirds of the way through, after loading 179,659 files. A window opened saying "The bootloader could not be installed. The installation command <pre>grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Q4OS_Aquarius --force</pre> returned error code 1."
An Ubuntu forum states that I need to run boot-repair in a Terminal, which I did while being on my live USB stick because I can't do it any other way, as this installation attempt erased the previous partition. There is no OS left on my PC.
Problem: The Terminal tells me that this command is not recognized! I have tried various ways to type boot-repair but with no results! Perhaps this command is incomplete?
For example, should I type apt-get boot-repair? Or do I need to specify some features of the PC?
Thank you for your opinions!
My PC:
Lenovo Ideacentre 310S-08ASR
Processor: AMD E2-9030 Radeon R2 4 compute cores 2C + 2Gx2
5 answers
-
Hello,
See here for installing boot repair on Debian (Q4OS is a Debian and the commands given above are for Ubuntu which is why it failed).
https://wiki.debian.org/Boot-Repair
It would also be interesting to have the output of the command
sudo fdisk -l
-
Hello,
The fdisk command shows that your disk is in gpt format and there is an efi partition on the disk. Did you start the installation media in EFI mode to proceed with the installation? (By the way, does your PC support this mode since it doesn't seem recent?)
To check if the installation media was started in EFI mode, open the terminal, paste this command:
# [ -d /sys/firmware/efi ] && echo "UEFI Boot Detected" || echo "Legacy BIOS Boot Detected"And see the result.
If the installation media was started in legacy bios mode, the disk format (gpt) is not suitable, hence the error during the installation of grub.
However, it is technically possible to install in legacy bios mode on a gpt disk, but in this case, it is necessary to create a small bios_boot partition at the beginning of the disk (which does not exist in your case because there is an efi partition instead) because there is not enough space to install grub entirely in the mbr of a gpt disk.
https://en.wikipedia.org/wiki/BIOS_boot_partition
-
It should display either UEFI Boot Detected or Legacy BIOS Boot Detected... definitely one of the two.
If you're installing in legacy mode, you first need to convert your disk to MBR mode; otherwise, grub won't be able to install correctly on your GPT disk. You can do this with gparted. First, select your hard drive (probably sda) at the top right, then go to the Device menu / Create a new partition table. Choose the msdos format.
The entire disk will be erased.
https://gparted.org/display-doc.php?name=help-manual&lang=fr#gparted-create-partition-table
Then you can create your partitions by clicking on New Partition.
The other option (perhaps the simplest) would be to keep the GPT disk format and convert the EFI partition to a bios_grub partition so that part of grub can install there. For that, you need to select the EFI partition and set the BIOS_GRUB flag.
https://gparted.org/display-doc.php?name=help-manual&lang=fr#gparted-manage-partition-flags
-
-
-
Hello,
Some remarks:
- Regarding the ESP: you can normally manage it from the EFI settings of your BIOS/UEFI. It usually looks like this. If that's not the case, it seems possible, under Linux, to work on the ESP with efibootmgr:
# Installation sudo apt update sudo apt install efibootmgr # Load the appropriate module, usually done automatically (see lsmod) sudo modprobe efivars # List the partitions sudo efibootmgr -v # Delete the entry XXX # See: man efibootmgr # See: https://tecporto.pt/wiki/index.php/Removing_an_entry_from_the_UEFI_boot_list_(Linux) sudo efibootmgr -b XXX -B
- Regarding the command df -h: it lists the available space on each mounted partition. Among all these lines is /boot/efi, which corresponds to the ESP.
Example:# Find the EFI partition mount | grep /boot/efi # I get: # /dev/nvme0n1p2 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro) # The device that interests us is therefore /dev/nvme0n1p2 # Display the occupied space, keeping only the line that contains /dev/nvme0n1p2 df -h | grep /dev/nvme0n1p2 # I get: # /dev/nvme0n1p2 256M 53M 204M 21% /boot/efi # The partition is 256Mio, 53Mio are used, 204Mio are free, the occupancy is therefore 21%
- Regarding legacy boot: this must have unlocked the installation of Q4OS because indeed there is then no reason to reference anything in the EFI partition.
- However, if you decide to restore Secure Boot (which is required by recent systems, including the latest Windows), you will need to ensure that everything necessary is installed for GRUB to reference Q4OS in the ESP. Make sure that the ESP partition is mounted in /boot/efi. We see in #19 that this partition no longer exists, apparently because you have done a big cleanup since the message #5.
- If you are forced to set up Secure Boot, you will need to create a FAT32 (vfat) partition of a few hundred Mo on your disk (personally, I allocate 256Mo) and then reference it in /etc/fstab so that it mounts in /boot/efi. If the question arises, it will be a good opportunity to ask it on the forum ;-)
If the EFI partition exists, you can then verify that it is mounted with:mount | grep efi # You should see two lines like: # efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime) # /dev/nvme0n1p2 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro) # If nothing appears, it means that the ESP partition is not mounted. It then needs to be created and mounted. An ESP partition is a FAT32 partition of a few hundred Mio.
Then you can run the following commands so that Grub references your Linux system in the ESP:sudo apt install grub-efi-amd64 sudo update-grub
- Regarding your partitioning.
- You have made an installation on two partitions (swap and /), which is an installation that I informally call a "TFPC" installation (don't bother). This is perfectly correct.
- Advantage: it allows for less constraint (there is no longer a partitioning between the system partition (i.e., /) and the user partition (i.e., /home).
- Disadvantage: If you need to reinstall your system, by overwriting / you will also overwrite your user documents. You must then be careful to save them beforehand (even if it means using a live USB if Q4OS does not start anymore).
- This disadvantage is the reason why on a consumer machine, we generally do the following partitioning:
- Swap: min(2*RAM, 4Go) in swap (used notably for hibernation). Nowadays, as PCs generally have more than 2Go of RAM, we use 4Go.
- System partition: / in ext4 (minimum 15Go, personally I allocate 30Go to be safe)
- User partition: /home in ext4 (the rest)
- You have made an installation on two partitions (swap and /), which is an installation that I informally call a "TFPC" installation (don't bother). This is perfectly correct.
- Regarding the partition model (gpt vs msdos): It is possible to switch from one to the other (see for example here). Nowadays, we prefer gpt, which is less constraining. You can check which is being used with:
sudo fdisk -l
Just as you can perfectly satisfy yourself with a legacy boot (compared to a secure boot), you can perfectly be content with an msdos partitioning as opposed to a gpt partitioning.
Good luck
- Regarding the ESP: you can normally manage it from the EFI settings of your BIOS/UEFI. It usually looks like this. If that's not the case, it seems possible, under Linux, to work on the ESP with efibootmgr:
-
-
jeannets Posted messages 28434 Registration date Status Contributor Last intervention Ambassador 6 609
Boot from an Ubuntu LiveCD, open a terminal, type
sudo add-apt-repository ppa:yannubuntu/boot-repair, update withsudo apt-get update, install withsudo apt-get install -y boot-repair, then launch with(boot-repair &), following the recommended procedure to repair the boot.Otherwise, you need to download the Boot-repair ISO file here
https://sourceforge.net/projects/boot-repair-cd/files/
This ISO can be burned to a CD or USB and boot the PC from it, to repair.
Here is a good guide on the subject:
-
-
So, final result,
I went into the BIOS to check and I changed the boot mode, just to try it out. It was on UEFI First and I switched it to Legacy First...
I saved, exited the BIOS, and launched the install.
Miraculously, the install went smoothly, everything worked well, I am now on the PC and no longer on the USB stick! It's surprising but satisfying!
By the way, I noticed that the new partition created during the install now has only 2 areas: /dev/sda1 in ext4 of 457 GB and /dev/sda2 swap of 8 GB. Whereas before there were 4 or 5 partitions including one unallocated.
I am glad I didn't have to repair Grub or modify the partitions because, with my knowledge, I would have had some difficulties! :) .
Of course, I don't know why things got fixed so simply but hey, I'd prefer it this way...
In any case, thank you jeannets for your input!
Best regards! :)
-
-
Hello,
1) EFI partition (ESP) full: Since you have tested numerous operating systems on this PC, I suspect that your /boot/efi partition (/dev/sda1) is full (or undersized).
In your case, there are some quite surprising things, probably sources of your problem:
- There are two (!) EFI partitions (namely /dev/sda1 and /dev/sdb1): a priori this serves no purpose, one is sufficient. Your BIOS will read the EFI partition (also called ESP) from the disk on which you boot.
- The partition /dev/sdb1 is undersized (it should provide a few hundred MB).
- The command reported in the initial message does not indicate which ESP Q4OS is trying to reference, but clearly, if it is /dev/sdb1, it is normal for it to crash.
- Personally, I would delete it to avoid any risk of confusion during the installation of Q4OS. As an extreme measure, you can (during the installation) disconnect this disk to ensure it does not interfere.
Assuming that only /dev/sda1 is in question, check if it is full with the command:
df -h | grep /dev/sda1
If that is the case, have you tried to remove from your ESP (via your BIOS/UEFI) the systems that are no longer installed?
2) GRUB repair: There are several methods to repair / (re)install GRUB, and the most accessible for the general public currently involves relying on boot-repair. To prepare a boot repair USB key, you don’t necessarily need to go through apt (see here). In your case, whether during the installation of Q4OS or with boot-repair, GRUB needs to be deployed on the disk that your BIOS boots from (typically /dev/sda or /dev/sdb). In your case, I would rather put it on /dev/sda and ensure that your BIOS is indeed booting from this hard drive.
3) Defective hard drive: A hardware explanation is possible but unlikely (you would probably see other error messages). Generally, we keep it "for last" and can verify it by checking for input/output (I/O) errors that appear in the logs (see the files in /var/log). Here is an example.
4) Choice of distribution: In this discussion thread, we're talking about an error specific to GRUB, meaning something common to most distributions. Aside from the version of GRUB and the choice made by the installer for the target ESP partition, the behavior should generally be the same.
Aside: I do not want to start a debate on the choice of distribution, which is personal. However, I do not think one should choose a distribution for its supposed lightness. Technically, it all depends on what you install and launch at startup. It’s better to choose a distribution based on other criteria (documentation, community, ...). My advice:
- Confirmed public: Debian (that's what I use on all my machines) but you need to know how to use APT and install the proprietary drivers that you need. It’s not insurmountable, but probably too complicated when you’re just discovering Linux.
- General public: Ubuntu (which is derived from Debian) or Mint (which is derived from Ubuntu). Regardless of the chosen distribution, you can opt for any variant as the choice of desktop environment is not irrevocable (you can install several in parallel). Note that Ubuntu Server is a variant of Ubuntu without a graphical interface and whose performance should be comparable to Debian without a graphical interface.
Good luck
-
Thank you mamiemando for your help! :)
1) I just learned that testing numerous operating systems like I did (at least 10 or 15 in 8 years ...) saturates the boot/efi partition! This will slow down my experiments a bit, because in the end, there's no point in constantly changing operating systems when (and this is my case) the main task is to go online to manage a website, post photos, etc ...
By the way, I was wondering for a while what the impact of frequently installing a new operating system is.
2) Yes, I will try to repair Grub with boot-repair, but first I need to reread your response carefully because I belong to the General public category :)
Thank you for this information and talk to you later ... :)
-
Thank you mamiemando,
So I went into the BIOS but I didn't find the systems that are no longer installed! Maybe I went through the BIOS too quickly, I'll go back as soon as possible to check!?
But since I was in the BIOS, I changed the boot mode, just to try it out. It was set to UEFI First and I switched it to Legacy First ...
I save, exit the BIOS, and start the installation.
Miracle, the installation went smoothly, everything worked well, I'm now on the PC and no longer on the USB stick! It's surprising but satisfying!
By the way, I noticed that the new partition created during the installation only has 2 areas: /dev/sda1 in ext4 of 457 GB and /dev/sda2 swap of 8 GB. Whereas before there were 4 or 5 partitions including one unallocated.
I'm pleased not to have had to repair the Grub or modify the partitions because, as mentioned earlier, I am part of the General public category with little knowledge! :) .
For now, everything is working well, I'll see how it goes ...
Thank you for all your information, I also take note of your opinion on the choice of a distribution! And I will read your explanation above again!
While on the live USB stick, the command below returned nothing! Nor did another command that jns55 gave me! I don't know why ...
df -h | grep /dev/sda1
Maybe because I executed this command while on the USB stick ... ?!
With my best regards and thank you for your help! :)
-
So,
I went back into the BIOS, but there’s no trace of the previous distributions or the one currently running!
And then, ultimately, since Legacy mode partitioned the disk in a completely different way (2 partitions instead of the usual 4), maybe the old systems were erased?!
Well, I don’t know why things got resolved so easily, but that’s a good thing...! :)
-
Hello
Try boot repair and request a boot-info report. This time, try to follow the tutorials provided on this page.
-
It's done! Thank you, I had already found this tutorial.
The commands given in this tutorial do not work on my PC, or perhaps not at all...
sudo apt install -y boot-repair ; boot-repair
Unable to find the Boot-repair package!
$ sudo add-apt-repository add-apt-repository: command not found
So this brings me back to the original problem: how can I ensure that this installation doesn't fail? Apparently this issue is known.
I want to remind you that the OS I'm trying to install is based on Debian. This PC has already accepted Ubuntu, Fedora, Ubuntu MATE, and 2 or 3 other distributions in the past without any installation problems. So I wonder what is going on, knowing that Q4OS is a lightweight distribution?!
-
-
jeannets Posted messages 28434 Registration date Status Contributor Last intervention Ambassador 6 609
Hello,
I suspect there might be incompatibilities with this PC... or defective sectors on the hard drive...?? It would have been good to check that before proceeding with this installation.
You can also try Mint (https://www.commentcamarche.net/informatique/linux/33111-linux-mint-22-1-beta/) to see if it works better.
This problem comes from GRUB that isn't installing... or is installing poorly...
Was the disk formatted before this installation...? And was the installation position and GRUB properly defined at the beginning of the installation...? Generally in /
-
Thank you, Jeannets!
Yes, this PC has some incompatibilities. For example, it refuses Linux Mint MATE, Linux Mint LMDE (Debian), but it has previously accepted Ubuntu, Fedora, and recently Ubuntu MATE (which I will try to reinstall if I can't find solutions for Q4OS...).
When this PC rejected Mint or LMDE, there were errors reported in red in the install script, but with Q4OS that was not the case. Everything was OK! So, I'm wondering...
No, the disk was not formatted before this installation, and I don't know the position of GRUB...
In general, I don't know much about it; I can use the Terminal if someone tells me which command to put in, but no more than that...
On an Ubuntu forum, someone managed to solve the problem with boot-repair, but it was to install Ubuntu! And Q4OS is a Debian...
Thank you for your input :)
-