This file is indexed.

/usr/bin/bumblebee-bugreport is in bumblebee 3.2.1-5.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#!/bin/bash
# Copyright (C) 2011-2013 Bumblebee Project
#
# This file is part of Bumblebee.
#
# Bumblebee is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Bumblebee is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Bumblebee.  If not, see <http://www.gnu.org/licenses/>.

BUMBLEBEE_VERSION='3.2.1'
CONFDIR='/etc/bumblebee'
BINDIR='/usr/bin'
SBINDIR='/usr/sbin'

if (( EUID != 0 )); then
    echo "Certain system information can only be gathered as root. This"
    echo "includes the machine manufacturer and model."
    echo
    if which sudo &>/dev/null; then
        echo "Please run: sudo ${0##*/}"
    else
        echo "Please run this script as root"
    fi
    echo
    exit 1
fi

# These tools need to be able to accept multiple packages as arguments
PKG_QUERY_TOOLS=(
    'apt-cache policy'
    'dpkg-query --show'
    'pacman -Q'
    'mpkg-show'
)
PKG_QUERY_TOOL=
PACKAGES=
# this directory will recursively be listed, symlinks are not followed
LIST_DIRS_RECURSIVE=

# Auto-detect packager tool
for tool in "${PKG_QUERY_TOOLS[@]}"; do
    if which "${tool%% *}" &>/dev/null; then
        PKG_QUERY_TOOL="$tool"
        break
    fi
done

# XXX: perhaps LIST_DIRS_RECURSIVE can be separated from the tools
case "$PKG_QUERY_TOOL" in
  apt-cache*|dpkg-query*)
    PACKAGES=(bumblebee virtualgl nvidia-current nvidia-kernel-dkms nvidia-glx libgl1-mesa-glx)
    LIST_DIRS_RECURSIVE=(
        /usr/lib/nvidia-current /usr/lib32/nvidia-current /usr/lib/nvidia /usr/lib/*/nvidia
        /etc/ld.so.conf.d /usr/lib/xorg
    )
    ;;
  pacman*)
    PACKAGES=(bumblebee bumblebee-git xf86-video-nouveau nouveau-dri mesa libgl lib32-nvidia-utils-bumblebee nvidia-utils-bumblebee virtualgl-bin virtualgl32-bin)
    LIST_DIRS_RECURSIVE=(/usr/lib/nvidia-bumblebee /usr/lib32/nvidia-bumblebee)
    ;;
  mpkg-show*)
    PACKAGES=(bumblebeed xf86-video-nouveau mesa libgl nvidia-driver-optimus nvidia-driver-optimus32 virtualgl virtualgl32)
    LIST_DIRS_RECURSIVE=(/usr/lib64/nvidia-optimus /usr/lib/nvidia-optimus)
    ;;
  *)
    # unknown package management tool :/
    ;;
esac

echo
echo "Bug report is being generated"
echo

# Can you read Japanese? I don't.
export LANG=C
export LC_MESSAGES=C

BUGREPORT_TMP="$(mktemp -d)"
BUGREPORT_NAME="bumblebee-bugreport-$(date +%Y%m%d_%H%M%S)"
BUGREPORT_DIR="$BUGREPORT_TMP/$BUGREPORT_NAME"
BUGREPORT_FILE="$BUGREPORT_DIR"/bumblebee-report

mkdir "$BUGREPORT_DIR"

# Copy a logfile if exists, but merge duplicate lines if at least 10% of the
# messages are duplicates
copy_log() {
    local log line skipchars months day hhmmss date hostname msg
    local stripped_time lines_orig lines_new
    log="$1"
    if [ -f "$log" ]; then
        # use the last line for determining the log format
        line="$(tail -1 "$log")"
        skipchars=0

        months='(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)'
        day='[ 123][0-9]'
        hhmmss='[012][0-9]:[0-5][0-9]:[0-5][0-9]'
        date="$months $day $hhmmss"
        # Assume a part looking like 'Jan  1 00:00:00 '
        if [[ "$line" =~ ^$date ]]; then
            # skip over the leading date part and space
            ((skipchars += 16))
        fi

        hostname="$(hostname)"
        # Assume a static machine name part
        if [[ "${line:$skipchars}" == "$hostname "* ]]; then
            # skip over the hostname and space
            ((skipchars += ${#hostname} + 1))
        fi

        # Assume a literal "kernel: " syslog tag part
        if [[ "${line:$skipchars}" == "kernel: "* ]]; then
            ((skipchars += 8))
        fi

        # for the printk timestamp
        msg="${line:$skipchars}"
        # strip leading '[ <any whitespace> <digits> . <digits> ] '
        stripped_time="$(sed -r 's,^\[ *\d+\.\d+\] ,,' <<<"$msg")"
        if [ ${#stripped_time} -lt ${#msg} ]; then
            ((skipchars += ${#msg} - ${#stripped_time}))
        fi

        # Merge duplicate messages
        uniq -s $skipchars -c "$log" > "$BUGREPORT_DIR/${log##*/}"

        lines_orig=$(wc -l "$log" | cut -d' ' -f1)
        lines_new=$(wc -l "$BUGREPORT_DIR/${log##*/}" | cut -d' ' -f1)

        # if the new file is just 10% smaller in lines, use the original log
        if [ $((lines_orig * 9 / 10)) -le $lines_new ]; then
            cp "$log" "$BUGREPORT_DIR/"
        fi
        return 0
    fi
    return 1
}

