VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/vboxdrv.sh@ 79881

Last change on this file since 79881 was 79881, checked in by vboxsync, 5 years ago

Installers/Linux: fix kernel module breakage on systems where users self-sign.
bugref:9199: Linux host kernel modules and UEFI secure boot.
ticketref:11577: Secure Boot doesn-t allow vboxdrv module to load
The previous change broke systems with secure boot enabled where users were
manually signing their kernel modules. This change should fix that.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 19.9 KB
Line 
1#! /bin/sh
2# Oracle VM VirtualBox
3# Linux kernel module init script
4
5#
6# Copyright (C) 2006-2019 Oracle Corporation
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.virtualbox.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License (GPL) as published by the Free Software
12# Foundation, in version 2 as it comes in the "COPYING" file of the
13# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16
17# chkconfig: 345 20 80
18# description: VirtualBox Linux kernel module
19#
20### BEGIN INIT INFO
21# Provides: vboxdrv
22# Required-Start: $syslog
23# Required-Stop:
24# Default-Start: 2 3 4 5
25# Default-Stop: 0 1 6
26# Short-Description: VirtualBox Linux kernel module
27### END INIT INFO
28
29## @todo This file duplicates a lot of script with vboxadd.sh. When making
30# changes please try to reduce differences between the two wherever possible.
31
32## @todo Remove the stop_vms target so that this script is only relevant to
33# kernel modules. Nice but not urgent.
34
35PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH
36DEVICE=/dev/vboxdrv
37MODPROBE=/sbin/modprobe
38SCRIPTNAME=vboxdrv.sh
39
40# The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
41TARGET=`readlink -e -- "${0}"` || exit 1
42SCRIPT_DIR="${TARGET%/[!/]*}"
43
44if $MODPROBE -c | grep -q '^allow_unsupported_modules *0'; then
45 MODPROBE="$MODPROBE --allow-unsupported-modules"
46fi
47
48setup_log()
49{
50 test -n "${LOG}" && return 0
51 # Rotate log files
52 LOG="/var/log/vbox-setup.log"
53 mv "${LOG}.3" "${LOG}.4" 2>/dev/null
54 mv "${LOG}.2" "${LOG}.3" 2>/dev/null
55 mv "${LOG}.1" "${LOG}.2" 2>/dev/null
56 mv "${LOG}" "${LOG}.1" 2>/dev/null
57}
58
59[ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
60export BUILD_TYPE
61export USERNAME
62export USER=$USERNAME
63
64if test -n "${INSTALL_DIR}" && test -x "${INSTALL_DIR}/VirtualBox"; then
65 MODULE_SRC="${INSTALL_DIR}/src/vboxhost"
66elif test -x /usr/lib/virtualbox/VirtualBox; then
67 INSTALL_DIR=/usr/lib/virtualbox
68 MODULE_SRC="/usr/share/virtualbox/src/vboxhost"
69elif test -x "${SCRIPT_DIR}/VirtualBox"; then
70 # Executing from the build directory
71 INSTALL_DIR="${SCRIPT_DIR}"
72 MODULE_SRC="${INSTALL_DIR}/src"
73else
74 # Silently exit if the package was uninstalled but not purged.
75 # Applies to Debian packages only (but shouldn't hurt elsewhere)
76 exit 0
77fi
78VIRTUALBOX="${INSTALL_DIR}/VirtualBox"
79VBOXMANAGE="${INSTALL_DIR}/VBoxManage"
80BUILDINTMP="${MODULE_SRC}/build_in_tmp"
81if test -u "${VIRTUALBOX}"; then
82 GROUP=root
83 DEVICE_MODE=0600
84else
85 GROUP=vboxusers
86 DEVICE_MODE=0660
87fi
88
89KERN_VER=`uname -r`
90MODULE_LIST="vboxdrv vboxnetflt vboxnetadp vboxpci"
91# Secure boot state.
92case "`mokutil --sb-state 2>/dev/null`" in
93 *"disabled in shim"*) unset HAVE_SEC_BOOT;;
94 *"SecureBoot enabled"*) HAVE_SEC_BOOT=true;;
95 *) unset HAVE_SEC_BOOT;;
96esac
97# So far we can only sign modules on Ubuntu and on Debian 10 and later.
98DEB_PUB_KEY=/var/lib/shim-signed/mok/MOK.der
99DEB_PRIV_KEY=/var/lib/shim-signed/mok/MOK.priv
100unset HAVE_DEB_KEY
101case "`mokutil --test-key "$DEB_PUB_KEY" 2>/dev/null`" in
102 *"is already"*) DEB_KEY_ENROLLED=true;;
103 *) unset DEB_KEY_ENROLLED;;
104esac
105
106[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
107
108# Preamble for Gentoo
109if [ "`which $0`" = "/sbin/rc" ]; then
110 shift
111fi
112
113begin_msg()
114{
115 test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
116 logger -t "${SCRIPTNAME}" "${1}."
117}
118
119succ_msg()
120{
121 logger -t "${SCRIPTNAME}" "${1}."
122}
123
124fail_msg()
125{
126 echo "${SCRIPTNAME}: failed: ${1}." >&2
127 logger -t "${SCRIPTNAME}" "failed: ${1}."
128}
129
130failure()
131{
132 fail_msg "$1"
133 exit 1
134}
135
136running()
137{
138 lsmod | grep -q "$1[^_-]"
139}
140
141log()
142{
143 setup_log
144 echo "${1}" >> "${LOG}"
145}
146
147module_build_log()
148{
149 setup_log
150 echo "${1}" | egrep -v \
151 "^test -e include/generated/autoconf.h|^echo >&2|^/bin/false\)$" \
152 >> "${LOG}"
153}
154
155## Output the vboxdrv part of our udev rule. This is redirected to the right file.
156udev_write_vboxdrv() {
157 VBOXDRV_GRP="$1"
158 VBOXDRV_MODE="$2"
159
160 echo "KERNEL==\"vboxdrv\", NAME=\"vboxdrv\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\""
161 echo "KERNEL==\"vboxdrvu\", NAME=\"vboxdrvu\", OWNER=\"root\", GROUP=\"root\", MODE=\"0666\""
162 echo "KERNEL==\"vboxnetctl\", NAME=\"vboxnetctl\", OWNER=\"root\", GROUP=\"$VBOXDRV_GRP\", MODE=\"$VBOXDRV_MODE\""
163}
164
165## Output the USB part of our udev rule. This is redirected to the right file.
166udev_write_usb() {
167 INSTALLATION_DIR="$1"
168 USB_GROUP="$2"
169
170 echo "SUBSYSTEM==\"usb_device\", ACTION==\"add\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
171 echo "SUBSYSTEM==\"usb\", ACTION==\"add\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh \$major \$minor \$attr{bDeviceClass}${USB_GROUP}\""
172 echo "SUBSYSTEM==\"usb_device\", ACTION==\"remove\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
173 echo "SUBSYSTEM==\"usb\", ACTION==\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$INSTALLATION_DIR/VBoxCreateUSBNode.sh --remove \$major \$minor\""
174}
175
176## Generate our udev rule file. This takes a change in udev rule syntax in
177## version 55 into account. It only creates rules for USB for udev versions
178## recent enough to support USB device nodes.
179generate_udev_rule() {
180 VBOXDRV_GRP="$1" # The group owning the vboxdrv device
181 VBOXDRV_MODE="$2" # The access mode for the vboxdrv device
182 INSTALLATION_DIR="$3" # The directory VirtualBox is installed in
183 USB_GROUP="$4" # The group that has permission to access USB devices
184 NO_INSTALL="$5" # Set this to "1" to remove but not re-install rules
185
186 # Extra space!
187 case "$USB_GROUP" in ?*) USB_GROUP=" $USB_GROUP" ;; esac
188 case "$NO_INSTALL" in "1") return ;; esac
189 udev_write_vboxdrv "$VBOXDRV_GRP" "$VBOXDRV_MODE"
190 udev_write_usb "$INSTALLATION_DIR" "$USB_GROUP"
191}
192
193## Install udev rule (disable with INSTALL_NO_UDEV=1 in
194## /etc/default/virtualbox).
195install_udev() {
196 VBOXDRV_GRP="$1" # The group owning the vboxdrv device
197 VBOXDRV_MODE="$2" # The access mode for the vboxdrv device
198 INSTALLATION_DIR="$3" # The directory VirtualBox is installed in
199 USB_GROUP="$4" # The group that has permission to access USB devices
200 NO_INSTALL="$5" # Set this to "1" to remove but not re-install rules
201
202 if test -d /etc/udev/rules.d; then
203 generate_udev_rule "$VBOXDRV_GRP" "$VBOXDRV_MODE" "$INSTALLATION_DIR" \
204 "$USB_GROUP" "$NO_INSTALL"
205 fi
206 # Remove old udev description file
207 rm -f /etc/udev/rules.d/10-vboxdrv.rules 2> /dev/null
208}
209
210## Create a usb device node for a given sysfs path to a USB device.
211install_create_usb_node_for_sysfs() {
212 path="$1" # sysfs path for the device
213 usb_createnode="$2" # Path to the USB device node creation script
214 usb_group="$3" # The group to give ownership of the node to
215 if test -r "${path}/dev"; then
216 dev="`cat "${path}/dev" 2> /dev/null`"
217 major="`expr "$dev" : '\(.*\):' 2> /dev/null`"
218 minor="`expr "$dev" : '.*:\(.*\)' 2> /dev/null`"
219 class="`cat ${path}/bDeviceClass 2> /dev/null`"
220 sh "${usb_createnode}" "$major" "$minor" "$class" \
221 "${usb_group}" 2>/dev/null
222 fi
223}
224
225udev_rule_file=/etc/udev/rules.d/60-vboxdrv.rules
226sysfs_usb_devices="/sys/bus/usb/devices/*"
227
228## Install udev rules and create device nodes for usb access
229setup_usb() {
230 VBOXDRV_GRP="$1" # The group that should own /dev/vboxdrv
231 VBOXDRV_MODE="$2" # The mode to be used for /dev/vboxdrv
232 INSTALLATION_DIR="$3" # The directory VirtualBox is installed in
233 USB_GROUP="$4" # The group that should own the /dev/vboxusb device
234 # nodes unless INSTALL_NO_GROUP=1 in
235 # /etc/default/virtualbox. Optional.
236 usb_createnode="$INSTALLATION_DIR/VBoxCreateUSBNode.sh"
237 # install udev rule (disable with INSTALL_NO_UDEV=1 in
238 # /etc/default/virtualbox)
239 if [ "$INSTALL_NO_GROUP" != "1" ]; then
240 usb_group=$USB_GROUP
241 vboxdrv_group=$VBOXDRV_GRP
242 else
243 usb_group=root
244 vboxdrv_group=root
245 fi
246 install_udev "${vboxdrv_group}" "$VBOXDRV_MODE" \
247 "$INSTALLATION_DIR" "${usb_group}" \
248 "$INSTALL_NO_UDEV" > ${udev_rule_file}
249 # Build our device tree
250 for i in ${sysfs_usb_devices}; do # This line intentionally without quotes.
251 install_create_usb_node_for_sysfs "$i" "${usb_createnode}" \
252 "${usb_group}"
253 done
254}
255
256cleanup_usb()
257{
258 # Remove udev description file
259 rm -f /etc/udev/rules.d/60-vboxdrv.rules
260 rm -f /etc/udev/rules.d/10-vboxdrv.rules
261
262 # Remove our USB device tree
263 rm -rf /dev/vboxusb
264}
265
266start()
267{
268 begin_msg "Starting VirtualBox services" console
269 if [ -d /proc/xen ]; then
270 failure "Running VirtualBox in a Xen environment is not supported"
271 fi
272 if test -n "$HAVE_SEC_BOOT" && test -z "$DEB_KEY_ENROLLED"; then
273 if test -n "$HAVE_DEB_KEY"; then
274 begin_msg "You must re-start your system to finish Debian secure boot set-up." console
275 else
276 begin_msg "You must sign these kernel modules before using VirtualBox:
277 $MODULE_LIST
278See the documenatation for your Linux distribution." console
279 fi
280 fi
281 if ! running vboxdrv; then
282 if ! rm -f $DEVICE; then
283 failure "Cannot remove $DEVICE"
284 fi
285 if ! $MODPROBE vboxdrv > /dev/null 2>&1; then
286 setup
287 if ! $MODPROBE vboxdrv > /dev/null 2>&1; then
288 failure "modprobe vboxdrv failed. Please use 'dmesg' to find out why"
289 fi
290 fi
291 sleep .2
292 fi
293 # ensure the character special exists
294 if [ ! -c $DEVICE ]; then
295 MAJOR=`sed -n 's;\([0-9]\+\) vboxdrv$;\1;p' /proc/devices`
296 if [ ! -z "$MAJOR" ]; then
297 MINOR=0
298 else
299 MINOR=`sed -n 's;\([0-9]\+\) vboxdrv$;\1;p' /proc/misc`
300 if [ ! -z "$MINOR" ]; then
301 MAJOR=10
302 fi
303 fi
304 if [ -z "$MAJOR" ]; then
305 rmmod vboxdrv 2>/dev/null
306 failure "Cannot locate the VirtualBox device"
307 fi
308 if ! mknod -m 0660 $DEVICE c $MAJOR $MINOR 2>/dev/null; then
309 rmmod vboxdrv 2>/dev/null
310 failure "Cannot create device $DEVICE with major $MAJOR and minor $MINOR"
311 fi
312 fi
313 # ensure permissions
314 if ! chown :"${GROUP}" $DEVICE 2>/dev/null; then
315 rmmod vboxpci 2>/dev/null
316 rmmod vboxnetadp 2>/dev/null
317 rmmod vboxnetflt 2>/dev/null
318 rmmod vboxdrv 2>/dev/null
319 failure "Cannot change group ${GROUP} for device $DEVICE"
320 fi
321 if ! $MODPROBE vboxnetflt > /dev/null 2>&1; then
322 failure "modprobe vboxnetflt failed. Please use 'dmesg' to find out why"
323 fi
324 if ! $MODPROBE vboxnetadp > /dev/null 2>&1; then
325 failure "modprobe vboxnetadp failed. Please use 'dmesg' to find out why"
326 fi
327 if ! $MODPROBE vboxpci > /dev/null 2>&1; then
328 failure "modprobe vboxpci failed. Please use 'dmesg' to find out why"
329 fi
330 # Create the /dev/vboxusb directory if the host supports that method
331 # of USB access. The USB code checks for the existance of that path.
332 if grep -q usb_device /proc/devices; then
333 mkdir -p -m 0750 /dev/vboxusb 2>/dev/null
334 chown root:vboxusers /dev/vboxusb 2>/dev/null
335 fi
336 # Remove any kernel modules left over from previously installed kernels.
337 cleanup only_old
338 succ_msg "VirtualBox services started"
339}
340
341stop()
342{
343 begin_msg "Stopping VirtualBox services" console
344
345 if running vboxpci; then
346 if ! rmmod vboxpci 2>/dev/null; then
347 failure "Cannot unload module vboxpci"
348 fi
349 fi
350 if running vboxnetadp; then
351 if ! rmmod vboxnetadp 2>/dev/null; then
352 failure "Cannot unload module vboxnetadp"
353 fi
354 fi
355 if running vboxdrv; then
356 if running vboxnetflt; then
357 if ! rmmod vboxnetflt 2>/dev/null; then
358 failure "Cannot unload module vboxnetflt"
359 fi
360 fi
361 if ! rmmod vboxdrv 2>/dev/null; then
362 failure "Cannot unload module vboxdrv"
363 fi
364 if ! rm -f $DEVICE; then
365 failure "Cannot unlink $DEVICE"
366 fi
367 fi
368 succ_msg "VirtualBox services stopped"
369}
370
371# enter the following variables in /etc/default/virtualbox:
372# SHUTDOWN_USERS="foo bar"
373# check for running VMs of user foo and user bar
374# SHUTDOWN=poweroff
375# SHUTDOWN=acpibutton
376# SHUTDOWN=savestate
377# select one of these shutdown methods for running VMs
378stop_vms()
379{
380 wait=0
381 for i in $SHUTDOWN_USERS; do
382 # don't create the ipcd directory with wrong permissions!
383 if [ -d /tmp/.vbox-$i-ipc ]; then
384 export VBOX_IPC_SOCKETID="$i"
385 VMS=`$VBOXMANAGE --nologo list runningvms | sed -e 's/^".*".*{\(.*\)}/\1/' 2>/dev/null`
386 if [ -n "$VMS" ]; then
387 if [ "$SHUTDOWN" = "poweroff" ]; then
388 begin_msg "Powering off remaining VMs"
389 for v in $VMS; do
390 $VBOXMANAGE --nologo controlvm $v poweroff
391 done
392 succ_msg "Remaining VMs powered off"
393 elif [ "$SHUTDOWN" = "acpibutton" ]; then
394 begin_msg "Sending ACPI power button event to remaining VMs"
395 for v in $VMS; do
396 $VBOXMANAGE --nologo controlvm $v acpipowerbutton
397 wait=30
398 done
399 succ_msg "ACPI power button event sent to remaining VMs"
400 elif [ "$SHUTDOWN" = "savestate" ]; then
401 begin_msg "Saving state of remaining VMs"
402 for v in $VMS; do
403 $VBOXMANAGE --nologo controlvm $v savestate
404 done
405 succ_msg "State of remaining VMs saved"
406 fi
407 fi
408 fi
409 done
410 # wait for some seconds when doing ACPI shutdown
411 if [ "$wait" -ne 0 ]; then
412 begin_msg "Waiting for $wait seconds for VM shutdown"
413 sleep $wait
414 succ_msg "Waited for $wait seconds for VM shutdown"
415 fi
416}
417
418cleanup()
419{
420 # If this is set, only remove kernel modules for no longer installed
421 # kernels. Note that only generated kernel modules should be placed
422 # in /lib/modules/*/misc. Anything that we should not remove automatically
423 # should go elsewhere.
424 only_old="${1}"
425 for i in /lib/modules/*; do
426 # Check whether we are only cleaning up for uninstalled kernels.
427 test -n "${only_old}" && test -e "${i}/kernel/drivers" && continue
428 # We could just do "rm -f", but we only want to try deleting folders if
429 # we are sure they were ours, i.e. they had our modules in beforehand.
430 if test -e "${i}/misc/vboxdrv.ko" \
431 || test -e "${i}/misc/vboxnetadp.ko" \
432 || test -e "${i}/misc/vboxnetflt.ko" \
433 || test -e "${i}/misc/vboxpci.ko"; then
434 rm -f "${i}/misc/vboxdrv.ko" "${i}/misc/vboxnetadp.ko" \
435 "${i}/misc/vboxnetflt.ko" "${i}/misc/vboxpci.ko"
436 version=`expr "${i}" : "/lib/modules/\(.*\)"`
437 depmod -a "${version}"
438 sync
439 fi
440 # Remove the kernel version folder if it was empty except for us.
441 test "`echo ${i}/misc/* ${i}/misc/.?* ${i}/* ${i}/.?*`" \
442 = "${i}/misc/* ${i}/misc/.. ${i}/misc ${i}/.." &&
443 rmdir "${i}/misc" "${i}" # We used to leave empty folders.
444 done
445}
446
447# setup_script
448setup()
449{
450 begin_msg "Building VirtualBox kernel modules" console
451 log "Building the main VirtualBox module."
452 if ! myerr=`$BUILDINTMP \
453 --save-module-symvers /tmp/vboxdrv-Module.symvers \
454 --module-source "$MODULE_SRC/vboxdrv" \
455 --no-print-directory install 2>&1`; then
456 "${INSTALL_DIR}/check_module_dependencies.sh" || exit 1
457 log "Error building the module:"
458 module_build_log "$myerr"
459 failure "Look at $LOG to find out what went wrong"
460 fi
461 log "Building the net filter module."
462 if ! myerr=`$BUILDINTMP \
463 --use-module-symvers /tmp/vboxdrv-Module.symvers \
464 --module-source "$MODULE_SRC/vboxnetflt" \
465 --no-print-directory install 2>&1`; then
466 log "Error building the module:"
467 module_build_log "$myerr"
468 failure "Look at $LOG to find out what went wrong"
469 fi
470 log "Building the net adaptor module."
471 if ! myerr=`$BUILDINTMP \
472 --use-module-symvers /tmp/vboxdrv-Module.symvers \
473 --module-source "$MODULE_SRC/vboxnetadp" \
474 --no-print-directory install 2>&1`; then
475 log "Error building the module:"
476 module_build_log "$myerr"
477 failure "Look at $LOG to find out what went wrong"
478 fi
479 log "Building the PCI pass-through module."
480 if ! myerr=`$BUILDINTMP \
481 --use-module-symvers /tmp/vboxdrv-Module.symvers \
482 --module-source "$MODULE_SRC/vboxpci" \
483 --no-print-directory install 2>&1`; then
484 log "Error building the module:"
485 module_build_log "$myerr"
486 failure "Look at $LOG to find out what went wrong"
487 fi
488 rm -f /etc/vbox/module_not_compiled
489 depmod -a
490 sync
491 succ_msg "VirtualBox kernel modules built"
492 # Secure boot on Ubuntu and Debian.
493 if test -n "$HAVE_SEC_BOOT" &&
494 type update-secureboot-policy >/dev/null 2>&1; then
495 SHIM_NOTRIGGER=y update-secureboot-policy --new-key
496 fi
497 if test -f "$DEB_PUB_KEY" && test -f "$DEB_PRIV_KEY"; then
498 HAVE_DEB_KEY=true
499 for i in $MODULE_LIST; do
500 kmodsign sha512 /var/lib/shim-signed/mok/MOK.priv \
501 /var/lib/shim-signed/mok/MOK.der \
502 /lib/modules/"$KERN_VER"/misc/"$i".ko
503 done
504 # update-secureboot-policy "expects" DKMS modules.
505 # Work around this and talk to the authors as soon
506 # as possible to fix it.
507 mkdir -p /var/lib/dkms/vbox-temp
508 update-secureboot-policy --enroll-key 2>/dev/null ||
509 begin_msg "Failed to enroll secure boot key." console
510 rmdir -p /var/lib/dkms/vbox-temp 2>/dev/null
511 fi
512}
513
514dmnstatus()
515{
516 if running vboxdrv; then
517 str="vboxdrv"
518 if running vboxnetflt; then
519 str="$str, vboxnetflt"
520 if running vboxnetadp; then
521 str="$str, vboxnetadp"
522 fi
523 fi
524 if running vboxpci; then
525 str="$str, vboxpci"
526 fi
527 echo "VirtualBox kernel modules ($str) are loaded."
528 for i in $SHUTDOWN_USERS; do
529 # don't create the ipcd directory with wrong permissions!
530 if [ -d /tmp/.vbox-$i-ipc ]; then
531 export VBOX_IPC_SOCKETID="$i"
532 VMS=`$VBOXMANAGE --nologo list runningvms | sed -e 's/^".*".*{\(.*\)}/\1/' 2>/dev/null`
533 if [ -n "$VMS" ]; then
534 echo "The following VMs are currently running:"
535 for v in $VMS; do
536 echo " $v"
537 done
538 fi
539 fi
540 done
541 else
542 echo "VirtualBox kernel module is not loaded."
543 fi
544}
545
546case "$1" in
547start)
548 start
549 ;;
550stop)
551 stop_vms
552 stop
553 ;;
554stop_vms)
555 stop_vms
556 ;;
557restart)
558 stop && start
559 ;;
560setup)
561 test -n "${2}" && export KERN_VER="${2}"
562 # Create udev rule and USB device nodes.
563 ## todo Wouldn't it make more sense to install the rule to /lib/udev? This
564 ## is not a user-created configuration file after all.
565 ## todo Do we need a udev rule to create /dev/vboxdrv[u] at all? We have
566 ## working fall-back code here anyway, and the "right" code is more complex
567 ## than the fall-back. Unnecessary duplication?
568 stop && cleanup
569 setup_usb "$GROUP" "$DEVICE_MODE" "$INSTALL_DIR"
570 start
571 ;;
572cleanup)
573 stop && cleanup
574 cleanup_usb
575 ;;
576force-reload)
577 stop
578 start
579 ;;
580status)
581 dmnstatus
582 ;;
583*)
584 echo "Usage: $0 {start|stop|stop_vms|restart|force-reload|status}"
585 exit 1
586esac
587
588exit 0
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette