Bug 16672 - Unable to pass kernel parameters containing strings with whitespace with grub2
Summary: Unable to pass kernel parameters containing strings with whitespace with grub2
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 5
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL:
Whiteboard: MGA5-64-OK advisory
Keywords: PATCH, validated_update
Depends on:
Blocks:
 
Reported: 2015-08-29 16:06 CEST by Vanya Miloshevski
Modified: 2015-10-07 20:40 CEST (History)
7 users (show)

See Also:
Source RPM: grub2-efi
CVE:
Status comment:


Attachments
output of lshw (9.00 KB, text/x-log)
2015-08-29 19:30 CEST, Vanya Miloshevski
Details

Description Vanya Miloshevski 2015-08-29 16:06:48 CEST
Description of problem:
My laptop (HP Spectre x360) requires passing acpi_osi='!Windows 2012' to the kernel to get the audio working, however somewhere down the line the whitespace inside the quotes gets mangled into \x20 by grub.

I tried different ways of escaping this string and manually editing it at boot time, all to no avail.

Version-Release number of selected component (if applicable):
grub-0.97-41.mga5
grub2-mageia-theme-2.02-0.git9752.18.mga5
grub2-efi-2.02-0.git9752.18.mga5
grub-doc-0.97-41.mga5


How reproducible: 100%


Steps to Reproduce:
1. vim /etc/default/grub

2. Add "acpi_osi='!Windows 2013' acpi_osi='!Windows 2012'" to the GRUB_CMDLINE_LINUX_DEFAULT option.

For example: 
GRUB_CMDLINE_LINUX_DEFAULT=" splash quiet noiswmd resume=UUID=c3c379f3-5e35-4b50-9a87-5fe7dd0c1cdb acpi_backlight=vendor acpi_osi='!Windows 2013' acpi_osi='!Windows 2012'"

3. Run update-grub2

4. Reboot

5. cat /proc/cmdline, returns:
BOOT_IMAGE=/boot/vmlinuz-desktop root=UUID=b7cce935-ae37-428e-8f48-b148b4daedfd ro splash quiet noiswmd resume=UUID=c3c379f3-5e35-4b50-9a87-5fe7dd0c1cdb acpi_backlight=vendor "acpi_osi=!Windows\x202013" "acpi_osi=!Windows\x202012"



Reproducible: 

Steps to Reproduce:
Vanya Miloshevski 2015-08-29 16:08:16 CEST

Hardware: i586 => x86_64

Comment 1 Thomas Backlund 2015-08-29 19:07:36 CEST
Can you attach the output of dmidecode so we can teach the kernel to do the acpi_osi automatically

CC: (none) => tmb

Comment 2 Vanya Miloshevski 2015-08-29 19:30:45 CEST
Created attachment 6981 [details]
output of lshw

Here's the output of lshw.log.

Running dmidecode bizarrely returns:
# dmidecode 
# dmidecode 2.12
# SMBIOS entry point at 0xa9e9b010
# No SMBIOS nor DMI entry point found, sorry.
Comment 3 Thomas Backlund 2015-08-29 20:17:54 CEST
Yeah, seems current dmidecode does not support new hw / dmi / smbios

I've just submitted  a dmidecode-2.12-4.1.mga5 to Core Updates Testing.

When it's available, can you retry with that one
Comment 4 Vanya Miloshevski 2015-08-29 20:34:40 CEST
nearly similar results:

[root@localhost vanja]# rpm -qa | grep dmidecode 
dmidecode-2.12-4.1.mga5
[root@localhost vanja]# dmidecode
# dmidecode 2.12
# SMBIOS entry point at 0xa9e9b010
Found SMBIOS entry point in EFI, reading table from /dev/mem.
# No SMBIOS nor DMI entry point found, sorry.
[root@localhost vanja]#
Comment 5 Thomas Backlund 2015-08-29 20:59:55 CEST
ok, lets try to find out some stuff manually...

