Build error when installing bbswitch-dkms on Ubuntu 14.04.3

Asked by flojten

I have an Nvidia Optimus graphic card installed and have the Nvidia driver installed and working for my Intel card, but I cannot switch to the Nvidia card. This is because bbswitch-dkms will not build during install via apt-get or from source.

My system

 * Ubuntu 14.04.3 LTS
 * NVIDIA Corporation GF119M [GeForce GT 520M]
 * linux-image-3.19.0-42-generic
 * linux-headers-3.19.0-42-generic
 * linux-image-extra-3.19.0-42-generic
 * dkms: 2.2.0.3
 * gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4

When trying to install bbswitch-dkms the following error occurs:

Unpacking bbswitch-dkms (0.8-2~trustyppa1) over (0.8-2~trustyppa1) ...
Setting up bbswitch-dkms (0.8-2~trustyppa1) ...
Loading new bbswitch-0.8 DKMS files...
Building only for 3.19.0-42-generic
Building initial module for 3.19.0-42-generic
Error! Bad return status for module build on kernel: 3.19.0-42-generic (x86_64)
Consult /var/lib/dkms/bbswitch/0.8/build/make.log for more information.

The content of make.log is:

DKMS make.log for bbswitch-0.8 for kernel 3.19.0-42-generic (x86_64)
sön 10 jan 2016 11:28:28 CET
make -C /lib/modules/3.19.0-42-generic/build M="$(pwd)" modules
make[1]: Entering directory `/usr/src/linux-headers-3.19.0-42-generic'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
  CC [M] /var/lib/dkms/bbswitch/0.8/build/bbswitch.o
/var/lib/dkms/bbswitch/0.8/build/bbswitch.c: In function ‘is_card_disabled’:
/var/lib/dkms/bbswitch/0.8/build/bbswitch.c:239:1: internal compiler error: Bus error
 }
 ^

It seems this is the main problem:

make[1]: Entering directory `/usr/src/linux-headers-3.19.0-42-generic'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken

The following log entries appear in syslog during installation and building bbswitch-dkms:

kernel: [ 235.068506] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
kernel: [ 235.071273] ata1.00: irq_stat 0x40000001
kernel: [ 235.074011] ata1.00: failed command: READ DMA
kernel: [ 235.076740] ata1.00: cmd c8/00:08:a8:95:07/00:00:00:00:00/e0 tag 27 dma 4096 in
kernel: [ 235.076740] res 51/40:00:a8:95:07/00:00:00:00:00/00 Emask 0x9 (media error)
kernel: [ 235.082207] ata1.00: status: { DRDY ERR }
kernel: [ 235.084957] ata1.00: error: { UNC }
kernel: [ 235.119639] ata1.00: configured for UDMA/133
kernel: [ 235.119667] sd 0:0:0:0: [sda] FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
kernel: [ 235.119674] sd 0:0:0:0: [sda] Sense Key : Medium Error [current] [descriptor]
kernel: [ 235.119680] sd 0:0:0:0: [sda] Add. Sense: Unrecovered read error - auto reallocate failed
kernel: [ 235.119684] sd 0:0:0:0: [sda] CDB:
kernel: [ 235.119687] Read(10): 28 00 00 07 95 a8 00 00 08 00
kernel: [ 235.119704] blk_update_request: I/O error, dev sda, sector 497064
kernel: [ 235.122090] ata1: EH complete

I have installed kernel-headers so all building packages should be installed.

Has anyone encountered this before or know of any solutions?

Thank you!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu bbswitch Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

What is the output of:

apt-cache policy bbswitch-dkms

Thanks

Revision history for this message
flojten (fderenius) said :
#2

Output of apt-cache policy bbswitch-dkms:

bbswitch-dkms:
  Installed: 0.8-2~trustyppa1
  Candidate: 0.8-2~trustyppa1
  Version table:
 *** 0.8-2~trustyppa1 0
        500 http://ppa.launchpad.net/bumblebee/stable/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
     0.7-2ubuntu1 0
        500 http://se.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Then I suggest you contact the PPA maintainer.

Alternatively, remove the PPA and install the version from the Ubuntu repository which is known to work.

Revision history for this message
flojten (fderenius) said :
#4

I have tried the bbswitch-dkms package from Ubuntu repository as well. Same error.

Thanks

Revision history for this message
flojten (fderenius) said :
#5

This can be seen in the following log output:

Unpacking bbswitch-dkms (0.7-2ubuntu1) over (0.7-2ubuntu1) ...
Setting up bbswitch-dkms (0.7-2ubuntu1) ...
Loading new bbswitch-0.7 DKMS files...
Building only for 3.19.0-42-generic
Building initial module for 3.19.0-42-generic
Error! Bad return status for module build on kernel: 3.19.0-42-generic (x86_64)
Consult /var/lib/dkms/bbswitch/0.7/build/make.log for more information.

The content of make.log is:

DKMS make.log for bbswitch-0.7 for kernel 3.19.0-42-generic (x86_64)
lör 9 jan 2016 15:37:02 CET
make -C /lib/modules/3.19.0-42-generic/build M="$(pwd)" modules
make[1]: Entering directory `/usr/src/linux-headers-3.19.0-42-generic'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
  CC [M] /var/lib/dkms/bbswitch/0.7/build/bbswitch.o
/var/lib/dkms/bbswitch/0.7/build/bbswitch.c: In function ‘is_card_disabled’:
/var/lib/dkms/bbswitch/0.7/build/bbswitch.c:236:1: internal compiler error: Bus error
 }
 ^

Source: http://askubuntu.com/questions/719066/problem-installing-bbswitch-on-ubuntu-14-04-3

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#6

I suggest you report a bug

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

For me this points into the direction of problems with the compiler.

What is the output of

which gcc
gcc --version
dpkg -l | grep gcc

Revision history for this message
flojten (fderenius) said :
#8

I have created a bug report and linked it to this question (Bug #1532538).

Output for:

~ > which gcc
/usr/bin/gcc

~ > gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

~ > dpkg -l | grep gcc
ii gcc 4:4.8.2-1ubuntu6 amd64 GNU C compiler
ii gcc-4.8 4.8.4-2ubuntu1~14.04 amd64 GNU C compiler
ii gcc-4.8-base:amd64 4.8.4-2ubuntu1~14.04 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-4.8-base:i386 4.8.4-2ubuntu1~14.04 i386 GCC, the GNU Compiler Collection (base package)
ii gcc-4.9-base:amd64 4.9.1-0ubuntu1 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-4.9-base:i386 4.9.1-0ubuntu1 i386 GCC, the GNU Compiler Collection (base package)
ii lib32gcc1 1:4.9.1-0ubuntu1 amd64 GCC support library (32 bit Version)
ii libgcc-4.8-dev:amd64 4.8.4-2ubuntu1~14.04 amd64 GCC support library (development files)
ii libgcc1:amd64 1:4.9.1-0ubuntu1 amd64 GCC support library
ii libgcc1:i386 1:4.9.1-0ubuntu1 i386 GCC support library

Revision history for this message
Manfred Hampl (m-hampl) said :
#9

I do not see anything unusual.

You might try re-installing the compiler helps, but I am not optimistic.

sudo apt-get install --reinstall gcc gcc-4.8 gcc-4.8-base

Revision history for this message
flojten (fderenius) said :
#10

Sorry, still the same problem:

make[1]: Entering directory `/usr/src/linux-headers-3.19.0-42-generic'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
  CC [M] /var/lib/dkms/bbswitch/0.7/build/bbswitch.o

and

/var/lib/dkms/bbswitch/0.7/build/bbswitch.c:236:1: internal compiler error: Bus error

Revision history for this message
Manfred Hampl (m-hampl) said :
#11

Just to have complete inventory of the parts that might be relevant in that context:

Please provide the output of

uname -a
lsb_release -crid
dpkg -l | egrep '[ linux-|dkms]'
apt-get --simulate dist-upgrade

Revision history for this message
flojten (fderenius) said :
#12

FYI, I have updated the kernel to 3.19.0-43-generic. It did not solve the problem.

~ > uname -a
Linux xxxx 3.19.0-43-generic #49~14.04.1-Ubuntu SMP Thu Dec 31 15:44:49 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

~ > lsb_release -crid
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty

~ > dpkg -l | egrep 'linux-|dkms'
ii bbswitch-dkms 0.8-2~trustyppa1 all Interface for toggling the power on NVIDIA Optimus video cards
ii dkms 2.2.0.3-1.1ubuntu5.14.04.5 all Dynamic Kernel Module Support Framework
ii linux-firmware 1.127.19 all Firmware for Linux kernel drivers
ii linux-generic-lts-vivid 3.19.0.43.28 amd64 Complete Generic Linux kernel and headers
ii linux-headers-3.19.0-32 3.19.0-32.37~14.04.1 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-32-generic 3.19.0-32.37~14.04.1 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-33 3.19.0-33.38~14.04.1 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-33-generic 3.19.0-33.38~14.04.1 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-42 3.19.0-42.48~14.04.1 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-42-generic 3.19.0-42.48~14.04.1 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-3.19.0-43 3.19.0-43.49~14.04.1 all Header files related to Linux kernel version 3.19.0
ii linux-headers-3.19.0-43-generic 3.19.0-43.49~14.04.1 amd64 Linux kernel headers for version 3.19.0 on 64 bit x86 SMP
ii linux-headers-generic-lts-vivid 3.19.0.43.28 amd64 Generic Linux kernel headers
ii linux-image-3.19.0-32-generic 3.19.0-32.37~14.04.1 amd64 Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii linux-image-3.19.0-33-generic 3.19.0-33.38~14.04.1 amd64 Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii linux-image-3.19.0-42-generic 3.19.0-42.48~14.04.1 amd64 Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii linux-image-3.19.0-43-generic 3.19.0-43.49~14.04.1 amd64 Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii linux-image-extra-3.19.0-32-generic 3.19.0-32.37~14.04.1 amd64 Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii linux-image-extra-3.19.0-33-generic 3.19.0-33.38~14.04.1 amd64 Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii linux-image-extra-3.19.0-42-generic 3.19.0-42.48~14.04.1 amd64 Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii linux-image-extra-3.19.0-43-generic 3.19.0-43.49~14.04.1 amd64 Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii linux-image-generic-lts-vivid 3.19.0.43.28 amd64 Generic Linux kernel image
ii linux-libc-dev:amd64 3.13.0-74.118 amd64 Linux Kernel Headers for development
ii linux-sound-base 1.0.25+dfsg-0ubuntu4 all base package for ALSA and OSS sound systems
ii syslinux-common 3:4.05+dfsg-6+deb8u1 all collection of boot loaders (common files)
ii syslinux-legacy 2:3.63+dfsg-2ubuntu5 amd64 Bootloader for Linux/i386 using MS-DOS floppies

~ > apt-get --simulate dist-upgrade
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  libgbm1
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

Revision history for this message
Manfred Hampl (m-hampl) said :
#13

Do the ata1/sda errors show up in the system logs with every attempt to install bbswitch, or was this just occurring once?
This would point in the direction of a hard disk problem.

Revision history for this message
flojten (fderenius) said :
#14

The show up every time. But I have no other disk issues; my system runs as it should in every other way.

Revision history for this message
Manfred Hampl (m-hampl) said :
#15

I recommend that you boot into a live system (e.g. by booting from an Ubuntu installer kit on DVD or USB stick in the "Try Ubuntu without installing" mode) and perform a full file system check on the partitions on /dev/sda

Revision history for this message
flojten (fderenius) said :
#16

I will do that and report back. Thank you!

Revision history for this message
flojten (fderenius) said :
#17

Ran file system check via GParted and no errors, see log below. Tried reinstalling bbswitch-dkms but get the same errors as before.

GParted 0.18.0 --enable-libparted-dmraid --enable-online-resize

Libparted 2.3
Check and repair file system (ext4) on /dev/sda1 00:00:14 ( SUCCESS )

calibrate /dev/sda1 00:00:00 ( SUCCESS )

path: /dev/sda1
start: 2048
end: 1448566783
size: 1448564736 (690.73 GiB)
check file system on /dev/sda1 for errors and (if possible) fix them 00:00:14 ( SUCCESS )

e2fsck -f -y -v -C 0 /dev/sda1

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

447311 inodes used (0.99%, out of 45268992)
2642 non-contiguous files (0.6%)
418 non-contiguous directories (0.1%)
# of inodes with ind/dind/tind blocks: 0/0/0
Extent depth histogram: 380790/876
13915439 blocks used (7.69%, out of 181070592)
0 bad blocks
1 large file

331835 regular files
41298 directories
57 character device files
25 block device files
7 fifos
30 links
74075 symbolic links (65543 fast symbolic links)
5 sockets
------------
447332 files
e2fsck 1.42.9 (4-Feb-2014)
grow file system to fill the partition 00:00:00 ( SUCCESS )

resize2fs -p /dev/sda1

resize2fs 1.42.9 (4-Feb-2014)
The filesystem is already 181070592 blocks long. Nothing to do!

========================================

Revision history for this message
Manfred Hampl (m-hampl) said :
#18

Sorry, but I am at my wits' end. I have no idea what to recommend besides the steps already done.

Revision history for this message
flojten (fderenius) said :
#19

Thank you for all your help, it's been appreciated!

Revision history for this message
Launchpad Janitor (janitor) said :
#20

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
flojten (fderenius) said :
#21

Still having problems.

2016-01-27 9:47 GMT+01:00 Launchpad Janitor <
<email address hidden>>:

> Your question #280808 on bbswitch in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/bbswitch/+question/280808
>
> Status: Open => Expired
>
> Launchpad Janitor expired the question:
> This question was expired because it remained in the 'Open' state
> without activity for the last 15 days.
>
> --
> If you're still having this problem, you can reopen your question either
> by replying to this email or by going to the following page and
> entering more information about your problem:
> https://answers.launchpad.net/ubuntu/+source/bbswitch/+question/280808
>
> You received this question notification because you asked the question.
>

Revision history for this message
Best Manfred Hampl (m-hampl) said :
#22

Both the dmesg log and the smartctl output in the bug report refer to a defective disk sector 497064
It would be interesting to know the file that occupies that space.
https://www.gra2.com/article.php/20041015232512624 shows how to find out

Revision history for this message
flojten (fderenius) said :
#23

Thanks Manfred Hampl, that solved my question.

Revision history for this message
flojten (fderenius) said :
#24

It was a gcc related file that occupied the faulty sector. I moved the file and filled the sector with zeroes. Then i reinstalled gcc which solved the problem.