So I can go into /etc/default/grub and change the distribution name and then run update-grub, but that only changes the name of the operating system in a that particular grub menu. The name picked up by OS prober from another installation continues to use the same name. Is there any way to change the name of the OS picked up by OS-prober?
Announcement
Collapse
No announcement yet.
Changing OS name picked up by OS prober
Collapse
This topic is closed.
X
X
-
The short answer is "no." The issue is grub on Kubuntu has no real way to determine what is on any other partition as it is configured now.
You could sort of "cheat" your way into what you want. The place to start is /etc/grub.d/30_osprober. There's a way to change the names used by 30_so-prober. For example, this part:
you can see LABEL is available as well as LONGNAME (a group of these detected varibles). So if you set the LABEL for each of your partitions (I'm assuming your other installs exist on separate partitions) to match what you'd like to see in grub, then you'd have your answer. Maybe changing this:Code:for OS in ${OSPROBED} ; do DEVICE="`echo ${OS} | cut -d ':' -f 1`" LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`" LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`" BOOT="`echo ${OS} | cut -d ':' -f 4`" if [ -z "${LONGNAME}" ] ; then LONGNAME="${LABEL}" fi
toCode:menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
might work.Code:menuentry '$(echo "${LABEL} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
- Top
- Bottom
-
Two approaches.
Firstly, the file /etc/lsb-release might look like:The OS prober uses these for the name of the menu entry. If you change them, the OS prober will pick up the changes, and that might be enough for you. AFAICT, you're supposed to be allowed to change the description as an override for what's in /etc/os-release. If I make the description "Kubuntu" the prober generates a menu entry for "Kubuntu (13.10)".Code:DISTRIB_ID=Ubuntu DISTRIB_RELEASE=13.10 DISTRIB_CODENAME=saucy DISTRIB_DESCRIPTION="Ubuntu 13.10"
Secondly.
At the top of /boot/grub/grub.cfg, there is the legend:but the grub documentation at gnu.org encourages people to go their own way:Code:# DO NOT EDIT THIS FILE # # It is automatically generated by grub-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub
I think trying to work in with grub-mkconfig and the scripts it uses in /etc/grub.d is too hard for me. I hand code my own grub.cfg very simply and don't let grub-mkconfig (update-grub just invokes grub-mkconfig) overwrite it.Originally posted by https://www.gnu.org/software/grub/manual/grub/grub.html#Configurationthose who feel that it would be easier to write grub.cfg directly are encouraged to do so
However, I suggest that a halfway approach may be right for you. That would be to write a script, maybe with sed commands, that changes the menu items to what you want. And whenever update-grub is run, either by yourself or as a result of an update, re-run your script to update grub.cfg. For example, I have an old drive with an install of 15.10 on it, and the menu entry generated for it beginsAftermenuentry 'Ubuntu 14.10 (14.10) (on /dev/sdb6)' --class ubuntu...
the menu entry says "Kubuntu Utopic".Code:sed -i.bak -e "s/^menuentry 'Ubuntu 14\.10[^']*'/menuentry 'Kubuntu Utopic'/" /boot/grub/grub.cfg
Regards, John Little
- Top
- Bottom
Comment
-
Thanks that's brilliant. Most of the time I just use the latest Kubuntu version and I don't even look at the GRUB menu which I have on a 2 second timeout. I use the others if I have a problem and want to cross check, or if I want to play around with Wayland or something like that. When I do look at the Grub menu I want to see who owns the grub, what partition the grub owning OS is on (this valuable info is not displayed by default) and if its a buntu entry what flavour the entry actually is.Originally posted by jlittle View PostFirstly, the file /etc/lsb-release
So all I need to do is install,
sudo nano /etc/default/grub
sudo nano /etc/lsb-release
Job done!
If the grub is not on my default os, I can just re-install at anytime. I wish I'd had this info years ago, it would have saved a lot of trouble. Only a few days ago I accidentally overwrote my Tumbleweed install. Not the end of the world but still irritating and avoidable. I might write this up and put it on my website at some point.
- Top
- Bottom
Comment
Users Viewing This Topic
Collapse
There are 0 users viewing this topic.







Comment