Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save omair18/b40682e4d00e31047075822c6969fac8 to your computer and use it in GitHub Desktop.
Save omair18/b40682e4d00e31047075822c6969fac8 to your computer and use it in GitHub Desktop.
Setting up Ubuntu on Dell 7559
### NOTE ###
The below gist is converted to a blog post and available at below link. Refer than instead.
http://hemenkapadia.github.io/blog/2016/05/07/Ubuntu-with-Nvidia-Bumblebee.html
#### Note about kernel versions ####
Between kernel versions 4.2 and 4.4 there are different options that need to bet set
to get this working. The same is highlighted below when necessary. I have not tested
version 4.3 so not sure which of the two settings work, in which case try either one.
#### GRUB settings during install and first restart ####
Add the follwoing kernel options just before `quiet splash` in the GRUB boot
menu while trying to install using a live USB and the very first start of the
machine post installation.
```
kernel 4.2 - nomodeset i915.modeset=1
kernel 4.4 - nomodeset i915_bpo.modeset=1
```
#### Make the GRUB settings persistent ####
To avoid updating the kernel options each time the system is booted, update the
GRUB settings as below, based in your Ubuntu version
`sudo vi /etc/default/grub`
kernel 4.2 - `GRUB_CMDLINE_LINUX_DEFAULT="nomodeset i915.modeset=1 quiet splash`
kernel 4.4 - `GRUB_CMDLINE_LINUX_DEFAULT="nomodeset i915_bpo.modeset=1 quiet splash`
For High DPI or Retina displays GRUB boot menu options are not readable as the font size
is too small. It can be fixed by the below two options
```
GRUB_GFXMODE=1280x1024
GRUB_GFXPAYLOAD_LINUX=keep
```
Set Windows as the default system to boot
> This setting specific to my laptop, replace accordingly with the Windows label for your
> system
`
GRUB_DEFAULT="Windows Boot Manager (on /dev/sda1)"
`
Apply the changes made to `/etc/default/grub` file
`sudo update-grub2`
#### Scaling of the Unity UI ####
This issue is only observed on HighDPI or Retina displays on 15.10. It was not experienced on 16.04
In Unity search for Display and open it. Drag the slider for
'Scale for menu and title bars:' to 2 (or any other depending in your display).
Apply the setting.
#### Scaling of Virtual Console fonts ####
On High DPI or Retina displays fonts on the Virtual Console are very small making it difficult
to read. to fix this issue, first create the configuration
`sudo dpkg-reconfigure console-setup`
select the following options
```
Encoding - UTF-8
Character Set - . Combined - Latin; Salvic Cyrillic; Greek
Font for console - Terminus
Font Size - 16x32
```
Next edit `/lib/systemd/system/console-setup.service` and in `[Service]`
section add `ExecStart=/bin/setupcon` to the bottom of the section.
Next edit `/etc/init/console-setup.conf` and add `exec /bin/setupcon` to the bottom of the file
This causes `/bin/setupcon` command to run each time on boot, applying the settings
configuredearlier modifying the console as per elected settings.
If any time virtual console is showing tiny fonts (e.g. in recovery mode) run `/bin/setupcon`
and it will fix the console.
#### Mouse pointer size ####
This issue was experienced on 15.10, but not experienced on 16.04. On High DPI or
Retina displays the mouse pointer appears considerably small in size.
Add the setting `Xcursor.size: 48` in `/etc/X11/Xresources/x11-common`
#### Conflicting/Changing time on dual boot Linux and Windows ####
this no longer is valid in 16.04
In BIOS ensure the hardware clock time is set as per UTC time. Refer to the
documentation of appropriateBIOS on how this needs to be done.
Add/Update the UTC setting in `/etc/default/rcS` to be `UTC=yes`
#### Maximum brightness ####
This issue is noticed in 15.10 and 16.04 was weell, but in 16.04 the brightness level
seems to persist once chnaged manually. This was not the case in 15.10
> Note the path of the file is dependent on your graphics card.
Fix is to add the following line above the `exit 0` line in
`/etc/rc.local` (note above exit 0)
`echo 339 > /sys/class/backlight/intel_backlight/brightness`
To get the desired number (339 in the above case), adjust brightness to the desired
level and issue comment to get the required number
`cat /sys/class/backlight/intel_backlight/brightness`
#### Restart ####
Restart your system and verify that above points are working as expected.
# Configure nvidia, bumblebee #
1. Restart the machine
2. Switch to Vconsole
3. sudo service lightdm stop (to stop the x server)
4. Remove any existing installs of nvidia, nouveau etc.
```
sudo apt-get remove --purge nvidia*
sudo apt-get remove --purge bumblebee*
sudo apt-get --purge remove xserver-xorg-video-nouveau
for 14.04.4 LTS the xservers were
xserver-xorg-video-all-lts-wily
xserver-xorg-video-nouveau-lts-wily
```
5. Blacklist nouveau drivers `sudo vi /etc/modprobe.d/blacklist.conf`
Add the following lines to the file
```
# Blacklisting nouveau to get nvidia running with bumblebee
blacklist nouveau
blacklist lbm-nouveau
alias nouveau off
alias lbm-nouveau off
options nouveau modeset=0
```
6. Disable gpu-manager.service for both systemctl as well as init
```
sudo systemctl mask gpu-manager.service
sudo vi /etc/init/gpu-manager.conf
```
```
# Comment these start on settings ; GPU Manager ruins our work
#start on (starting lightdm
# or starting kdm
# or starting xdm
# or starting lxdm)
task
exec gpu-manager --log /var/log/gpu-manager.log
```
7. Create initramfs `sudo update-initramfs -u -k all`
NOTE - something happened here and lightdm was not starting. vconsle was woring
in vconsole if i put sudo service lightdm start it was starting.
To fix it is ran the command
sudo dpkg-reconfigure lightdm
8. Reboot the system and verify that nouveau is successfully blacklisted. The below command
should not return any lines with the word nouveau in it.
```
lsmod | grep nouveau
```
9. Check if gpu-manager.service is disabled
```
sudo systemctl status gpu-manager.service
```
Ubuntu nvidia drivers seems to install 361. To try 352 drivers i need to add the graphics-drivers ppa
sudo apt-add-repository pps:graphics-drivers/ppa
sudo apt-get update
sudo apt-cache policy nvidia-352
Note the selected package next to the Candidate option. It picks the version from Ubuntu repositories which then link to nvidia-361. To use the
nvidia-352 we need to pin this to the graphics driver ppa
Create a file /etc/apt/preferences with the contents
Package: nvidia-352 libcuda1-352 nvidia-opencl-icd-352
Pin: origin ppa.launchpad.net
Pin-Priority:600
sudo apt-get update
sudo apt-cache policy nvidia-352 (notice that the candidate would now change to the pp one)
10. Install nvidia drivers
```
sudo service lightdm stop (in vconsole)
sudo apt-get install --no-install-recommends nvidia-361
sudo apt-get install libcuda1-361 nvidia-opencl-icd-361
sudo apt-get install --no-install-recommends bumblebee
sudo apt-get install bumblebee-nvidia primus
sudo apt-get install mesa-utils
```
```
12. Add the following two lines to the `/etc/modules-load.d/modules.conf` file
```
# for kernel 4.2, use below two lines
i915
bbswitch
#for kernel 4.4, use the below two lines
i915_bpo
bbswitch
```
13. Blacklist nvidia from loading, its insertion and removal from the kernel
will be handled by bbswitch. Add the following lines to `/etc/modprobe.d/bumblebee.conf`.
```
# 352
blacklist nvidia-352
blacklist nvidia-352-updates
blacklist nvidia-experimental-352
#361
blacklist nvidia-361
blacklist nvidia-361-updates
blacklist nvidia-experimental-361
```
14. Bumblebee configuration
```
sudo vi /etc/bumblebee/bumblebee.conf
## Configuration file for Bumblebee. Values should **not** be put between quotes
[bumblebeed]
VirtualDisplay=:8
KeepUnusedXServer=false
ServerGroup=bumblebee
TurnCardOffAtExit=false
NoEcoModeOverride=false
Driver=nvidia
XorgConfDir=/etc/bumblebee/xorg.conf.d
## Client options. Will take effect on the next optirun executed.
[optirun]
Bridge=primus
VGLTransport=proxy
PrimusLibraryPath=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus
AllowFallbackToIGC=false
## Section with nvidia driver specific options, only parsed if Driver=nvidia
[driver-nvidia]
KernelDriver=nvidia-361
PMMethod=bbswitch
LibraryPath=/usr/lib/nvidia-361:/usr/lib32/nvidia-361
XorgModulePath=/usr/lib/nvidia-361/xorg,/usr/lib/xorg/modules
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia
## Section with nouveau driver specific options, only parsed if Driver=nouveau
# [driver-nouveau]
# KernelDriver=nouveau
# PMMethod=auto
# XorgConfFile=/etc/bumblebee/xorg.conf.nouveau
sudo vi /etc/bumblebee/xorg.conf.nvidia
Section "ServerLayout"
Identifier "Layout0"
Option "AutoAddDevices" "false"
Option "AutoAddGPU" "false"
EndSection
Section "Device"
Identifier "DiscreteNvidia"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BusID "PCI:02:00:0"
Option "ProbeAllGpus" "false"
Option "NoLogo" "true"
Option "UseEDID" "false"
Option "UseDisplayDevice" "none"
EndSection
sudo vi /etc/X11/xorg.conf
Section "ServerLayout"
Identifier "layout"
Screen 0 "intel"
Inactive "nvidia"
EndSection
Section "Device"
Identifier "intel"
Driver "intel"
BusID "PCI:00:02:0"
Option "AccelMethod" "SNA"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:02:00:0"
Option "ConstrainCursor" "off"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration" "on"
Option "IgnoreDisplayDevices" "CRT"
EndSection
```
13. Update alternatives
```
sudo update-alternatives --config x86_64-linux-gnu_gl_conf (select mesa)
11. Enable bumblebee daemon
```
sudo systemctl enable bumblebeed`
TODO - shoudl we also do for gnu_egl, i386_linux_gl_conf and egl too ? TODO yes i did everything in this comment https://github.com/Bumblebee-Project/Bumblebee/issues/759
sudo ldconfig
sync
generate initramfs
sudo systemctl
sudo usermod -a -G bumblebee $USER
exit (from the vconsole and then again come in)
optirun -b primus -vv glxinfo | grep OpenGL (should show Nvidia)
glxinfo | grep OpenGL (should show intel)
glxgears -info (shows intel)
optirun -b primus -vv glxgears -info | grep OpenGL
```
14. Reboot the system
15. Testing everything
```
optirun -b primus -vv glxinfo | grep OpenGL (should show Nvidia)
glxinfo | grep OpenGL (should show intel)
glxgears -info (shows intel)
optirun -b primus -vv glxgears -info | grep OpenGL
In another termial, while optirun commands are executed, use the below commeand to see
bbswitch getting on and off when nvidia is in action
cat /proc/acpi/bbswitch
Also see lsmod to see that nvidia drivers are getting inserted and removed from the kernel
```
everything worked by glxinfo was showing vmware string to installed xserver-xorg-video-intel-lts-wiley and then generated ramfs
restarts
that took care of it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment