¿Cómo desinstalar VirtualBox 7.0.x que fue cancelado para instalar VirtualBox 6.1.x?

¿Cómo desinstalar VirtualBox 7.0.x que fue cancelado para instalar VirtualBox 6.1.x?

En Ubuntu Desktop 22.04 se ejecutó:

sudo dpkg -i virtualbox-7.0_7.0.4-154605~Ubuntu~jammy_amd64.deb 

Pero a través del proceso de desembalaje se canceló a través de ctrl+ c. Es porque se necesita la versión 6.1.40. Unos segundos después fue ejecutado.

sudo dpkg -i virtualbox-6.1_6.1.40-154048~Ubuntu~jammy_amd64.deb 

y muestra

(Reading database ... 200469 files and directories currently installed.)
Preparing to unpack virtualbox-6.1_6.1.40-154048~Ubuntu~jammy_amd64.deb ...
Unpacking virtualbox-6.1 (6.1.40-154048~Ubuntu~jammy) over (6.1.40-154048~Ubuntu~jammy) ...
dpkg: dependency problems prevent configuration of virtualbox-6.1:
 virtualbox-6.1 depends on libqt5core5a (>= 5.15.1); however:
  Package libqt5core5a is not installed.
 virtualbox-6.1 depends on libqt5gui5 (>= 5.14.1) | libqt5gui5-gles (>= 5.14.1); however:
  Package libqt5gui5 is not installed.
  Package libqt5gui5-gles is not installed.
 virtualbox-6.1 depends on libqt5opengl5 (>= 5.0.2); however:
  Package libqt5opengl5 is not installed.
 virtualbox-6.1 depends on libqt5printsupport5 (>= 5.0.2); however:
  Package libqt5printsupport5 is not installed.
 virtualbox-6.1 depends on libqt5widgets5 (>= 5.15.1); however:
  Package libqt5widgets5 is not installed.
 virtualbox-6.1 depends on libqt5x11extras5 (>= 5.6.0); however:
  Package libqt5x11extras5 is not installed.
 virtualbox-6.1 depends on libsdl1.2debian (>= 1.2.11); however:
  Package libsdl1.2debian is not installed.

dpkg: error processing package virtualbox-6.1 (--install):
 dependency problems - leaving unconfigured
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for shared-mime-info (2.1-2) ...
Errors were encountered while processing:
 virtualbox-6.1

Por lo tanto se ejecutó el sudo apt -f instally muestra

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: The package virtualbox-7.0 needs to be reinstalled, but I can't find an archive for it.

Con sudo apt purge virtualbox-7.0espectáculos

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: The package virtualbox-7.0 needs to be reinstalled, but I can't find an archive for it.

Si intento reinstalar VB 7 para purgarlo más tarde con

sudo apt install ./virtualbox-7.0_7.0.4-154605~Ubuntu~jammy_amd64.deb 

Muestra

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 virtualbox-6.1 : Depends: libqt5core5a (>= 5.15.1) but it is not installed
                  Depends: libqt5gui5 (>= 5.14.1) but it is not installed or
                           libqt5gui5-gles (>= 5.14.1) but it is not installed
                  Depends: libqt5opengl5 (>= 5.0.2) but it is not installed
                  Depends: libqt5printsupport5 (>= 5.0.2) but it is not installed
                  Depends: libqt5widgets5 (>= 5.15.1) but it is not installed
                  Depends: libqt5x11extras5 (>= 5.6.0) but it is not installed
                  Depends: libsdl1.2debian (>= 1.2.11)
                  Recommends: libsdl-ttf2.0-0 but it is not installed
                  Recommends: gcc but it is not installed
                  Recommends: make or
                              build-essential but it is not installed or
                              dpkg-dev but it is not installed
                  Recommends: binutils but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Si se ejecuta apt --fix-broken installse muestra

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: The package virtualbox-7.0 needs to be reinstalled, but I can't find an archive for it.

Si quiero reinstalar VB 6.1 con

sudo apt install ./virtualbox-6.1_6.1.40-154048~Ubuntu~jammy_amd64.deb 

se nota (observa que todavía se refiere a 7)

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: The package virtualbox-7.0 needs to be reinstalled, but I can't find an archive for it.

Si quiero desinstalar VB 6.1 se sudo apt purge virtualbox-6.1muestra

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: The package virtualbox-7.0 needs to be reinstalled, but I can't find an archive for it.

¿Cómo arreglar esto?

El objetivo es desinstalar VB 7 completo e instalar VB 6.1 en paz.

Alfa

De acuerdo con la sugerencia del usuario535733 si se ejecuta el comando:

sudo dpkg -i virtualbox-7.0_7.0.4-154605~Ubuntu~jammy_amd64.deb 

aparece

dpkg: regarding virtualbox-7.0_7.0.4-154605~Ubuntu~jammy_amd64.deb containing virtualbox-7.0:
 virtualbox-7.0 conflicts with virtualbox
  virtualbox-6.1 provides virtualbox and is present and unpacked but not configured.

dpkg: error processing archive virtualbox-7.0_7.0.4-154605~Ubuntu~jammy_amd64.deb (--install):
 conflicting packages - not installing virtualbox-7.0
Errors were encountered while processing:
 virtualbox-7.0_7.0.4-154605~Ubuntu~jammy_amd64.deb

Respuesta1

Encuentro una posible solución al usar el comando:

sudo dpkg --remove --force-remove-reinstreq <packagename>

De acuerdo con la publicación y la solución:

Pero su primer comentario indica:

This command should always be avoided as it breaks you system more than it repairs

No estoy seguro de si es verdad o no.Pero es un riesgo

Solución

Por lo tanto hice lo siguiente y finalmente funciona:

sudo cp /var/lib/dpkg/status status.bkp
sudo gedit /var/lib/dpkg/status

Elimine la sección que contiene el mensaje de error. En mi caso fue:

Package: virtualbox-7.0
Status: install reinstreq half-installed
Priority: optional
Section: contrib/misc
Architecture: amd64
Version: 7.0.4-154605~Ubuntu~jammy

Observar la status-instalar reinstreq medio instalado

La fuente/créditos de esta solución es gracias a esta publicación.

Por lo tanto los comandos funcionan bien.

sudo dpkg -i virtualbox-6.1_6.1.40-154048~Ubuntu~jammy_amd64.deb
sudo apt -f install

Y sobre VirtualBox7con los siguientes comandos sucede:

sudo apt remove virtualbox-7
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package virtualbox-7

sudo apt remove virtualbox-7.0
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'virtualbox-7.0' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

sudo apt purge virtualbox-7.0
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'virtualbox-7.0' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Entonces parece que todo está bien.

información relacionada