can you try:

cat /sys/class/dmi/id/sys_vendor 

cat /sys/class/dmi/id/product_name

cat /sys/class/dmi/id/uevent
Comment 6 Vanya Miloshevski 2015-08-29 21:03:36 CEST
[root@localhost ~]# cat /sys/class/dmi/id/sys_vendor 
Hewlett-Packard
[root@localhost ~]# cat /sys/class/dmi/id/product_name 
HP Spectre x360 Convertible 13 
[root@localhost ~]# cat /sys/class/dmi/id/uevent
MODALIAS=dmi:bvnAmericanMegatrendsInc.:bvrF.22:bd07/16/2015:svnHewlett-Packard:pnHPSpectrex360Convertible13:pvr:rvnHewlett-Packard:rn802D:rvr58.39:cvnHewlett-Packard:ct10:cvrChassisVersion:
[root@localhost ~]#
Comment 7 Thierry Vignaud 2015-09-01 14:30:31 CEST
This is an issue known for years: see eg:
https://bugzilla.redhat.com/show_bug.cgi?id=950760

CC: (none) => zen25000
Summary: Unable to pass kernel parameters containing strings with whitespace => Unable to pass kernel parameters containing strings with whitespace with grub2

Comment 8 Thierry Vignaud 2015-09-01 14:32:55 CEST
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/445952 tells to doble protect in 'strings' or triple protect in "strings"

CC: (none) => thierry.vignaud

Comment 9 Vanya Miloshevski 2015-09-01 16:50:08 CEST
I tried all of those combinations, none of them work for me at least.

I even went as far as editing the /boot files but no combination seem to work.

The bug is discussed at https://bugzilla.redhat.com/show_bug.cgi?id=923374 also
Comment 10 Vanya Miloshevski 2015-09-01 16:51:26 CEST
It appears it only affects UEFI systems, so it didn't receive traction as much until now.
Comment 11 Vanya Miloshevski 2015-09-01 20:10:35 CEST
So this bug isn't upstream. It might've been introduced with Patch0450.

This has been corrected in subsequent patch: http://pkgs.fedoraproject.org/cgit/grub2.git/commit/?id=f178927fdb3f9324a56cd0bb404ec9c2eb1f5ec5
Comment 12 Thierry Vignaud 2015-09-02 12:51:15 CEST
@Barry: we really should sync FC patches with their latest version
Comment 13 Vanya Miloshevski 2015-09-02 23:49:51 CEST
Just to confirm guys, I rebuilt the package applying the patch above and can confirm that it resolves the spaces escaping problem.
Thierry Vignaud 2015-09-03 10:04:23 CEST

Keywords: (none) => PATCH
Assignee: bugsquad => zen25000

Comment 14 Barry Jackson 2015-09-03 13:04:42 CEST
(In reply to Vanya Miloshevski from comment #13)
> Just to confirm guys, I rebuilt the package applying the patch above and can
> confirm that it resolves the spaces escaping problem.

Thanks for your work on this.

I have pushed a patched version grub2-2.02-0.git9752.18.1.mga5 to 5/core/updates_testing.

Please test this version.
Comment 15 Thierry Vignaud 2015-09-03 15:45:44 CEST
Please update cauldron package too...
Comment 16 Barry Jackson 2015-09-03 18:28:11 CEST
(In reply to Thierry Vignaud from comment #15)
> Please update cauldron package too...
Done
Comment 17 Barry Jackson 2015-09-03 18:33:20 CEST
#############################
Update Advisory

grub2-2.02-0.git9752.18.1.mga5 has been submitted to 5/core/updates_testing

This update fixes an issue that blocks the passing of kernel parameters containing strings with white space.

#############################
RPMs affected:

grub2-debuginfo-2.02-0.git9752.18.1.mga5.x86_64.rpm
grub2-mageia-theme-2.02-0.git9752.18.1.mga5.noarch.rpm
grub2-efi-2.02-0.git9752.18.1.mga5.x86_64.rpm
grub2-2.02-0.git9752.18.1.mga5.x86_64.rpm
grub2-debuginfo-2.02-0.git9752.18.1.mga5.i586.rpm
grub2-efi-2.02-0.git9752.18.1.mga5.i586.rpm
grub2-2.02-0.git9752.18.1.mga5.i586.rpm

grub2-2.02-0.git9752.18.1.mga5.src.rpm

############################
Testing

Maybe if Vanya could test this and confirm here that it fixes the issue this will be enough?
Comment 18 Vanya Miloshevski 2015-09-03 23:18:10 CEST
Doesn't work for me. I tried also with grub2-install and then an update-grub, followed by a reboot and got the same result.

[root@localhost ~]# cat /etc/default/grub | grep -i cmd
GRUB_CMDLINE_LINUX_DEFAULT=" splash quiet noiswmd resume=UUID=c3c379f3-5e35-4b50-9a87-5fe7dd0c1cdb acpi_backlight=vendor acpi_osi='!Windows 2013' acpi_osi='!Windows 2012'"

[root@localhost ~]# cat /proc/cmdline 
BOOT_IMAGE=/boot/vmlinuz-desktop root=UUID=b7cce935-ae37-428e-8f48-b148b4daedfd ro splash quiet noiswmd resume=UUID=c3c379f3-5e35-4b50-9a87-5fe7dd0c1cdb acpi_backlight=vendor "acpi_osi=!Windows\x202013" "acpi_osi=!Windows\x202012"

[root@localhost ~]# rpm -qa | grep grub2
grub2-mageia-theme-2.02-0.git9752.18.1.mga5
grub2-efi-2.02-0.git9752.18.1.mga5
[root@localhost ~]# 

I'm not sure what could be wrong.
Comment 19 Barry Jackson 2015-09-04 01:38:42 CEST
Thanks for testing
I figured the errors - I was trying to do too many things today.
I have corrected the patch and re-enumerated them so they apply in the correct order.
Please test grub2-2.02-0.git9752.18.2.mga5 when it lands in 5/core/updates_testing.
Thanks.
Comment 20 Thierry Vignaud 2015-09-04 09:33:50 CEST
It might be easier to synchronise more with FC, applying their patches in their order, then Mageia patches on top of them.
That's what we do for rpm/gdb/valgrind/cups/LO
Comment 21 Barry Jackson 2015-09-04 12:29:21 CEST
(In reply to Thierry Vignaud from comment #20)
> It might be easier to synchronise more with FC, applying their patches in
> their order, then Mageia patches on top of them.
> That's what we do for rpm/gdb/valgrind/cups/LO

I used to do that a few years ago, but there were over 450 patches, so to clear the clutter and stay more in line with upstream development I decided to make an upstream snapshot patch and only add the fd patches that were not already upstreamed on top of that. This one got missed during our long freeze I guess.

There is noise from most distro maintainers (including fd) on the grub-devel ML [1] about the lack of a new grub2 release since 2013 and the difficulty of juggling so many patches, so I am waiting in the hope that something will happen soon, before changing anything more.

[1] https://lists.gnu.org/archive/html/grub-devel/2015-08/msg00140.html
Comment 22 Thierry Vignaud 2015-09-04 12:46:45 CEST
They indeed never heard of "release often" :-(
Comment 23 michel itilo 2015-09-04 19:12:16 CEST
I have exactly the same problem with the same laptop
Thank you if you can do something

CC: (none) => itilo

Comment 24 Vanya Miloshevski 2015-09-04 19:32:06 CEST
Thanks Barry.

The latest version resolves the problem for me:

[root@localhost ~]# cat /proc/cmdline 
BOOT_IMAGE=/boot/vmlinuz-desktop root=UUID=b7cce935-ae37-428e-8f48-b148b4daedfd ro splash quiet noiswmd resume=UUID=c3c379f3-5e35-4b50-9a87-5fe7dd0c1cdb acpi_backlight=vendor "acpi_osi=!Windows 2013" "acpi_osi=!Windows 2012"
[root@localhost ~]# rpm -qa | grep grub2
grub2-efi-2.02-0.git9752.18.2.mga5
grub2-mageia-theme-2.02-0.git9752.18.1.mga5
[root@localhost ~]# 

@michel, to fix the issue you need this new version of grub2 (grub2-efi-2.02-0.git9752.18.2.mga5) and then follow the steps given in the solution at http://h30434.www3.hp.com/t5/Notebook-PC-Sound-and-Audio/HP-spectre-x360-on-linux/td-p/4980797
Comment 25 michel itilo 2015-09-04 19:51:03 CEST
Vanya,Barry
Thank you very much for your quick answer and very efficient action
many thanks
Comment 26 Barry Jackson 2015-09-06 13:19:30 CEST
#############################
Update Advisory

grub2-2.02-0.git9752.18.2.mga5 has been submitted to 5/core/updates_testing

This update fixes an issue that corrupts passed kernel parameters containing strings with white space.

#############################
RPMs affected:

grub2-debuginfo-2.02-0.git9752.18.2.mga5.x86_64.rpm
grub2-mageia-theme-2.02-0.git9752.18.2.mga5.noarch.rpm
grub2-efi-2.02-0.git9752.18.2.mga5.x86_64.rpm
grub2-2.02-0.git9752.18.2.mga5.x86_64.rpm
grub2-debuginfo-2.02-0.git9752.18.2.mga5.i586.rpm
grub2-efi-2.02-0.git9752.18.2.mga5.i586.rpm
grub2-2.02-0.git9752.18.2.mga5.i586.rpm

grub2-2.02-0.git9752.18.2.mga5.src.rpm

############################
Testing

See comments #24 #25

Assignee: zen25000 => qa-bugs

Comment 27 Lewis Smith 2015-09-27 09:59:20 CEST
Testing MGA5 x64

I had already applied the update, so no 'before' scenario:
 grub2-efi-2.02-0.git9752.18.2.mga5
 grub2-mageia-theme-2.02-0.git9752.18.2.mga5

Followed exactly the steps in Comment 0:
- Added
 acpi_osi='!Windows 2013' acpi_osi='!Windows 2012'
to /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT option.
- # update-grub2
- Re-booted.

# cat /etc/default/grub | grep -i cmd
GRUB_CMDLINE_LINUX_DEFAULT=" nokmsboot splash quiet noiswmd resume=UUID=81b56d40-6ba0-457b-9192-5b15bbd3f82b acpi_osi='!Windows 2013' acpi_osi='!Windows 2012'"

# cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-desktop root=UUID=bd02d23f-1f40-44c7-a5f3-81ea6f5624d3 ro nokmsboot splash quiet noiswmd resume=UUID=81b56d40-6ba0-457b-9192-5b15bbd3f82b "acpi_osi=!Windows 2013" "acpi_osi=!Windows 2012"

which is as it should be, the spaces preserved in the last two paramaeters.
Update OK.

CC: (none) => lewyssmith
Whiteboard: (none) => MGA5-64-OK

Comment 28 Rémi Verschelde 2015-09-27 12:05:23 CEST
Advisory uploaded.

Whiteboard: MGA5-64-OK => MGA5-64-OK advisory

Dave Hodgins 2015-10-07 01:21:05 CEST

Keywords: (none) => validated_update
CC: (none) => davidwhodgins, sysadmin-bugs

Comment 29 Mageia Robot 2015-10-07 20:40:23 CEST
An update for this issue has been pushed to Mageia Updates repository.

http://advisories.mageia.org/MGAA-2015-0141.html

Status: NEW => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.