diff --git a/README.build b/README.build index 40ba1fe..de05185 100644 --- a/README.build +++ b/README.build @@ -1,45 +1,128 @@ -Instructions for creating a separate VirtualBox project and building the packages +Instructions for building the VirtualBox project Although it is possible to modify a project at the openSUSE Build System (OBS), I have found it to be more convenient to use the various osc commands to create a local copy, edit it on my own computer to fix any problems, and then push the result to OBS. +You will need a login account at OBS. This account is also used to login at openSUSE's +bugzilla, etc. Those credentials are also used by osc whose package must also be +installed. + A. Create a new sub-project: 1. Branch the package: - osc branch Virtualization virtualbox + The sources for Tumbleweed and the Leap releases have been merges, thus + development work can be concentrates on TW. To branch VB for Tumbleweed, + osc branch Virtualization virtualbox 2. Checkout the package using the "osc co" command listed -B. Build the project: +B. For the first time, test Build the project: 1. Use "osc build" to build. This step is rather compute intensive and takes about an hour on my Toshiba laptop with a dual-core Intel Core i7 CPU - with hyper-threading, 12 GB RAM, and an SSD. + with hyper-threading, 12 GB RAM, and an SSD. This build will create all the + VirtualBox packages except the kernel modules. To build them use "osc build -M kmp", + which takes a lot less time. The split was made to reduce the load on OBS. + Now, a kernel change only requires rebuild of the modules, not the entire package. 2. The build results are stored in the /var/tmp/build-root tree. These files can occupy a lot of disc space, particularly when one builds several flavors. To keep from running out of space on the / partition, I mount /var/tmp on - a separate partition. At present, I have used about 43 GiB in that partition. + a separate partition. In general, about 25 GB is required for each flavor, + thus the disk usabe can approach 100 GB. If you have plenty of headroom in /, + you can skip this separate partition. 3. Special flavors: When a new kernel is released, there may be several API changes that affect builds of the kernel modules used by VirtualBox. In Factory, the project that contains the latest kernels is "Kernel-HEAD-standard". To run a test build with - this kernel, use the command "osc build Kernel-HEAD-standard". When switching - between kernel projects, use of the "--clean" switch is advised, otherwise - strange "missing library" messages will result. - 4. On occasion, there may be breakage in the build when there is an update with + this kernel, use the command " osc build --alternative-project Kernel:HEAD standard". + Note: The syntax of this step has changed throughout the years. If it fails, ask + how to do it on the openSUSE Factory mailing list at opensuse-factory@opensuse.org. + When switching between kernel projects, use of the "--clean" switch is advised, + otherwise strange "missing library" messages will result. + 4. On occasion, there may be breakage in the build when there is an update of python or Qt. Use the "--alternative-project=" switch to force usage of - the revised component. + the revised component. You will need to ask at factory@lists.opensuse.org to + get the proper profect name. C. Steps to take with a new release: 1. When Oracle releases a new version, you will need to download the new tarball from https://download.virtualbox.org/virtualbox/. While downloading the file, I - also get the new UserManual.pdf. - 2. openSUSE makes some changes to the tarball by running the command - bash ./virtualbox-patch-source.sh - This command unpacks the tar file, makes some modifications to the source, and - recreates the tar file with "patched" in its name. Any further modifications + also get the new UserManual.pdf. I use the wget utility, but the browser could + be used. + 2. openSUSE makes some changes to the tarballi, which are done with the command + bash ./virtualbox-patch-source.sh + This script unpacks the tar file, removes Windows and Mac host code from the file, + and recreates the tar file with "patched" in its name. Any further modifications are made by patches that are applied during the build process. Do NOT make any further changes to the tar file. 3. Edit the "Version" line near the start of virtualbox.spec to select the new version. - 4. Use "osc rm " and "osc add " to get the new file into - osc. The local build will work without these changes, but the remote operations - will fail.` + 4. Use "osc rm " and "osc add " to get the + new file into osc. The local build will work without these changes, but the remote + operations with OBS will fail. + 5. VirtualBox at openSUSE is a multi-build package consisting of virtualbox-kmp and + the rest of virtualbox. The former builds in about 20% of the time needed for the + latter, thus it is best to start with the kmp part. + 6. The usual problems are as follows: + a. Fixing for kernel API changes are incorporated in a new release, thus our patch + is obsolete. + b. Oracle has revised their code such that one of the patches needed by openSUSE + fails to apply. + c. There are kernel API changes that break the building of the kmp part of VB. + 5. When fixing kernel API changes, keep in mind that Oracle will be 2-3 months behind + your needs; however, they will eventually include the necessary changes in their + distribution. If you find something that you do not know how to fix, you could file + a bug tracker at https://www.virtualbox.org/wiki/Bugtracker. Note that previous + reports have gotten the response "We do not support kernel X.Y" - a really helpful + response. To be able to back out your changes, create a new patch file for the + updates. An OBS or osc build will unpack the "patched" tarball and apply the patches. + To help in the creation of such patches, it is my practice to untar the tarball and + use quilt to create the necessary patch, refresh it, and then copy it back into the + main directory. At that point it can be added into the spec file. The utility + wiggle is useful in fixing patches that will not apply. + 6. Once the kmp modules, and the main part of VirtualBox are building correctly with + osc, use 'osc status' to indicate the file changes. Anything with a "?" as its status + is a new file that needs to be resolved. If these files are not added to the project, + they will not be uploaded to OBS. You should also remove any files made obsolete + because Oracle caught up with kernel API changes. At this point, the new release + should be tested by adding the directory + /var/tmp/build-root/.../home/abuild/rpmbuild/RPMS/x86_64 + to the list of repositories, and updating virtualbox from that new repository. These + packages will not be signed, thus you will get a warning that can be ignored. Be sure + to install virtualbox-host-source, as well as kernel-default-devel and kernel-devel + for the kernel you are running. After loading the updated packages, then run + 'sudo /lib/sbin/vboxconfig' to build and install the kernel modules. + 7. The new code can now be tested. Usually, the tests will not show any problems; + however, there was a version where Windows 7 failed to boot because of a virtual + BIOS change. With kernel 5.18, there was a major bug where the FPU was not being + saved. The symptoms ranged from application crashes in a Linux VM to a full virtual + machine crash in a Windows 10 VM. The patch for this problem was provided by Oracle, + only a few days before kernel 5.18.1 was released and added to Tumbleweed. Obviously, + both Windows and Linux systems should be tested to ensure that screen resizing, + bidirectional clipboard, and shared folders work with no crashes. + 8. Once the new release is tested and 'osc status' is clean, it is time to update the + changes file using the 'osc vc' command. I copy and paste the changes listed in + the Oracle release notes to the new entry and add references to any bugzilla entries. + In this section, it is essential that you list files that are deleted or added. It is + not necessary to mention the tarball change - it is implied. + 9. Now it is time to send the new material to OBS using the 'osc ci' command. The + material in the new section usually appears as the commit message. If not, copy it + from the .changes file. Committing new material will trigger builds at OBS. The + status of them can be seen with the 'osc r' command. Once the builds are successful, + they should be submitted using the 'osc sr' for Tumbleweed. One peculiarity of the + factory releases is that they require a review, even for your own changes. A few + minutes after an ‘osc sr’ command, you will need to log into OBS and check your + tasks for “Outgoing Requests”. From there, you will be able to submit a review. + 10. After VirtualBox is completed for Tumbleweed, and building OK on the various Leap + versions at OBS, you can branch the various Leap versions with the command + osc branch openSUSE:Leap:15.X:Update virtualbox + It is not necessary to check out the code as creating the directory that will + be used. If it already exists on your system, delete all files in that directory. + Then copy all the files from the Tumbleweed source into the Leap directory. To + syncronize your system wuth OBS, do an "osc update". At this point, you will + need to repeat the "osc rm" and "osc add" steps to update the version of the + tarball. After that, make sure that "osc status" is clean. At that point, update + the package at OBS with "osc ci". When "osc r" shows that the build has completed, + use "osc mr" to submit it to the project. For the update projects, no review by + the maintainer is requied. + 11. When a new Leap release is in a pre-release state, updated VB releases can be + sent to that project from OBS. + diff --git a/VirtualBox-5.2.10-xclient.patch b/VirtualBox-5.2.10-xclient.patch new file mode 100644 index 0000000..479d446 --- /dev/null +++ b/VirtualBox-5.2.10-xclient.patch @@ -0,0 +1,24 @@ +--- ./src/VBox/Additions/x11/Installer/98vboxadd-xclient.orig 2020-06-06 06:20:12.079227656 +0100 ++++ ./src/VBox/Additions/x11/Installer/98vboxadd-xclient 2020-06-06 06:26:55.886940895 +0100 +@@ -21,18 +21,11 @@ for i in $HOME/.vboxclient-*.pid; do + test -w $i || rm -f $i + done + +-if ! test -c /dev/vboxguest 2>/dev/null; then +- # Do not start if the kernel module is not present. +- # Execute notify-send in the back-ground to avoid racing with sddm, +- # as notify-send may wait for sddm to start while it waits for us to exit. +- notify-send "VBoxClient: the VirtualBox kernel service is not running. Exiting." & +-elif test -z "${SSH_CONNECTION}"; then +- # This script can also be triggered by a connection over SSH, which is not +- # what we had in mind, so we do not start VBoxClient in that case. We do +- # not use "exit" here as this script is "source"d, not executed. ++# Do not start if the kernel module is not present; or if this script is ++# triggered by a connection over SSH. ++if [ -c /dev/vboxguest -a -z "${SSH_CONNECTION}" ]; then + /usr/bin/VBoxClient --clipboard + /usr/bin/VBoxClient --checkhostversion + /usr/bin/VBoxClient --seamless + /usr/bin/VBoxClient --draganddrop +- /usr/bin/VBoxClient --vmsvga # In case VMSVGA emulation is enabled + fi diff --git a/vboxclient.desktop b/vboxclient.desktop new file mode 100644 index 0000000..bfb19d5 --- /dev/null +++ b/vboxclient.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Type=Application +Version=1.0 +Name=vboxclient +Name[C]=vboxclient +Comment[C]=VirtualBox User Session Services +Comment=VirtualBox User Session Services +Comment[it]=Servizi di sessione utente di VirtualBox +Comment[pl]=Usługi sesji użytkownika VirtualBox +Exec=/etc/X11/xinit/xinitrc.d/98vboxadd-xclient +X-GNOME-Autostart-enabled=true +X-KDE-autostart-after=panel +X-Desktop-File-Install-Version=0.26 + diff --git a/vboxclient.service b/vboxclient.service new file mode 100644 index 0000000..4d89e18 --- /dev/null +++ b/vboxclient.service @@ -0,0 +1,13 @@ +[Unit] +Description=VirtualBox guest VMSVGA resize client +ConditionVirtualization=|oracle +ExecCondition=sh -c '[[ "$XDG_SESSION_TYPE" == "wayland" ]] || exit -1' + +[Service] +Type=simple +ExecStart=/usr/bin/VBoxDRMClient +Restart=on-failure + +[Install] +WantedBy=multi-user.target + diff --git a/vboxservice.service b/vboxservice.service new file mode 100644 index 0000000..aaa9818 --- /dev/null +++ b/vboxservice.service @@ -0,0 +1,9 @@ +[Unit] +Description=VirtualBox guest services +ConditionVirtualization=|oracle + +[Service] +Type=simple +ExecStartPre=-/usr/sbin/modprobe vboxguest +ExecStart=/usr/sbin/VBoxService -f +Restart=on-failure diff --git a/virtualbox-60-vboxguest.rules b/virtualbox-60-vboxguest.rules index 17abe09..7ec3ada 100644 --- a/virtualbox-60-vboxguest.rules +++ b/virtualbox-60-vboxguest.rules @@ -1,2 +1,6 @@ KERNEL=="vboxguest", NAME="vboxguest", OWNER="root", MODE="0660" ENV{ID_INPUT}="1", ENV{ID_INPUT_MOUSE}="1" -KERNEL=="vboxuser", NAME="vboxuser", OWNER="root", MODE="0660", TAG+="uaccess" +KERNEL=="vboxuser", NAME="vboxuser", OWNER="vboxadd", MODE="0666" +#KERNEL=="vboxuser", NAME="vboxuser", OWNER="root", MODE="0660", TAG+="uaccess" + +ACTION=="add|change", SUBSYSTEM=="drm", KERNEL=="card[0-9]", SUBSYSTEMS=="pci", ATTRS{vendor}=="0x15ad", ATTRS{device}=="0x0405", TAG+="systemd", ENV{SYSTEMD_WANTS}="vboxclient.service" + diff --git a/virtualbox.changes b/virtualbox.changes index 5392166..93c7ce8 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Aug 10 12:00:31 UTC 2022 - Larry Finger + +- Fix screen resizing under Wayland (boo#1194126 and boo#1194126) + New files are "VirtualBox-5.2.10-xclient.patch", "vboxclient.desktop", + "vboxclient.service", and "vboxservice.service" + The fixes were derived from looking at many hundreds of Web pages, and + by looking at the code in Fedora35. Thanks to RedHat for the help. + ------------------------------------------------------------------- Thu Jul 21 19:52:13 UTC 2022 - Larry Finger diff --git a/virtualbox.spec b/virtualbox.spec index 4874f7f..32be310 100644 --- a/virtualbox.spec +++ b/virtualbox.spec @@ -75,6 +75,8 @@ Source8: update-extpack.sh Source9: virtualbox-wrapper.sh Source10: virtualbox-LocalConfig.kmk Source11: virtualbox-60-vboxdrv.rules +Source12: vboxclient.service +Source13: vboxservice.service Source14: vboxdrv.service Source15: vboxadd-service.service Source16: vboxconfig.sh @@ -86,6 +88,7 @@ Source21: vboxweb-service.service Source22: vboxweb-service.sh Source23: vboxautostart-service.service Source24: vboxautostart-service.sh +Source25: vboxclient.desktop Source97: README.build Source98: virtualbox-rpmlintrc Source99: virtualbox-patch-source.sh @@ -150,6 +153,7 @@ Patch125: remove_vbox_video_build.patch # fix library search Patch128: fix_lib_search.patch # Fixes for modified kernel in Leap 42.3 +Patch129: VirtualBox-5.2.10-xclient.patch Patch130: fixes_for_Leap42.3.patch # Fixes for SLE12 Patch131: fixes_for_sle12.patch @@ -298,11 +302,8 @@ the terms of the GNU Public License (GPL). - - - - ########################################## + %package qt Summary: Qt GUI part for %{name} Group: System/Emulators/PC @@ -324,11 +325,8 @@ This package contains the code for the GUI used to control VMs. - - - - ######################################### + %package websrv Summary: WebService GUI part for %{name} Group: System/Emulators/PC @@ -343,46 +341,19 @@ The VirtualBox web server is used to control headless VMs using a browser. - - - - - - -######################################### -%package guest-x11 -Summary: VirtualBox X11 drivers for mouse and video -Group: System/X11/Servers/XF86_4 -Requires: %{name}-kmp = %{version} -Requires: libnotify-tools -Supplements: modalias(xorg-x11-server:pci:v000080EEd0000CAFEsv*sd*bc*sc*i*) -#rename from xorg-x11-driver-virtualbox-ose: -Provides: xorg-x11-driver-virtualbox-ose = %{version} -Obsoletes: xorg-x11-driver-virtualbox-ose < %{version} - -%description guest-x11 -This package contains X11 guest utilities and X11 guest mouse and video drivers - - - - - - - - - - ########################################### %package guest-tools Summary: VirtualBox guest tools Group: System/Emulators/PC Requires: %{name}-kmp = %{version} +Requires: libnotify-tools # for /usr/lib/virtualbox/vboxadd-service Requires: which Supplements: modalias(pci:v000080EEd0000CAFEsv*sd*bc*sc*i*) #rename from "ose" version: Provides: %{name}-ose-guest-tools = %{version} Obsoletes: %{name}-ose-guest-tools < %{version} +Obsoletes: xorg-x11-driver-virtualbox-ose < %{version} %if ! 0%{?suse_version} > 1325 Requires(pre): net-tools-deprecated %endif @@ -395,11 +366,8 @@ VirtualBox guest addition tools. - - - - ########################################### + %package -n python3-%{name} Summary: Python bindings for %{name} Group: Development/Libraries/Python @@ -422,11 +390,8 @@ Python XPCOM bindings to %{name}. Used e.g. by vboxgtk package. - - - - ########################################### + %package devel Summary: Devel files for %{name} Group: Development/Libraries/Other @@ -444,11 +409,8 @@ Development file for %{name} - - - - ########################################### + %package host-source Summary: Source files for %{name} host kernel modules Group: Development/Sources @@ -483,11 +445,8 @@ sudo %{_sbindir}/vboxguestconfig - - - - ########################################### + %package guest-desktop-icons Summary: Icons for guest desktop files Group: System/Emulators/PC @@ -503,11 +462,8 @@ This package contains icons for guest desktop files that were created on the des - - - - ########################################### + %package vnc Summary: VNC desktop sharing Group: System/Emulators/PC @@ -559,6 +515,7 @@ This package contains the kernel-modules that VirtualBox uses to create or run v %patch124 -p1 %patch125 -p1 %patch128 -p1 +%patch129 -p1 # Adjustments that are version dependent %if 0%{?sle_version} == 120300 && 0%{?is_opensuse} # Patch for Leap 42.3 @@ -625,8 +582,8 @@ sed -i 's:include/drm:%{_prefix}/src/linux/include/drm:' src/VBox/Additions/linu %if %{main_package} %build # Disable LTO - Link Time Optimization -%define _lto_cflags %{nil} -#ensure we don't ever use them + %define _lto_cflags %{nil} + #ensure we don't ever use them rm -rf src/libs/{libpng-*,libxml2-*,libxslt-*,zlib-*,boost-*} # --disable-kmods don't build Linux kernel modules - but use SUSE specific way see few lines under @@ -687,19 +644,28 @@ install -d %{buildroot}%{_unitdir}/multi-user.target.wants install -d -m 755 %{buildroot}%{_sysconfdir}/vbox install -d -m 755 %{buildroot}%{_sysconfdir}/vbox/autostart.d install -d -m 755 %{buildroot}%{_udevrulesdir} -install -d -m 755 %{buildroot}%{_distconfdir}/X11/xinit/xinitrc.d +install -d -m 755 %{buildroot}/etc/X11/xinit/xinitrc.d ########################################### echo "entering guest-tools install section" ########################################### -install -m 755 out/linux.*/release/bin/additions/VBoxControl %{buildroot}%{_bindir}/VBoxControl +install -m 755 out/linux.*/release/bin/additions/VBoxControl %{buildroot}%{_bindir} install -m 755 out/linux.*/release/bin/additions/VBoxService %{buildroot}%{_sbindir}/VBoxService install -m 755 out/linux.*/release/bin/additions/mount.vboxsf %{buildroot}%{_sbindir}/mount.vboxsf install -m 744 src/VBox/Additions/linux/installer/vboxadd-service.sh %{buildroot}%{_vbox_instdir}/vboxadd-service install -d %{buildroot}%{_userunitdir} # udev rule for guest (virtualbox-guest-tools) install -m 644 %{SOURCE3} %{buildroot}%{_udevrulesdir}/60-vboxguest.rules +install -p -m 0644 -D %{SOURCE12} %{buildroot}%{_unitdir}/vboxclient.service +install -p -m 0644 -D %{SOURCE13} %{buildroot}%{_unitdir}/vboxservice.service # /media is used for auto-mounting of shared folders +#VBoxClient daemon (support for clipboard,autoresize,seamless windows) +install -m 755 out/linux.*/release/bin/additions/VBoxClient %{buildroot}%{_bindir} +install -m 755 out/linux.*/release/bin/additions/VBoxDRMClient %{buildroot}%{_bindir} +# install init script which start VBoxClient daemon (support for clipboard,autoresize,seamless windows) +install -m 755 src/VBox/Additions/x11/Installer/98vboxadd-xclient %{buildroot}/etc/X11/xinit/xinitrc.d/ +install -d %{buildroot}%{_sysconfdir}/xdg/autostart/ +install -m 644 %{SOURCE25} %{buildroot}/etc/xdg/autostart/vboxclient.desktop %if 0%{?suse_version} > 1320 || 0%{?sle_version} == 120300 install -d -m 755 %{buildroot}/media %endif @@ -712,17 +678,6 @@ mkdir -p "%{buildroot}%{_datadir}/virtualbox/extensions/" install -D -m 644 VNC-*.vbox-extpack "%{buildroot}%{_datadir}/virtualbox/extensions/VNC-%{version}.vbox-extpack" popd -# -############################################################## -echo "entering guest-x11 install section" -############################################################## -pushd out/linux.*/release/bin/additions/ -#VBoxClient daemon (support for clipboard,autoresize,seamless windows) -install -m 755 VBoxClient %{buildroot}%{_bindir} -popd -# install init script which start VBoxClient daemon (support for clipboard,autoresize,seamless windows) -install -m 755 src/VBox/Additions/x11/Installer/98vboxadd-xclient %{buildroot}%{_distconfdir}/X11/xinit/xinitrc.d/vboxadd-xclient.sh - ############################################## echo "entering virtualbox(-qt) install section" ############################################## @@ -951,6 +906,8 @@ done %post guest-tools %service_add_post vboxadd-service.service +%service_add_post vboxclient.service +%service_add_post vboxservice.service %post websrv %service_add_post vboxweb-service.service @@ -975,6 +932,8 @@ exit 0 %stop_on_removal vboxadd-service %stop_on_removal vboxadd %service_del_preun vboxadd-service.service +%systemd_preun vboxclient.service +%systemd_preun vboxservice.service exit 0 %preun websrv @@ -1004,6 +963,8 @@ export DISABLE_RESTART_ON_UPDATE=yes %restart_on_update vboxadd %restart_on_update vboxadd-service %service_del_postun vboxadd-service.service +%service_del_postun vboxclient.service +%service_del_postun vboxservice.service %postun websrv %restart_on_update vboxweb-service @@ -1115,13 +1076,6 @@ export DISABLE_RESTART_ON_UPDATE=yes %endif %{_udevrulesdir}/60-vboxdrv.rules -%files guest-x11 -%dir %{_libdir}/xorg/modules/drivers -%dir %{_libdir}/xorg/modules/input -%dir %{_libdir}/dri/ -%{_bindir}/VBoxClient -%{_distconfdir}/X11/xinit/xinitrc.d/vboxadd-xclient.sh - %files guest-tools %{_bindir}/VBoxControl %{_sbindir}/VBoxService @@ -1131,6 +1085,20 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_vbox_instdir}/vboxadd-service %{_unitdir}/vboxadd-service.service %{_unitdir}/multi-user.target.wants/vboxadd-service.service +%dir %{_libdir}/xorg/modules/drivers +%dir %{_libdir}/xorg/modules/input +%dir %{_libdir}/dri/ +%dir /etc/X11 +%dir /etc/X11/xinit +%dir /etc/X11/xinit/xinitrc.d +%{_bindir}/VBoxClient +%{_bindir}/VBoxDRMClient +/etc/X11/xinit/xinitrc.d/98vboxadd-xclient +%{_unitdir}/vboxclient.service +%{_unitdir}/vboxservice.service +%dir /etc/xdg +%dir /etc/xdg/autostart +/etc/xdg/autostart/vboxclient.desktop %if 0%{?suse_version} > 1320 || 0%{?sle_version} == 120300 %dir /media %endif