Skip to content

Conversation

@TheTesla
Copy link

@TheTesla TheTesla commented Jul 8, 2017

I thought development is done on master branch. Now it seems everything is done in develop. So I did my changes also in this branch.


[Service]
Type=simple
ExecStartPre=/usr/bin/prime-select intel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be:

ExecStartPre=-/usr/bin/prime-select intel

As prime-select is only available on certain distributions, not everywhere.

@@ -0,0 +1,206 @@
/***********************************************************************
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the same GPL headers as other source files

@TheTesla
Copy link
Author

I did the changes you asked me to do. You can merge it now.

@bluca
Copy link
Member

bluca commented Jul 16, 2017

Looks fine for me, even though it's just to work around a limitation in the Ubuntu drivers, but @Lekensteyn and @ArchangeGabriel need to approve

@TheTesla
Copy link
Author

I have the prime-select intel only in scripts/systemd/bumblebeed.service.in
It would be nice, if someone with knowledge about sysvinit and upstart could do it for this.

@Lekensteyn
Copy link
Member

Lekensteyn commented Jul 16, 2017

The old Upstart script for Ubuntu detected the drivers right here:
https://github.com/Bumblebee-Project/bumblebee-ppa/blob/master/xenial/bumblebee/debian/bumblebee.bumblebeed.upstart

For systemd.. hmm, that has never been updated.

The proposed patch has some potential issues:

  • memory leaks (malloc not being freed)
  • not checking result of malloc
  • potential deep recursion if for some reason (e.g. custom kernels) you have symlinks to outside the directory, e.g. /lib/modules/XXX/source -> /tmp/source
  • why not use the glob function instead of a custom wildcard implementation that needs scandir?

Rather than modifying the C source code to accomodate an Ubuntu-specific problem, what about a custom systemd configuration for Ubuntu which does the equivalent of the upstart script?

It could even be a drop-in file in /lib/systemd/system/bumblebeed.service.d/, something like:

[Service]
ExecStart=
ExecStart=/usr/bin/bumblebeed.wrap

with bumblebeed.wrap being this Ubuntu-specific script that detects the path and passes corresponding bumblebeed options. Or alternatively play with EnvironmentFile, see https://lists.freedesktop.org/archives/systemd-devel/2012-October/007273.html

Sketch of the idea (untested, creating bumblebee-detect-nvidia is an exercise for the reader):

# /lib/systemd/system/bumblebeed.service.d/ubuntu-nvidia-detect.conf
[Service]
# Load driver options (if any), use a reasonable default
Environment=PKGNAME=nvidia
EnvironmentFile=-/run/bumblebeed.options

# Disable previous ExecStart command
ExecStart=
# run script that writes detected driver to a file
ExecStartPre=-/usr/bin/bumblebee-detect-nvidia
# Start bumblebeed with detected nvidia driver
ExecStart=/usr/bin/bumblebeed --driver nvidia --driver-module "$PKGNAME" --ldpath "/usr/lib/$PKGNAME:/usr/lib32/$PKGNAME" --module-path "/usr/lib/$PKGNAME/xorg,/usr/lib/xorg/modules"

@TheTesla
Copy link
Author

@Lekensteyn: Your solution looks better. At first I searched for a solution not modifying the bumblebeed itself. I had not noticed the cli options. I also didn't know it is done already for upstart or sysvinit. I think I will write a bash or python script doing the wildcard paths (or automatic detection) for systemd.

@TheTesla
Copy link
Author

@Lekensteyn: Please look at Pull Request #901. This is done with a bash script, not touching the executable itself.

@Lekensteyn
Copy link
Member

Superseded by #901

@Lekensteyn Lekensteyn closed this Aug 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants