Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating/Removing package causes error if egpu-switcher has not been set up #25

Closed
rvanlaar opened this issue Jan 24, 2020 · 16 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@rvanlaar
Copy link

Thanks for the new release.
I get a problem when updating under ubuntu 19.10

$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  egpu-switcher
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/8.288 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
(Reading database ... 293437 files and directories currently installed.)
Preparing to unpack .../egpu-switcher_0.12.0_amd64.deb ...
[info] Starting cleanup process
Failed to stop egpu.service: Unit egpu.service not loaded.
dpkg: warning: old egpu-switcher package pre-removal script subprocess returned error exit status 5
dpkg: trying script from the new package instead ...
[info] Starting cleanup process
Failed to stop egpu.service: Unit egpu.service not loaded.
dpkg: error processing archive /var/cache/apt/archives/egpu-switcher_0.12.0_amd64.deb (--unpack):
 new egpu-switcher package pre-removal script subprocess returned error exit status 5
Errors were encountered while processing:
 /var/cache/apt/archives/egpu-switcher_0.12.0_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
@ewagner12
Copy link
Contributor

Hmm, I didn't get this error when upgrading to the new version under Ubuntu 19.10. If it makes a difference, I upgraded with my eGPU plugged in and active.

@rvanlaar
Copy link
Author

There were multiple issues running in parallel here.
Apparently I had installed gswitch, and had ran `egpu-switcher cleanup.

Which mean I couldn't uninstall and or install a newer version.
That was also due in part because I didn't have a file that could be found by
ls -t xorg.conf.backup.*.
The uninstalled worked after executing the following:
cp -p xorg.conf.backup xorg.conf.backup.*

@hertg
Copy link
Owner

hertg commented Jan 27, 2020

I did not get this error either, but i've just received another report of the same problem #26.
Did you already setup egpu-switcher before upgrading, or did you just have the package installed, but not set up?

The problem seems to be the cleanup command trying to stop/disable the egpu-switcher systemd service. (https://github.com/hertg/egpu-switcher/blob/master/egpu-switcher#L432-L436)

If the service does not exist yet, this script will fail. Which is pretty bad for a function that is called before every upgrade.

It would probably be best to check if the systemd service exists before trying to disable it (https://unix.stackexchange.com/a/396638).

I will have a look at it, once i've got some spare time.

@rvanlaar
Copy link
Author

Did you already setup egpu-switcher before upgrading, or did you just have the package installed, but not set up?
I did have it installed, but not setup.

@tominglis
Copy link

If I set it up now, will the upgrade work? :-)

@hertg
Copy link
Owner

hertg commented Jan 27, 2020

If I set it up now, will the upgrade work? :-)

Yes. After executing egpu-switcher setup, I think you should be able to upgrade.
Would be great if you could try that and report back. :)

@tominglis
Copy link

OK. Do I need to have my eGPU plugged in to do that? If so it might need to wait until tonight after work, because I've got a bunch of docker stuff I'm running atm.

@hertg
Copy link
Owner

hertg commented Jan 28, 2020

Yes, you'll need to plug the EGPU in and authorize the Thunderbolt connection before running the setup.

@hertg hertg changed the title Problem updating under ubuntu 19.10 Updating package causes error if egpu-switcher has not been set up Feb 18, 2020
@hertg hertg self-assigned this Feb 18, 2020
@hertg hertg added the bug Something isn't working label Feb 18, 2020
@mogwai
Copy link

mogwai commented Feb 23, 2020

I can't upgrade or uninstall the package.

I've tried:

sudo egpu-swtcher cleanup
sudo apt remove egpu-switcher
sudo dpkg --remove --force-remove-reinstreq egpu-switcher

I've got a similar error message each time:

(Reading database ... 222939 files and directories currently installed.)
Removing egpu-switcher (0.11.1) ...
[info] Starting cleanup process
Failed to stop egpu.service: Unit egpu.service not loaded.
dpkg: error processing package egpu-switcher (--remove):
 installed egpu-switcher package pre-removal script subprocess returned error exit status 5
Errors were encountered while processing:
 egpu-switcher

@rvanlaar
Copy link
Author

The trick is to run sudo egpu-switcher setup before removing egpu-switcher.

@mogwai
Copy link

mogwai commented Feb 24, 2020

Apparently I need to have a gpu to do that:

[warn] Only 1 GPUs found, there need to be at least 2. Make sure to connect your EGPU for the setup.

@rvanlaar
Copy link
Author

try this:

cd /etc/X11
sudo cp -p xorg.conf.backup xorg.conf.backup.orig

The upgrade just needs to have a 'xorg.conf.backup.SOMETHING' script if I recall correctly.

@hertg
Copy link
Owner

hertg commented Feb 25, 2020

@mogwai @rvanlaar
The issue is that the cleanup tries to disable the systemd egpu.service.
But this service doesn't exist if the setup wasn't executed.

If you are unable to execute the setup (because you don't have an egpu at hand), you could try to create the egpu.service manually. After executing the following commands, you should be able to cleanup / remove egpu-switcher.

sudo cp /usr/share/egpu-switcher/egpu.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable egpu.service

I will introduce a fix for this issue, but unfortunately that won't affect already installed packages, because the error also occurs if you want to upgrade the package to the latest version.

I'm sorry for the inconvenience.

@hertg hertg changed the title Updating package causes error if egpu-switcher has not been set up Updating/Removing package causes error if egpu-switcher has not been set up Feb 25, 2020
@rvanlaar
Copy link
Author

Hi @hertg,

Thank you for your considerate reply.

  • Roland

@mogwai
Copy link

mogwai commented Feb 25, 2020

Thank you very much @hertg
Just to confirm a full list of instructions that worked for me on Ubuntu 18.04

git clone https://github.com/hertg/egpu-switcher
sudo cp egpu-switcher/egpu.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable egpu.service

@tominglis
Copy link

That worked thanks!

Tom

@hertg hertg closed this as completed in 5d63877 Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants