Unlocking corectrl, updating grub problems

Hi again,

I’m having trouble completing the final steps of installing and unlocking corectrl from here: Setup · Wiki · CoreCtrl / CoreCtrl · GitLab

" Edit the file /etc/default/grub as root and append amdgpu.ppfeaturemask=0xffffffff to GRUB_CMDLINE_LINUX_DEFAULT"

I edited the file and added the parameters but when regenerating grub, things don’t seem to compute

sudo grub-mkconfig -o /boot/grub/grub.cfg
or
sudo update-grub

Doesn’t seem to work

sudo update-grub
/etc/default/grub: line 1: #: command not found

Can anyone see what I’m doing wrong?

/etc/default/grub

# GRUB boot loader configuration

GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR='Manjaro'
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash apparmor=1 security=apparmor udev.log_priority=3 amdgpu.ppfeaturemask=0xffffffff"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Set to 'countdown' or 'menu' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE=hidden

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command 'videoinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
GRUB_COLOR_NORMAL="light-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/usr/share/grub/background.png"
GRUB_THEME="/usr/share/grub/themes/manjaro/theme.txt"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT=true

# Uncomment to disable submenus in boot menu
#GRUB_DISABLE_SUBMENU=y

# Uncomment this option to enable os-prober execution in the grub-mkconfig command
GRUB_DISABLE_OS_PROBER=false

# Uncomment to ensure that the root filesystem is mounted read-only so that
# systemd-fsck can run the check automatically. We use 'fsck' by default, which
# needs 'rw' as boot parameter, to avoid delay in boot-time. 'fsck' needs to be
# removed from 'mkinitcpio.conf' to make 'systemd-fsck' work.
# See also Arch-Wiki: https://wiki.archlinux.org/index.php/Fsck#Boot_time_checking
#GRUB_ROOT_FS_RO=true

Does this mean you manually downloaded the source?

Is there a reason to do this rather than just installing the package from the repos?

On to the meat of the issue…

Both grub-mkconfig and update-grub have regular shell shebangs ( #! /bin/sh ) meaning it will use whatever is the system default shell… do you happen to have a weird one at play?

And, assuming its still installed, what happens if you run it explicitly with bash with something like:

sudo bash update-grub
1 Like

I doubt. Repo package don’t configure grub config.

I wouldn’t recommend that flag if you don’t know what to do. It enables control over voltage - if you make mistake you can easily break your GPU. But if you want it anyway use this command to discover correct value (via Arch Wiki)

printf 'amdgpu.ppfeaturemask=0x%x\n' "$(($(cat /sys/module/amdgpu/parameters/ppfeaturemask) | 0x4000))"
3 Likes

Hi, sorry I wasn’t clear about what I was doing. Yes I did install from repos. But to unlock overclocking I need to add the boot parameter “amdgpu.ppfeaturemask=0xffffffff” to my bootloader configuration (grub).

I managed to add the parameter and save but unable to update it to the grub.cfg

sudo bash update-grub 
/etc/default/grub: line 1: #: command not found

Instructions I’m trying to follow:

Full AMD GPU controls
Currently, to have full control of your AMD GPU while using the amdgpu driver, you need to append the boot parameter amdgpu.ppfeaturemask=0xffffffff to your bootloader configuration and reboot.
NOTE: The following instructions are for guidance only. Check your distribution documentation on how to add boot parameters.

GRUB bootloader
Edit the file /etc/default/grub as root and append amdgpu.ppfeaturemask=0xffffffff to GRUB_CMDLINE_LINUX_DEFAULT:

GRUB_CMDLINE_LINUX_DEFAULT="... amdgpu.ppfeaturemask=0xffffffff"
NOTE: In the above example, ... represent other existing parameters. Do not add ... to your GRUB_CMDLINE_LINUX_DEFAULT. You should only add amdgpu.ppfeaturemask=0xffffffff.
Then regenerate the bootloader configuration file with the command:

sudo grub-mkconfig -o /boot/grub/grub.cfg
Reboot your system.
You should have more controls when you select Advanced as Performance mode.

Ok, but this is the first time ever seeing an error like this.

Cannot even find an example in the search engines.

I still wonder … what shell is being used?

Something like;

echo $0
echo $SHELL
/usr/bin/ps -p $$

That first line could be removed… its supposed to be a comment anyways.
But if all # are somehow being interpreted as an unknown command … who knows what else is wrong.

bash I believe

echo $0
bash

I’ll try remove that first line.

I wonder If I managed to corrupt the file opening it in office my first attempt. I am very new to all this. could I replace the file somehow and start again?

Sure …

sudo mv /etc/default/grub /etc/default/grub.bak
curl -s https://gitlab.manjaro.org/packages/core/grub/-/raw/master/grub.default | sudo tee /etc/default/grub
2 Likes

just a placebo impression.
Isn’t it possible that an inappropriate character invisible to the human eye has been inserted on the first line??

I saw the following message in my environment the other day. The cause was that I simply forgot to comment it out.

yours::
/etc/default/grub: line 1: #: command not found
mine::
❱ head -3 /etc/default/grub
#ME  sudo grub-mkconfig -o /boot/grub/grub.cfg
LANG=C # not using locale ja_JP
GRUB_SAVEDEFAULT=true




2 Likes

Replacing the file seem to do the trick. I guess I broke the file when I opened it with office lol.

What would be the correct app to open this type of file?

Thanks very much for the help everyone.

Any plain text editor. a Few examples:

Or if you’re feeling adventurous, there’s always vi :supervillain: :smile:

2 Likes

Any plain text editor should do. You have not set your desktop environment in your profile, so I cannot be more specific, but in Plasma, kwrite or kate would be suitable editors, and in GNOME, gnome-text-editor — I don’t know what the other environments come installed with.

Alternatively, you could also use nano, which is a terminal-based editor. It should normally come installed by default in all three of the official Manjaro editions.


Important note: Do also bear in mind that you should never use a Windows application for editing a UNIX text file, because Windows uses both a carriage return and a newline character as the end-of-line denominator, while UNIX only uses a newline character.

The presence of the carriage return character in a UNIX configuration file or script will lead to malfunctions.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.