# Remove non-matching wildcards
shopt -s nullglob

# Copy configuration, preserving times and permissions
cp -pr "$CONFDIR" "$BUGREPORT_DIR"

for log in /var/log/Xorg.* /var/log/bumblebee.*; do
    copy_log "$log"
done

dmesg > "$BUGREPORT_TMP/dmesg"
copy_log "$BUGREPORT_TMP/dmesg"

for kernlog in /var/log/syslog /var/log/kern.log /var/log/kernel.log /var/log/messages; do
    copy_log "$kernlog" && break
done

header() {
    printf '\n=== %s ===\n' "$1"
}

{ # Start bug report
header "Bumblebee Bug Report"
echo "$BUGREPORT_NAME"
date -R -u
echo "Bumblebee version: $BUMBLEBEE_VERSION"

header "dmidecode"

for key in baseboard-manufacturer baseboard-product-name baseboard-version \
    system-manufacturer system-product-name system-version \
    bios-vendor bios-version bios-release-date; do
    printf "%22s : %s\n" "$key" "$(dmidecode --string "$key")"
done

header "System Information"
uname -a
echo "/etc/issue:"
cat /etc/issue
if which lsb_release &>/dev/null; then
    echo "lsb_release -a:"
    lsb_release -a
fi

header "lspci overview"
lspci -nn

header "lspci on nvidia devices"
lspci -d 10de: -vvnn

header "Process information info"
PIDS=$(pidof $(which X Xorg bumblebeed bumblebee optirun optirun32 optirun64 2>/dev/null))
[ -n "$PIDS" ] && ps uww --pid "$PIDS"

header "Directory contents"

for dir in "${LIST_DIRS_RECURSIVE[@]}"; do
    if [ -d "$dir" ]; then
        ls --group-directories-first -laR "$dir"
    fi
done

header "Modules info"
lsmod

if [ -d /etc/alternatives ]; then
    header "Alternatives links"
    alt_links=(/etc/alternatives/*gl_conf* /etc/alternatives/*xorg* /etc/alternatives/*glx* /etc/alternatives/*GL*)
    # only show links if there are any
    [ "${#alt_links[@]}" -eq 0 ] || ls -ld "${alt_links[@]}"

    header "Alternatives info"
    for alt in /var/lib/dpkg/alternatives/*gl_conf* \
        /var/lib/dpkg/alternatives/*xorg*; do
        update-alternatives --display "${alt##*/}"
    done

    header "Alternative links (all)"
    ls -lAtr /etc/alternatives
fi

header "Library info for a GL program"
# Try some programs, we just need the information for a single program
for bin in $(which glxgears glxspheres xdriinfo 2>/dev/null); do
    if ldd "$bin" | grep -qF "libGL.so"; then
        ldd "$bin"
        break
    fi
done

header "Locations of files"
for file in "$SBINDIR/bumblebeed" "$BINDIR/optirun" \
    $(which optirun bumblebeed bumblebee vglrun vglconnect 2>/dev/null); do
    if [ -e "$file" ]; then
        ls -la "$file"
    else
        echo "$file: not found"
    fi
done

header "Modules information"
modinfo bbswitch
modinfo nvidia
modinfo nvidia-current
modinfo nouveau

header "Driver information"
ls -ld /usr/lib/libnvidia*
ls -ld /usr/lib/libGL.so*
ls -ld /usr/lib/libvdpau.so*
ls -ld /usr/lib/*/libnvidia*
ls -ld /usr/lib/*/libGL.so*
ls -ld /usr/lib/*/libvdpau.so*
# non-empty containing 'log' and 1[0-9][0-9] files if the driver was installed
# from nvidia.com
ls -la /var/lib/nvidia

header "Packages info"
if [ -n "$PKG_QUERY_TOOL" ]; then
    echo "Using tool: $PKG_QUERY_TOOL"
    $PKG_QUERY_TOOL "${PACKAGES[@]}"
else
    echo "No package query tool is detected, no package report is generated"
fi

# End bug report
} &>> "$BUGREPORT_FILE"

tar zcf "${BUGREPORT_NAME}.tar.gz" -C "$BUGREPORT_TMP" "$BUGREPORT_NAME"
rm -rf "$BUGREPORT_TMP"

cat <<EOF
Bug report generated

The bug report has been saved as:
${PWD%%/}/${BUGREPORT_NAME}.tar.gz

Please continue following the instructions on
https://github.com/Bumblebee-Project/Bumblebee/wiki/Reporting-Issues

Thanks for your help!
The Bumblebee Project Team
EOF