Results 1 to 9 of 9

Thread: OpenGL -> No switching after update

  1. #1
    Join Date
    May 2009
    Beans
    66

    OpenGL -> No switching after update

    Hello,

    I am trying to set the permissions right to switch between my two cards: Intel i915 and ATI.

    It worked before, but I cannot
    Code:
    echo DIS > (sudo) cat /sys/kernel/debug/vgaswitcheroo/switch
    bash: sudo: Permission denied
    Code:
    echo ON > sudo cat /sys/kernel/debug/vgaswitcheroo/switch
    bash: sudo: Permission denied
    anymore (the 'sudo' between () is optional, could not do it with or without 'sudo').

    Code:
    cat /sys/kernel/debug/vgaswitcheroo/switch
    shows me a permission error.

    Code:
    sudo cat /sys/kernel/debug/vgaswitcheroo/switch
    shows me the output as usual.

    This all happend after an update from OpenGL.

    Settings/permissions:
    bla:/usr/local/bin$ sudo ls -laF /sys/kernel/debug/vgaswitcheroo/switch
    -rw-r--r-- 1 root plugdev 0 2011-04-26 20:59 /sys/kernel/debug/vgaswitcheroo/switch

    bla:/usr/local/bin$ ls -laF switch
    -rwxr-xr-x 1 root username 563 2011-04-20 19:41 switch*

    Thank you in advance.
    Last edited by tembares; April 27th, 2011 at 02:35 AM.

  2. #2
    Join Date
    Jun 2007
    Location
    Brandon, Vermont USA
    Beans
    62
    Distro
    Ubuntu

    Re: OpenGL -> No switching after update

    Hey Tembares,

    Try this replacing any $name in both commands with your username:
    Code:
    sudo su
    chown -R $name:$name /sys/kernel/debug
    chown $name:$name /sys/kernel/debug/vgaswitcheroo/switch
    exit
    Then try the cat and echo again. Hope this works!
    Chad Merkert

  3. #3
    Join Date
    May 2009
    Beans
    66

    Re: OpenGL -> No switching after update

    Quote Originally Posted by chadmerkert View Post
    Hey Tembares,

    Try this replacing any $name in both commands with your username:
    Code:
    sudo su
    chown -R $name:$name /sys/kernel/debug
    chown $name:$name /sys/kernel/debug/vgaswitcheroo/switch
    exit
    Then try the cat and echo again. Hope this works!
    That was quick and it worked!
    Let's implement this in the script: http://ubuntuforums.org/showthread.php?t=1716403

  4. #4
    Join Date
    Jun 2007
    Location
    Brandon, Vermont USA
    Beans
    62
    Distro
    Ubuntu

    Re: OpenGL -> No switching after update

    That already is in the script... it should have been placed into your /etc/gdm/PostLogin/Default file! Check to make sure these commands are in there. If your not sure, post the output of cat /etc/gdm/PostLogin/Default

    If they are not in there, these permissions may be lost on reboot.
    Chad Merkert

  5. #5
    Join Date
    May 2009
    Beans
    66

    Re: OpenGL -> No switching after update

    Yep, it was gone after reboot.
    Default:
    Code:
    bla:# cat /etc/gdm/PostLogin/Default
    #!/bin/sh
    chown -R username:username /sys/kernel/debug
    chown username:username /sys/kernel/debug/vgaswitcheroo/switch
    echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
    This makes it more strange.
    Code:
    ls -laF folders/filename
    shows that the group:user settings are root:root.

  6. #6
    Join Date
    May 2009
    Beans
    66

    Re: OpenGL -> No switching after update

    The issue was that I enabled auto logon.
    With auto logon set on 2 seconds with the possibility to switch user before, this problem has been solved.

  7. #7
    Join Date
    Jan 2009
    Beans
    309
    Distro
    Ubuntu Development Release

    Re: OpenGL -> No switching after update

    Making /sys/kernel/debug owned by your user basically means you've opened a significant security hole in your machine (since debugfs exposes a bunch of interfaces to writing to kernel memory) - there is a reason it is owned by root in the first place. I really wouldn't do that. There are other ways to achieve this such as a setuid shell script which contains the

    Code:
    echo XXX > /sys/kernel/debug/vgaswitcheroo/switch
    stuff.
    Last edited by alexmurray; April 27th, 2011 at 06:18 AM.

  8. #8
    Join Date
    Jun 2007
    Location
    Brandon, Vermont USA
    Beans
    62
    Distro
    Ubuntu

    Re: OpenGL -> No switching after update

    Alexmurray,

    If it opens up a security hole, I would like to close it, but I can't figure out how to give my user account permission to access just the /sys/kernel/debug/vgaswitcheroo folder. Without access to this folder, my laptop is must less usable! Can you please tell me how I can give my username permission to edit this file,(without sudo being required) without opening up this security hole? I have tried to chown just the vgaswitcheroo folder, but that still gives me permission denied. Thanks for your help!
    Chad Merkert

  9. #9
    Join Date
    Jun 2007
    Location
    Brandon, Vermont USA
    Beans
    62
    Distro
    Ubuntu

    Re: OpenGL -> No switching after update

    Alexmurray, I'm no professional at Linux security, so I would like to get your input on this. I found a way to use the /sys/kernel/debug/vgaswitcheroo/switch file without using chown on /sys/kernel/debug/

    I have
    Code:
    chmod 705 /sys/kernel/debug/
    Which if I'm correct will only give read and execute permissions to the debug folder
    Then I
    Code:
    chown -R username:username /sys/kernel/debug/vgaswitcheroo
    This way, root is the owner of the debug folder, and other users can only read and execute from the debug folder, and the username selected can read/write/execute the vgaswitcheroo folder.

    I think this should make this much more secure, and it seems to work perfectly. Would you agree that this makes it more secure? Thanks for your input.
    Chad Merkert

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •