3

I wanted to create my own operating system, so I created a distro image with archiso. It's pretty cool!

I created a python file that helps to automate the installation of my distro.

And there is the part that transfers the file to the chroot and then later installs GRUB. It works, but after restarting and the system already installed appears as "Arch Linux".

In the installation file I made in Python, I use the line os.system("COMMAND LINUX") to execute Linux commands

Is there any command or file I need to change to rename Arch Linux to my distro name? To put it in the installation automation file after installing GRUB so that after the person restarting it already appears "My OS"

PS: Don't tell me to change the menuentry of /boot/grub/grub.cfg, because it automatically overrides.

1
  • 1
    Look at these (2) files: /etc/default/grub and /etc/os-release; you'll need to upgrade GRUB after modifying the 1st file. Apr 12, 2022 at 15:20

1 Answer 1

3

Do you know how /boot/grub/grub.cfg is generated?

There is a collection of scripts in /etc/grub.d/ which are executed by grub2-mkconfig to create the grub.cfg file. Usually, the script named 10_linux will be responsible for creating the actual boot menu items for the current distribution. If you have two or more OSs installed the 30_os-prober might be the script that creates the menu items for the other OSs.

At least in Debian, the 10_linux gets the name of the distribution from the variable GRUB_DISTRIBUTOR which is set in /etc/default/grub. But even in there, the value is set indirectly, using the command lsb_release -i -s.

So you could just change how the GRUB_DISTRIBUTOR variable is set in /etc/default/grub to quickly change the name of the distribution visible in GRUB.

But you might also want to examine the actual /usr/bin/lsb_release command (assuming Arch has that too). Turns out it is a Python script. If you change the way this script gets the name of the distribution to make it output the result "My OS", this would automatically change the name visible in GRUB, but since the lsb_release command can be used in multiple places, changing the script might allow you to get the name "My OS" at once to many other places, not just into GRUB menu.

But if the package management system also uses the information provided by the lsb_release command, changing the OS name there might make it harder to use Arch's software packages in your customized distribution. If you just want your distribution to be a "pre-customized version of Arch", you might not want that.

2
  • Thanks, i will try and then i will respond
    – Devilas
    Apr 12, 2022 at 16:35
  • I checked the /etc/default/grub file but im a little confused... I found the GRUB_DISTRIBUTOR variable but it says "Arch" And in GRUB says Arch Linux Its a bug or is like that?
    – Devilas
    Apr 12, 2022 at 16:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .