.
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # displaylink-debian
2 |
3 | DisplayLink driver installer for Debian and Ubuntu based Linux distributions: Debian, Ubuntu, Elementary OS, Mint, Kali, Deepin and many more! [Full list of all supported platforms](https://github.com/AdnanHodzic/displaylink-debian#supported-platforms-are)
4 |
5 |
14 |
15 | ## Why do I need displaylink-debian?
16 |
17 | [DisplayLink][] releases its drivers only for Ubuntu xx.04 LTS. Hence if you run any other Ubuntu version or any other Linux distribution DisplayLink will not work as expected.
18 |
19 | [displaylink-debian][] allows seamless installation of the official
20 | DisplayLink drivers tailored to work for most of the Debian based Linux distributions regardless of which Linux kernel version (>4.15) you're using.
21 |
22 | ## Installation
23 | 1. Download the repo, cd in the directory and run the shell script with sudo:
24 | ```shell
25 | git clone https://github.com/AdnanHodzic/displaylink-debian.git
26 | cd displaylink-debian
27 | sudo ./displaylink-debian.sh
28 | ```
29 | 2. Then consult the [Post Install Guide][PostInstall] to make sure everything works as intended.
30 |
31 |
32 | ## Troubleshooting and debugging
33 |
34 | ***Please note:** Your external monitor/s may not work as expected unless you perform additional steps as described in the [Post Installation Guide][PostInstall].*
35 |
36 | Before submitting a bug report in the [issue tracker](https://github.com/AdnanHodzic/displaylink-debian/issues/new), please make sure to:
37 | * read [Troubleshooting most common issues][TroubleShooting].
38 | * when submitting a new issue, include debug information by running: `sudo ./displaylink-debian.sh --debug`
39 |
40 | ## Supported platforms are:
41 |
42 | * BunsenLabs
43 | * Debian
44 | * Deepin
45 | * Devuan
46 | * elementary OS
47 | * Kali
48 | * KDE neon
49 | * LMDE
50 | * Mint
51 | * MX Linux
52 | * Nitrux
53 | * Parrot
54 | * Pop!_OS
55 | * PureOS
56 | * Ubuntu
57 | * UOS: apricot - eagle
58 | * Zorin
59 |
60 | Regardless of which Linux kernel version (>4.15) you're using.
61 |
62 | If your distribution or version is not on the list, make sure to include debug information by running: `sudo ./displaylink-debian.sh --debug` and [submit a request to add support for it](https://github.com/AdnanHodzic/displaylink-debian/issues/new).
63 |
64 | ## Technical
65 |
66 | * _displaylink-debian.sh_ downloads and extracts the contents of the
67 | official [DisplayLink Ubuntu driver][upstream].
68 |
69 | * _displaylink-debian.sh_ modifies the contents of the official installer,
70 | _displaylink-installer.sh_, makes all necessary changes for DisplayLink to work out of box on supported Linux distribution.
71 |
72 | * Install/Reinstall/Uninstall is performed.
73 |
74 |
75 | ## Discussion
76 |
77 | * [Kernel agnostic, DisplayLink Debian GNU/Linux driver installer][blog]
78 |
79 | ## Donate (PayPal or Bitcoin)
80 |
81 | ##### Become Github Sponsor
82 |
83 | [Become a sponsor to Adnan Hodzic on Github](https://github.com/sponsors/AdnanHodzic) to acknowledge my efforts and help project's further open source development.
84 |
85 | Since I'm working on this project in free time without any support or reimbursement from DisplayLink, and [have saved some 100$](https://github.com/AdnanHodzic/displaylink-debian/issues/172#issuecomment-441384936). Please consider supporting this project by making a donation of any amount!
86 |
87 | ### PayPal
88 | [](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=adnan%40hodzic.org&item_name=Contribution+for+work+on+debian-displaylink¤cy_code=EUR&source=url)
89 |
90 | ### BitCoin
91 | [bc1qlncmgdjyqy8pe4gad4k2s6xtyr8f2r3ehrnl87](bitcoin:bc1qlncmgdjyqy8pe4gad4k2s6xtyr8f2r3ehrnl87)
92 |
93 | [](bitcoin:bc1qlncmgdjyqy8pe4gad4k2s6xtyr8f2r3ehrnl87)
94 |
95 | ## Sponsors
96 |
97 | * Benedikt Wildenhain [@bwildenhain](http://github.com/bwildenhain)
98 |
99 |
100 |
101 | [DisplayLink]: https://www.synaptics.com/products/displaylink-graphics
102 | [upstream]: https://www.synaptics.com/products/displaylink-graphics/downloads/ubuntu
103 | [blog]: https://foolcontrol.org/?p=1777
104 | [displaylink-debian]: https://github.com/AdnanHodzic/displaylink-debian
105 | [PostInstall]: docs/post-install-guide.md
106 | [TroubleShooting]: docs/common-issues.md
107 |
--------------------------------------------------------------------------------
/displaylink-debian.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # displaylink-debian:
4 | # DisplayLink driver installer for Debian and Ubuntu based Linux distributions: Debian, Ubuntu, Elementary OS,
5 | # Mint, Kali, Deepin and more! Full list of all supported platforms: http://bit.ly/2zrwz2u
6 | #
7 | # DisplayLink driver installer for Debian GNU/Linux, Ubuntu, Elementary OS, Mint, Kali, Deepin and more! Full list of all supported Linux distributions
8 | #
9 | # Blog post: http://foolcontrol.org/?p=1777
10 | #
11 | # Copyleft: Adnan Hodzic
12 | # License: GPLv3
13 |
14 | # Bash Strict Mode
15 | set -eu
16 | # set -o pipefail # TODO: Some code still fails this check, fix before enabling.
17 | IFS=$'\n\t'
18 |
19 | kernel_check="$(uname -r | egrep -o '^[0-9]+\.[0-9]+')"
20 |
21 | function ver2int {
22 | echo "$@" | awk -F "." '{ printf("%03d%03d%03d\n", $1,$2,$3); }';
23 | }
24 |
25 | # Get latest versions
26 | versions=$(wget -q -O - https://www.synaptics.com/products/displaylink-graphics/downloads/ubuntu | grep "Release: " | head -n 2 | perl -pe '($_)=/([0-9]+([.][0-9]+)+(\ Beta)*)/; exit if $. > 1;')
27 | # if versions contains "Beta", try to download previous version
28 | if [[ $versions =~ Beta ]]; then
29 | version=$(wget -q -O - https://www.synaptics.com/products/displaylink-graphics/downloads/ubuntu | grep "
Release: " | head -n 2 | perl -pe '($_)=/([0-9]+([.][0-9]+)+(?!\ Beta))/; exit if $. > 1;')
30 | dlurl="https://www.synaptics.com/$(wget -q -O - https://www.synaptics.com/products/displaylink-graphics/downloads/ubuntu | grep -B 2 $version'-Release' | perl -pe '($_)=/]+class="download-link"/')"
31 | driver_url="https://www.synaptics.com/$(wget -q -O - ${dlurl} | grep 'Release: " | head -n 1 | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/; exit if $. > 1;'`
34 | dlurl="https://www.synaptics.com/$(wget -q -O - https://www.synaptics.com/products/displaylink-graphics/downloads/ubuntu | grep -B 2 $version'-Release' | perl -pe '($_)=/]+class="download-link"/')"
35 | driver_url="https://www.synaptics.com/$(wget -q -O - ${dlurl} | grep ' /dev/null 2>&1
114 | then
115 | default=y
116 | read -p "$dep not found! Install? [Y/n] " response
117 | response=${response:-$default}
118 | if [[ $response =~ ^(yes|y|Y)$ ]]
119 | then
120 | if ! apt-get install $dep
121 | then
122 | echo "$dep installation failed. Aborting."
123 | exit 1
124 | fi
125 | else
126 | separator
127 | echo -e "\nCannot continue without $dep. Aborting."
128 | separator
129 | exit 1
130 | fi
131 | else
132 | echo "$dep is installed"
133 | fi
134 | done
135 | }
136 |
137 | distro_check(){
138 | separator
139 | # RedHat
140 | if [ -f /etc/redhat-release ];
141 | then
142 | echo "This is a Redhat based distro ..."
143 | # ToDo:
144 | # Add platform type message for RedHat
145 | exit 1
146 | else
147 |
148 | # Confirm dependencies are in place
149 | dep_check
150 |
151 | # Unsupported platform message
152 | message(){
153 | echo -e "\n---------------------------------------------------------------\n"
154 | echo -e "Unsuported platform: $platform"
155 | echo -e "Full list of all supported platforms: http://bit.ly/2zrwz2u"
156 | echo -e ""
157 | echo -e "This tool is Open Source and feel free to extend it"
158 | echo -e "GitHub repo: https://github.com/AdnanHodzic/displaylink-debian/"
159 | echo -e "\n---------------------------------------------------------------\n"
160 | }
161 |
162 | # Ubuntu, Neon, PopOS
163 | if [ "$lsb" == "Ubuntu" ] || [ "$lsb" == "Neon" ] || [ "$lsb" == "Pop" ];
164 | then
165 | echo -e "\nPlatform requirements satisfied, proceeding ..."
166 | # elementary OS
167 | elif [ "$lsb" == "elementary OS" ] || echo $lsb | grep -qi "elementary";
168 | then
169 | echo -e "\nPlatform requirements satisfied, proceeding ..."
170 | # Debian
171 | elif [ "$lsb" == "Debian" ];
172 | then
173 | echo -e "\nPlatform requirements satisfied, proceeding ..."
174 | # Devuan
175 | elif [ "$lsb" == "Devuan" ]
176 | then
177 | echo -e "\nPlatform requirements satisfied, proceeding ..."
178 | # Mint
179 | elif echo $lsb | grep -qi "Linuxmint" ;
180 | then
181 | echo -e "\nPlatform requirements satisfied, proceeding ..."
182 | # Kali
183 | elif [ "$lsb" == "Kali" ];
184 | then
185 | echo -e "\nPlatform requirements satisfied, proceeding ..."
186 | # Deepin
187 | elif [ "$lsb" == "Deepin" ] || [ "$lsb" == "Uos" ] ;
188 | then
189 | echo -e "\nPlatform requirements satisfied, proceeding ..."
190 | # MX Linux
191 | elif [ "$lsb" == "MX" ];
192 | then
193 | echo -e "\nPlatform requirements satisfied, proceeding ..."
194 | # BunsenLabs
195 | elif [ "$lsb" == "BunsenLabs" ] || [ "$lsb" == "Bunsenlabs" ];
196 | then
197 | echo -e "\nPlatform requirements satisfied, proceeding ..."
198 | # Parrot
199 | elif [ "$lsb" == "Parrot" ];
200 | then
201 | echo -e "\nPlatform requirements satisfied, proceeding ..."
202 | # PureOS
203 | elif [ "$lsb" == "PureOS" ];
204 | then
205 | echo -e "\nPlatform requirements satisfied, proceeding ..."
206 | # Nitrux
207 | elif [ "$lsb" == "Nitrux" ];
208 | then
209 | echo -e "\nPlatform requirements satisfied, proceeding ..."
210 | # Zorin
211 | elif [ "$lsb" == "Zorin" ];
212 | then
213 | echo -e "\nPlatform requirements satisfied, proceeding ..."
214 | else
215 | message
216 | exit 1
217 | fi
218 | fi
219 | }
220 |
221 | pre_install() {
222 |
223 | if [ -f $kconfig_file ];
224 | then
225 | kconfig_exists="true"
226 | else
227 | kconfig_exists="false"
228 | touch $kconfig_file
229 | fi
230 |
231 | }
232 |
233 | sysinitdaemon_get(){
234 | sysinitdaemon="systemd"
235 |
236 | if [ "$lsb" == "Ubuntu" ];
237 | then
238 | if [ $codename == "trusty" ];
239 | then
240 | sysinitdaemon="upstart"
241 | fi
242 | # Elementary
243 | elif [ "$lsb" == "elementary OS" ] || echo $lsb | grep -qi "elementary";
244 | then
245 | if [ $codename == "freya" ];
246 | then
247 | sysinitdaemon="upstart"
248 | fi
249 | elif [ "$lsb" == "Devuan" ]
250 | then
251 | sysinitdaemon="sysvinit"
252 | fi
253 |
254 | echo $sysinitdaemon
255 | }
256 |
257 | displaylink_service_check () {
258 | sysinitdaemon=$(sysinitdaemon_get)
259 | if [ "$sysinitdaemon" == "systemd" ]
260 | then
261 | systemctl is-active --quiet displaylink-driver.service && \
262 | echo up and running
263 | elif [ "$sysinitdaemon" == "sysvinit" ]
264 | then
265 | /etc/init.d/$init_script status
266 | fi
267 | }
268 |
269 | clean_up(){
270 | # remove obsolete/redundant files which can only hamper reinstalls
271 |
272 | separator
273 | echo -e "\nPerforming clean-up"
274 |
275 | # go back to displaylink-debian
276 | cd - &> /dev/null
277 |
278 | if [ -f "DisplayLink_Ubuntu_$version.zip" ]
279 | then
280 | echo "Removing redundant: \"DisplayLink_Ubuntu_$version.zip\" file"
281 | rm "DisplayLink_Ubuntu_$version.zip"
282 | fi
283 |
284 | if [ -d $driver_dir ]
285 | then
286 | echo "Removing redundant: \"$driver_dir\" directory"
287 | rm -r $driver_dir
288 | fi
289 |
290 | }
291 |
292 | setup_complete(){
293 | default=Y
294 | ack=${ack:-$default}
295 |
296 | read -p "Reboot now? [Y/n] " ack
297 | ack=${ack:-$default}
298 |
299 | for letter in "$ack"; do
300 | if [[ "$letter" == [Yy] ]];
301 | then
302 | echo "Rebooting ..."
303 | reboot
304 | elif [[ "$letter" == [Nn] ]];
305 | then
306 | echo -e "\nReboot postponed, changes won't be applied until reboot"
307 | else
308 | wrong_key
309 | fi
310 | done
311 | }
312 |
313 | download() {
314 | default=y
315 | echo -en "\nPlease read the Software License Agreement available at: \n$dlurl\nDo you accept?: [Y/n]: "
316 | read ACCEPT
317 | ACCEPT=${ACCEPT:-$default}
318 | case $ACCEPT in
319 | y*|Y*)
320 | echo -e "\nDownloading DisplayLink Ubuntu driver:\n"
321 | wget -O DisplayLink_Ubuntu_${version}.zip "${driver_url}"
322 | # make sure file is downloaded before continuing
323 | if [ $? -ne 0 ]
324 | then
325 | echo -e "\nUnable to download Displaylink driver\n"
326 | exit
327 | fi
328 | ;;
329 | *)
330 | echo "Can't download the driver without accepting the license agreement!"
331 | exit 1
332 | ;;
333 | esac
334 | }
335 |
336 | install(){
337 | separator
338 | download
339 |
340 | # prep
341 | # Check whether prior drivers have been downloaded
342 | if [ -d $driver_dir ]
343 | then
344 | echo "Removing prior: \"$driver_dir\" directory"
345 | rm -r $driver_dir
346 | fi
347 |
348 | mkdir $driver_dir
349 |
350 | separator
351 | echo -e "\nPreparing for install\n"
352 | test -d $driver_dir && /bin/rm -Rf $driver_dir
353 | unzip -d $driver_dir DisplayLink_Ubuntu_${version}.zip
354 | chmod +x $driver_dir/displaylink-driver-${version}*.run
355 | ./$driver_dir/displaylink-driver-${version}*.run --keep --noexec
356 | mv displaylink-driver-${version}*/ $driver_dir/displaylink-driver-${version}
357 | # get sysinitdaemon
358 | sysinitdaemon=$(sysinitdaemon_get)
359 |
360 |
361 | # modify displaylink-installer.sh
362 | sed -i "s/SYSTEMINITDAEMON=unknown/SYSTEMINITDAEMON=$sysinitdaemon/g" $driver_dir/displaylink-driver-${version}/displaylink-installer.sh
363 |
364 | # issue: 227
365 | if [ "$lsb" == "Debian" ] || [ "$lsb" == "Devuan" ] || [ "$lsb" == "Kali" ] || [ "$lsb" == "Deepin" ] || [ "$lsb" == "BunsenLabs" ] || [ "$lsb" == "Bunsenlabs" ] || [ "$lsb" == "MX" ] || [ "$lsb" == "Uos" ];
366 | then
367 | sed -i 's#/lib/modules/$KVER/build/Kconfig#/lib/modules/$KVER/build/scripts/kconfig/conf#g' $driver_dir/displaylink-driver-${version}/displaylink-installer.sh
368 | ln -sf /lib/modules/$(uname -r)/build/Makefile /lib/modules/$(uname -r)/build/Kconfig
369 | fi
370 |
371 | # Patch displaylink-installer.sh to prevent reboot before our script is done.
372 | patchName="displaylink-installer.patch"
373 | finalPatchPath="$resourcesDir$patchName"
374 | patch -Np0 $driver_dir/displaylink-driver-${version}/displaylink-installer.sh <$finalPatchPath
375 |
376 | # run displaylink install
377 | echo -e "\nInstalling driver version: $version\n"
378 | cd $driver_dir/displaylink-driver-${version}
379 | ./displaylink-installer.sh install
380 |
381 |
382 | # udlfb kernel version check
383 | kernel_check="$(uname -r | egrep -o '[0-9]+\.[0-9]+')"
384 |
385 | # add udlfb to blacklist (issue #207)
386 | udl_block(){
387 |
388 | # if necessary create blacklist.conf
389 | if [ ! -f $blacklist ]; then
390 | touch $blacklist
391 | fi
392 |
393 | if ! grep -Fxq "blacklist udlfb" $blacklist
394 | then
395 | echo "Adding udlfb to blacklist"
396 | echo "blacklist udlfb" >> $blacklist
397 | fi
398 |
399 | # add udl to blacklist (issue #207)
400 | if ! grep -Fxq "blacklist udl" $blacklist
401 | then
402 | echo "Adding udl to blacklist"
403 | echo "blacklist udl" >> $blacklist
404 | fi
405 | }
406 |
407 | # add udl/udlfb to blacklist depending on kernel version (issue #207)
408 | if [ "$(ver2int $kernel_check)" -ge "$(ver2int '4.14.9')" ];
409 | then
410 | udl_block
411 | fi
412 |
413 | }
414 |
415 | # post install
416 | post_install(){
417 | separator
418 | echo -e "\nPerforming post install steps\n"
419 |
420 | if [ "$kconfig_exists" == "false" ];
421 | then
422 | rm $kconfig_file
423 | fi
424 |
425 | # fix: issue #42 (dlm.service can't start)
426 | # note: for this to work libstdc++6 package needs to be installed from >= Stretch
427 | if [ "$lsb" == "Debian" ] || [ "$lsb" == "Devuan" ] || [ "$lsb" == "Kali" ];
428 | then
429 | ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /opt/displaylink/libstdc++.so.6
430 | fi
431 |
432 | sysinitdaemon=$(sysinitdaemon_get)
433 | if [ "$sysinitdaemon" == "systemd" ]
434 | then
435 | # Fix inability to enable displaylink-driver.service
436 | sed -i "/RestartSec=5/a[Install]\nWantedBy=multi-user.target" /lib/systemd/system/displaylink-driver.service
437 |
438 | echo "Enable displaylink-driver service"
439 | systemctl enable displaylink-driver.service
440 | elif [ "$sysinitdaemon" == "sysvinit" ]
441 | then
442 | echo "Copying init script to /etc/init.d\n"
443 | cp "$dir/$init_script" /etc/init.d/
444 | chmod +x "/etc/init.d/$init_script"
445 | echo "Load evdi at startup"
446 | cat > "$evdi_modprobe" <= 6.6 (issue: 920)
461 | if [ "$(ver2int $kernel_check)" -ge "$(ver2int '6.6')" ];
462 | then
463 | cardsub=$(lspci -nnk | grep -i vga -A3 | grep Subsystem | awk '{print $NF}' | tr -d '[]')
464 | else
465 | cardsub=$(lspci -nnk | grep -i vga -A3|grep Subsystem|cut -d" " -f5)
466 | fi
467 |
468 | # intel displaylink xorg.conf
469 | xorg_intel(){
470 | cat > $xorg_config_displaylink < $xorg_config_displaylink < $xorg_config_displaylink <> $xsetup_loc << EOL
506 |
507 | xrandr --setprovideroutputsource modesetting NVIDIA-0
508 | xrandr --auto
509 | EOL
510 | }
511 |
512 | nvidia_xrandr_full(){
513 | cat >> $xsetup_loc << EOL
514 | #!/bin/sh
515 | # Xsetup - run as root before the login dialog appears
516 |
517 | if [ -e /sbin/prime-offload ]; then
518 | echo running NVIDIA Prime setup /sbin/prime-offload
519 | /sbin/prime-offload
520 | fi
521 |
522 | xrandr --setprovideroutputsource modesetting NVIDIA-0
523 | xrandr --auto
524 | EOL
525 | }
526 |
527 | # create Xsetup file if not there + make necessary changes (issue: #201, #206)
528 | if [ ! -f $xsetup_loc ];
529 | then
530 | echo "$xsetup_loc not found, creating"
531 | mkdir -p /usr/share/sddm/scripts/
532 | touch $xsetup_loc
533 | nvidia_xrandr_full
534 | chmod +x $xsetup_loc
535 | echo -e "Wrote changes to $xsetup_loc"
536 | fi
537 |
538 | # make necessary changes to Xsetup
539 | if ! grep -q "setprovideroutputsource modesetting" $xsetup_loc
540 | then
541 | mv $xsetup_loc $xsetup_loc.org.bak
542 | echo -e "\nMade backup of: $xsetup_loc file"
543 | echo -e "\nLocation: $xsetup_loc.org.bak"
544 | nvidia_xrandr
545 | chmod +x $xsetup_loc
546 | echo -e "Wrote changes to $xsetup_loc"
547 | fi
548 |
549 | # xorg.conf ops
550 | xorg_config="/etc/x11/xorg.conf"
551 | usr_xorg_config_displaylink="/usr/share/X11/xorg.conf.d/20-displaylink.conf"
552 |
553 | if [ -f $xorg_config ];
554 | then
555 | mv $xorg_config $xorg_config.org.bak
556 | echo -e "\nMade backup of: $xorg_config file"
557 | echo -e "\nLocation: $xorg_config.org.bak"
558 | fi
559 |
560 | if [ -f $xorg_config_displaylink ];
561 | then
562 | mv $xorg_config_displaylink $xorg_config_displaylink.org.bak
563 | echo -e "\nMade backup of: $xorg_config_displaylink file"
564 | echo -e "\nLocation: $xorg_config_displaylink.org.bak"
565 | fi
566 |
567 | if [ -f $usr_xorg_config_displaylink ];
568 | then
569 | mv $usr_xorg_config_displaylink $usr_xorg_config_displaylink.org.bak
570 | echo -e "\nMade backup of: $usr_xorg_config_displaylink file"
571 | echo -e "\nLocation: $usr_xorg_config_displaylink.org.bak"
572 | fi
573 | }
574 |
575 | # nvidia displaylink xorg.conf (issue: 176)
576 | xorg_nvidia(){
577 | cat > $xorg_config_displaylink < $xorg_config_displaylink <&1>/dev/null
706 |
707 | # remove modesetting file
708 | if [ -f $xorg_config_displaylink ]
709 | then
710 | echo "Removing Displaylink Xorg config file"
711 | rm $xorg_config_displaylink
712 | fi
713 |
714 | # delete udl/udlfb from blacklist (issue #207)
715 | sed -i '/blacklist udlfb/d' $blacklist
716 | sed -i '/blacklist udl/d' $blacklist
717 |
718 | }
719 |
720 | # debug: get system information for issue debug
721 | debug(){
722 | separator
723 | echo -e "\nStarting Debug ...\n"
724 |
725 | default=N
726 | ack=${ack:-$default}
727 |
728 | read -p "Did you read Post Installation Guide? https://github.com/AdnanHodzic/displaylink-debian/blob/master/docs/post-install-guide.md [y/N] " ack
729 | ack=${ack:-$default}
730 |
731 | for letter in "$ack"; do
732 | if [[ "$letter" == [Yy] ]];
733 | then
734 | echo ""
735 | continue
736 | elif [[ "$letter" == [Nn] ]];
737 | then
738 | echo -e "\nPlease read Post Installation Guide: https://github.com/AdnanHodzic/displaylink-debian/blob/master/docs/post-install-guide.md\n"
739 | exit 1
740 | else
741 | wrong_key
742 | fi
743 | done
744 |
745 | read -p "Did you read Troubleshooting most common issues? https://github.com/AdnanHodzic/displaylink-debian/blob/master/docs/common-issues.md [y/N] " ack
746 | ack=${ack:-$default}
747 |
748 | for letter in "$ack"; do
749 | if [[ "$letter" == [Yy] ]];
750 | then
751 | echo -e ""
752 | continue
753 | elif [[ "$letter" == [Nn] ]];
754 | then
755 | echo -e "\nPlease read Troubleshooting most common issues: https://github.com/AdnanHodzic/displaylink-debian/blob/master/docs/common-issues.md\n"
756 | exit 1
757 | else
758 | wrong_key
759 | fi
760 | done
761 |
762 | if [ -f /sys/devices/evdi/version ]
763 | then
764 | evdi_version="$(cat /sys/devices/evdi/version)"
765 | else
766 | evdi_version="/sys/devices/evdi/version not found"
767 | fi
768 |
769 | echo -e "--------------- Linux system info ----------------\n"
770 | echo -e "Distro: $lsb"
771 | echo -e "Release: $codename"
772 | echo -e "Kernel: $kernel"
773 | echo -e "\n---------------- DisplayLink info ----------------\n"
774 | echo -e "Driver version: $sys_driver_version"
775 | echo -e "DisplayLink service status: $(displaylink_service_check)"
776 | echo -e "EVDI service version: $evdi_version"
777 | echo -e "\n------------------ Graphics card -----------------\n"
778 | echo -e "Vendor: $graphics_vendor"
779 | echo -e "Subsystem: $graphics_subcard"
780 | echo -e "VGA: $vga_info"
781 | echo -e "VGA (3D): $vga_info_3d"
782 | echo -e "X11 version: $xorg_vcheck"
783 | xconfig_list
784 | echo -e "\n-------------- DisplayLink xorg.conf -------------\n"
785 | echo -e "File: $xorg_config_displaylink"
786 | echo -e "Contents:\n $(cat $xorg_config_displaylink)"
787 | echo -e "\n-------------------- Monitors --------------------\n"
788 | echo -e "$providers"
789 | }
790 |
791 | # interactively asks for operation
792 | ask_operation(){
793 | echo -e "\n--------------------------- displaylink-debian -------------------------------"
794 | echo -e "\nDisplayLink driver installer for Debian and Ubuntu based Linux distributions:\n"
795 | echo -e "* Debian, Ubuntu, Elementary OS, Mint, Kali, Deepin and many more!"
796 | echo -e "* Full list of all supported platforms: http://bit.ly/2zrwz2u"
797 | echo -e "* When submitting a new issue, include Debug information"
798 | echo -e "\nOptions:\n"
799 | read -p "[I]nstall
800 | [D]ebug
801 | [R]e-install
802 | [U]ninstall
803 | [Q]uit
804 |
805 | Select a key: [i/d/r/u/q]: " answer
806 | }
807 |
808 | root_check
809 |
810 | if [[ "$#" -lt 1 ]];
811 | then
812 | ask_operation
813 | else
814 | case "${1}" in
815 | "--install")
816 | answer="i"
817 | ;;
818 | "--uninstall")
819 | answer="u"
820 | ;;
821 | "--reinstall")
822 | answer="r"
823 | ;;
824 | "--debug")
825 | answer="d"
826 | ;;
827 | *)
828 | answer="n"
829 | ;;
830 | esac
831 | fi
832 |
833 | if [[ $answer == [Ii] ]];
834 | then
835 | distro_check
836 | pre_install
837 | install
838 | post_install
839 | clean_up
840 | separator
841 | echo -e "\nInstall complete, please reboot to apply the changes"
842 | echo -e "After reboot, make sure to consult post-install guide! https://github.com/AdnanHodzic/displaylink-debian/blob/master/docs/post-install-guide.md"
843 | setup_complete
844 | separator
845 | echo ""
846 | elif [[ $answer == [Uu] ]];
847 | then
848 | distro_check
849 | uninstall
850 | clean_up
851 | separator
852 | echo -e "\nUninstall complete, please reboot to apply the changes"
853 | setup_complete
854 | separator
855 | echo ""
856 | elif [[ $answer == [Rr] ]];
857 | then
858 | distro_check
859 | uninstall
860 | clean_up
861 | distro_check
862 | pre_install
863 | install
864 | post_install
865 | clean_up
866 | separator
867 | echo -e "\nInstall complete, please reboot to apply the changes"
868 | echo -e "After reboot, make sure to consult post-install guide! https://github.com/AdnanHodzic/displaylink-debian/blob/master/docs/post-install-guide.md"
869 | setup_complete
870 | separator
871 | echo ""
872 | elif [[ $answer == [Dd] ]];
873 | then
874 | debug
875 | separator
876 | echo -e "\nUse this information when submitting an issue (http://bit.ly/2GLDlpY)"
877 | separator
878 | echo ""
879 | elif [[ $answer == [Qq] ]];
880 | then
881 | separator
882 | echo ""
883 | exit 0
884 | else
885 | echo -e "\nWrong key, aborting ...\n"
886 | exit 1
887 | fi
888 |
--------------------------------------------------------------------------------
/displaylink.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
3 | if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
4 | set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
5 | fi
6 | ### BEGIN INIT INFO
7 | # Provides: displaylink
8 | # Required-Start: $remote_fs $syslog
9 | # Required-Stop: $remote_fs $syslog
10 | # Default-Start: 2 3 4 5
11 | # Default-Stop: 0 1 6
12 | # Short-Description: DisplayLink driver
13 | # Description: Manage DisplayLink driver
14 | ### END INIT INFO
15 |
16 | # Author: Gabriel Hondet
17 |
18 | DESC="DisplayLink driver"
19 | DAEMON=/opt/displaylink/DisplayLinkManager
20 | NAME="displaylink"
21 | PIDFILE=/var/run/$NAME.pid
22 | START_ARGS="--background"
23 |
--------------------------------------------------------------------------------
/docs/common-issues.md:
--------------------------------------------------------------------------------
1 | # Common issues
2 |
3 | ## Make error Bad return status for module build on kernel...
4 |
5 | While installing displaylink-debian, you might see an error similar to this one in the terminal output:
6 |
7 | ```log
8 | Building module:
9 | cleaning build area...
10 | make -j8 KERNELRELEASE=5.10.0-23-amd64 all INCLUDEDIR=/lib/modules/5.10.0-23-amd64/build/include KVERSION=5.10.0-23-amd64 DKMS_BUILD=1...(bad exit status: 2)
11 | Error! Bad return status for module build on kernel: 5.10.0-23-amd64 (x86_64)
12 | Consult /var/lib/dkms/evdi/1.13.1/build/make.log for more information.
13 | ```
14 |
15 | **Prerequisite:**
16 | * displaylink must **not** be installed
17 | * libssl-dev must be installed
18 |
19 | Try this procedure to fix the previous error:
20 |
21 | ```sh
22 | sudo apt install libssl-dev
23 | cd /usr/src/linux-headers-$(uname -r)
24 | sudo tar -xaf /usr/src/linux-source-$(uname -r | egrep -o '^[0-9]+\.[0-9]+').tar.xz --strip-components=1
25 | sudo make oldconfig
26 | sudo make prepare
27 | ```
28 | Then install displaylink as usual:
29 |
30 | `sudo ./displaylink-debian.sh --install`
31 |
32 |
33 | ## More common issues
34 |
35 | * [Disable UEFI / secure boot](https://github.com/AdnanHodzic/displaylink-debian/issues/123)
36 |
37 | * [Bash / sh can't be executed](https://github.com/AdnanHodzic/displaylink-debian/issues/74#issuecomment-410622725)
38 |
39 | * [secure boot / cable problems](https://github.com/AdnanHodzic/displaylink-debian/issues/142#issuecomment-413091374)
40 |
41 | * [rendering issues](https://github.com/AdnanHodzic/displaylink-debian/issues/68)
42 |
43 | * [Unable to locate package linux-headers](https://github.com/AdnanHodzic/displaylink-debian/issues/141)
44 |
45 | * [Debian / Fail to connect screens](https://github.com/AdnanHodzic/displaylink-debian/issues/130)
46 |
47 | * [mouse/cursor flicker issue](https://github.com/AdnanHodzic/displaylink-debian/issues/192)
48 |
49 | * [`Can't open display :0` error](https://github.com/AdnanHodzic/displaylink-debian/issues/639)
50 |
51 |
52 | ## Most common Debian Jessie related issues:
53 | * systemctl status dlm.service failure
54 | * Glibc GLIBCXX_3.4.21 missing
55 |
56 | Due to older version of libstdc++6 in Jessie, you need to download and install version from [Stretch release](https://packages.debian.org/stretch/libstdc++6). After package has been updated, run displaylink-debian and select "Re-install" option.
57 |
58 | Reference: [#42](https://github.com/AdnanHodzic/displaylink-debian/issues/42)
59 |
60 | Should you experience problems with the display either remaining black, only showing mouse pointer or a frozen image of your main screen, then this could be due to Intel graphics driver interfering with displaylink.
61 |
62 | Reference: [#68](https://github.com/AdnanHodzic/displaylink-debian/issues/68)
63 |
64 | ## syntax error near unexpected token \`newline'...
65 |
66 | If you just downloaded the script and tried to execute it, you might get the following error:
67 |
68 | ```
69 | $ ./displaylink-debian.sh
70 | ./displaylink-debian.sh: line 1: syntax error near unexpected token `newline'
71 | ./displaylink-debian.sh: line 1: `'
72 | ```
73 |
74 | The line number might be different.
75 |
76 | *Solution:*
77 |
78 | Download the script again as a ZIP file: https://github.com/AdnanHodzic/displaylink-debian/archive/master.zip
79 |
80 | Extract it and run it:
81 |
82 | ```sh
83 | unzip displaylink-debian-master.zip
84 | cd displaylink-debian-master
85 | sudo ./displaylink-debian.sh
86 | ```
87 |
88 | References: [#111](https://github.com/AdnanHodzic/displaylink-debian/issues/111), [#102](https://github.com/AdnanHodzic/displaylink-debian/issues/102), [#89](https://github.com/AdnanHodzic/displaylink-debian/issues/89), [#65](https://github.com/AdnanHodzic/displaylink-debian/issues/65)
89 |
90 | ## Having a different problem?
91 |
92 | When submitting a new [issue](https://github.com/AdnanHodzic/displaylink-debian/issues), include debug information by running: `sudo ./displaylink-debian.sh --debug`
93 |
94 | ## Monitoring for errors
95 |
96 | * Monitor ```dmesg | grep Display``` output while plugging in Displaylink
97 | * Monitor ```/var/log/displaylink/DisplayLinkManager.log``` file
--------------------------------------------------------------------------------
/docs/post-install-guide.md:
--------------------------------------------------------------------------------
1 | # Post Installation Guide
2 |
3 | ## Prerequisites
4 |
5 | * Make sure that UEFI/secure boot is disabled!
6 |
7 | * When you are logging into your session you are using X server (X11) and not Wayland.
8 |
9 | * After install you must reboot to apply the changes.
10 |
11 | * After reboot, make sure DispayLink is running by running debug i.e: `sudo ./displaylink-debian.sh --debug`
12 |
13 | Then check `DisplayLink info` section, i.e:
14 |
15 | ```
16 | ---------------- DisplayLink info ----------------
17 |
18 | Driver version: 5.1.26
19 | DisplayLink service status: up and running
20 | EVDI service version: 1.6.0
21 | ```
22 |
23 | * Check providers to see if your monitors were detected, i.e:
24 |
25 | ```xrandr --listproviders```
26 |
27 | If you get a list of more then one provider, it means your displays were properly detected.
28 |
29 | If that's not the case and you have an Intel graphics card try [following suggestion](https://github.com/AdnanHodzic/displaylink-debian/issues/228#issuecomment-467889348), if that doesn't work [try this](https://github.com/AdnanHodzic/displaylink-debian/issues/236#issuecomment-471213411).
30 |
31 | If you have Nvidia or ATI/AMD graphics card, try removing: `/etc/X11/xorg.conf.d/20-displaylink.conf` file followed by reboot and check again if you're getting more then one provider.
32 |
33 | If none of the suggestions in [Prerequsites section](#prerequisites) solved your problem, make sure to consult [Troubleshooting most common issues](common-issues.md).
34 |
35 | ## Display Detection
36 |
37 | Only do this in case your monitors weren't automatically detected.
38 |
39 | First run `xrandr --listproviders`.
40 | The output should be similar to this:
41 | ```
42 | Providers: number : 5
43 | Provider 0: id: 0x44 cap: 0x9, Source Output, Sink Offload crtcs: 3 outputs: 2 associated providers: 0 name:Intel
44 | Provider 1: id: 0x138 cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 0 name:modesetting
45 | Provider 2: id: 0x116 cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 0 name:modesetting
46 | Provider 3: id: 0xf4 cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 0 name:modesetting
47 | Provider 4: id: 0xd2 cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 0 name:modesetting
48 | ```
49 | Notes:
50 | * Provider 0 is the actual graphics provider and 1-4 are DisplayLink providers.
51 | * All providers have 0 associated providers. Which means that we will have to connect all the DisplayLink providers to the main provider.
52 |
53 | We can do this with the command `xrandr --setprovideroutputsource `
54 | In this case we would run:
55 | ```
56 | xrandr --setprovideroutputsource 1 0
57 | xrandr --setprovideroutputsource 2 0
58 | xrandr --setprovideroutputsource 3 0
59 | xrandr --setprovideroutputsource 4 0
60 | ```
61 | If we would re-run `xrandr --listproviders` this would output:
62 | ```
63 | Providers: number : 5
64 | Provider 0: id: 0x44 cap: 0x9, Source Output, Sink Offload crtcs: 3 outputs: 2 associated providers: 4 name:Intel
65 | Provider 1: id: 0x138 cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 1 name:modesetting
66 | Provider 2: id: 0x116 cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 1 name:modesetting
67 | Provider 3: id: 0xf4 cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 1 name:modesetting
68 | Provider 4: id: 0xd2 cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 1 name:modesetting
69 | ```
70 |
71 | For further reference I suggest reading:
72 | [How to use xrandr](https://web.archive.org/web/20180224075928/https://pkg-xorg.alioth.debian.org/howto/use-xrandr.html)
73 |
74 | ## Screen Layout Configuration
75 |
76 | There are couple of tools to help you configure screen layout of your external monitors.
77 |
78 | ### xrandr
79 |
80 | Depending on your setup, to place DVI-1-0 virtually-right of the eDP1 display you'd run:
81 |
82 | ```xrandr --output DVI-1-0 --auto --right-of eDP1```
83 |
84 | For further reference I suggest reading:
85 | [How to use xrandr](https://web.archive.org/web/20180224075928/https://pkg-xorg.alioth.debian.org/howto/use-xrandr.html)
86 |
87 | ### GNOME Displays
88 |
89 | If you're GNOME desktop user, simply run:
90 |
91 | ```gnome-control-center display```
92 |
93 | ### arandr
94 |
95 | Another very easy and intuative (gui) tool is ```arandr``` (Another XRandR GUI)
96 |
97 | Make sure to install it first: ```sudo apt-get install arandr```
98 |
99 | ## Automated (persistent) display configuration
100 |
101 | Since hotplug doesn't work (on Debian and Kali) and every time you connect your computer to Displaylink you'll need to re-configure your displays.
102 |
103 | I've set-up couple of [aliases](http://www.linfo.org/alias.html) which help me accomplish this in semi-automated manner.
104 |
105 | Every time I connect my computer to DisplayLink ...
106 |
107 | ### two
108 |
109 | I simple run ```two``` which is an alias for setting up two external displays as primary and secondary, whilst turning off laptop built in display. So I can close the lid.
110 |
111 | ### one
112 |
113 | Every time I want to diconnect my displays I run ```one```. Which turns off both external displays, turns on built in laptop display and makes it a primary (default behaviour).
114 |
115 | I did this by simply adding following code to my ```~/.bashrc```
116 |
117 | ```bash
118 | # two
119 | alias two="xrandr --setprovideroutputsource 1 0 && xrandr --setprovideroutputsource 2 0 && xrandr --output VIRTUAL1 --off --output DVI-1-0 --primary --auto --pos 0x0 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --off --output eDP1 --off --output DVI-2-1 --auto --pos 1680x0 --rotate normal"
120 |
121 | # one
122 | alias one="xrandr --output VIRTUAL1 --off --output DVI-1-0 --off --output DP1 --off --output HDMI2 --off --output HDMI1 --off --output eDP1 --primary --mode 1366x768 --pos 0x0 --rotate normal --output DVI-2-1 --off"
123 | ```
124 |
125 | Note, in case you're editting ```~/.bashrc```, make sure you run ```source ~/.bashrc``` to appy the changes without having to log in/out.
126 |
127 | ---
128 | Alternatively, one can add an Xsession script, so the providers are automatically bound to the default output:
129 | ```bash
130 | # File: /etc/X11/Xsession.d/45displaylink-provider-settings
131 | # Bind any existing 'modesetting' provider output to the default source
132 |
133 | providers=$(xrandr --listproviders | grep "modesetting" | cut -d: -f 1 | cut -d ' ' -f 2 | grep -v 0)
134 |
135 | for provider in $providers; do
136 | xrandr --setprovideroutputsource $provider 0
137 | done
138 | ```
139 |
140 | With the above script, one doesn't need to manually run the `xrandr --setprovideroutputsource`, as they are registered at the X11 start and the screen layout can be persisted set in user setting.
141 |
142 | ## Upgrading your OS or updating displaylink
143 | It's recommended to run the uninstall and install procedure separately instead of relying on the reinstall option.
144 | 1. `sudo ./displaylink-debian.sh --uninstall`
145 | 2. reboot
146 | 3. `sudo ./displaylink-debian.sh --install`
147 |
148 |
149 |
--------------------------------------------------------------------------------
/docs/self-signing-modules.md:
--------------------------------------------------------------------------------
1 | You might not want to (or be able to) disable UEFI Secure Boot. In this case you can selfsign the evdi module.
2 |
3 | [Øyvind Stegard](https://github.com/oyvindstegard) wrote a very clear and helpful [guide](http://web.archive.org/web/20191119232110/https://stegard.net/2016/10/virtualbox-secure-boot-ubuntu-fail/) for signing VirtualBox modules. You only have to replace step 5 by this:
4 |
5 | `# nano /root/module-signing/sign-evdi-module.sh`
6 | ```
7 | #!/bin/bash
8 |
9 | for modfile in $(dirname $(modinfo -n evdi))/*.ko; do
10 | echo "Signing $modfile"
11 | /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 \
12 | /root/module-signing/MOK.priv \
13 | /root/module-signing/MOK.der "$modfile"
14 | done
15 | ```
16 | `# chmod 700 /root/module-signing/sign-evdi-module.sh`
17 |
18 | And you can ignore step 7.
19 |
--------------------------------------------------------------------------------
/resources/displaylink-installer.patch:
--------------------------------------------------------------------------------
1 | --- displaylink-installer.sh
2 | +++ displaylink-installer.sh
3 | @@ -212,9 +212,9 @@
4 | evdi_success_message
5 | printf '%s\n\n' "DisplayLink driver installed successfully."
6 |
7 | - if evdi_requires_reboot && prompt_yes_no "Do you want to reboot now?"; then
8 | - reboot
9 | - fi
10 | +# if evdi_requires_reboot && prompt_yes_no "Do you want to reboot now?"; then
11 | +# reboot
12 | +# fi
13 |
14 | exit 0
15 | }
16 |
--------------------------------------------------------------------------------