You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

2011款MacBook Pro Ubuntu Live DVD模式下写入efivars失败求助

Fixing "bash: printf: write error: Invalid argument" When Disabling Discrete GPU on 2011 MacBook Pro Ubuntu Live DVD

Let's break down why you're hitting this error and how to fix it—this is a common gotcha with EFI variables on older MacBooks.

The Root Cause

When writing to EFI variables via /sys/firmware/efi/efivars, each file requires a 4-byte attribute header before the actual value you want to set. Your current command only writes the 4-byte value (\x01\x00\x00\x00) which overwrites the required attribute data, leading the system to reject the write with "Invalid argument".

Step-by-Step Solution

  1. Ensure you're running as root
    In the Ubuntu Live DVD environment, you’ll need elevated privileges. Either prefix commands with sudo or switch to root with:

    sudo -i
    
  2. Write the variable with the correct attribute header
    The gpu-power-prefs variable needs the standard EFI variable attributes (non-volatile, boot service access, runtime access) encoded as \x07\x00\x00\x00 (little-endian for 0x07). Append your desired value to this header:

    printf "\x07\x00\x00\x00\x01\x00\x00\x00" > /sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9
    
  3. Verify the variable was set correctly
    Check the contents to confirm:

    hexdump -C /sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9
    

    You should see output starting with 00000000 07 00 00 00 01 00 00 00—the first four bytes are the attributes, the next four are your preference to use the integrated GPU.

If the Variable Already Exists

If the gpu-power-prefs file already exists, you can first read its existing attributes to avoid overwriting them incorrectly:

# Read the first 4 bytes of the existing variable
head -c 4 /sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9 > attr.bin
# Append your desired value and write back
cat attr.bin <(printf "\x01\x00\x00\x00") > /sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9
rm attr.bin

Additional Notes for 2011 MacBook Pro

Even after setting this variable, you might need to add kernel parameters to fully disable the discrete GPU during boot:

  • When booting from the Live DVD, press e in GRUB to edit the boot entry
  • Add nouveau.blacklist=1 acpi_osi=Darwin to the end of the line starting with linux
  • Press Ctrl+X to boot with these parameters

This helps avoid conflicts between the NVIDIA nouveau driver and the integrated Intel GPU.

内容的提问来源于stack exchange,提问作者Wes Sayeed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 07:23:32