Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to get rid of CUPS on an system with openjdk
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
gugozte26
n00b
n00b


Joined: 09 Nov 2024
Posts: 6

PostPosted: Sat Nov 09, 2024 2:53 am    Post subject: How to get rid of CUPS on an system with openjdk Reply with quote

Good evening to everyone.

Today I made my first install, and I can say that Gentoo is one of the best pieces of software I've ever used.

After setting up everything (my DE, web browsers and other software I use daily), I installed Java.

As always, I referred to the wiki page, but I accidentally installed **dev-java/openjdk**, and CUPS with it.
(The package already installs JRE too, which pulls dependencias like CUPS for printing, other deps for audio, etc).

As I'm still a Portage "n00b", I started looking for threads on the topic on-line. I'll write the whole process for a better understanding of my issue:

~ https://bugs.gentoo.org/show_bug.cgi?id=806127
- This post suggested that I should use *"emerge --with-bdeps=n --depclean --pretend"* (huge mistake, as I removed +100 bdeps, almost breaking my systemd)

After following this post, I updated the system and reinstalled all my bdeps, which gave me an error with "ghostscript-glp" (the solution was either doing emerge --sync &/or adding the "cups" use flag.

Then, I went to the Java wiki again and I made sure I set the correct USE flags for the package (as I don't need printing or ALSA on my system).

I finally tried removing with "--depclean" the OpenJDK package, but it was being pulled by **app-text/ghostscript-gpl**, which at the same time was being pulled by Doxygen >> Wireplumber >> etc...

I wouldn't mind reinstalling Gentoo again, as it doesn't take much time on my PC, but I'd rather prefer learning how to fix my system.
How could I fix this?

Thanks in regard :)
_________________
Ily gugi<3
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 367

PostPosted: Sat Nov 09, 2024 6:07 am    Post subject: Reply with quote

gugozte26 wrote:
post suggested that I should use *"emerge --with-bdeps=n --depclean --pretend"* (huge mistake, as I removed +100 bdeps, almost breaking my systemd)

That command shouldn't have removed anything thanks to the --pretend switch.
Even without it, depclean is most often safe as emerge will check that nothing depends on the packages it would try to remove.

What's questionable is the --with-bdeps=n switch, which makes portage only consider run time dependencies.
Tha you had ~100 build-only dependencies is not strange at all and removing them shouldn't break anything.
Removing BDEPENDs is dubious though, as you will have install them again when building something that you are actually using.

gugozte26 wrote:
As always, I referred to the wiki page, but I accidentally installed **dev-java/openjdk**, and CUPS with it.
(The package already installs JRE too, which pulls dependencias like CUPS for printing, other deps for audio, etc).

Your post explains what you have tried, but is a bit vague on what went wrong and is very vague on what was the intention.
Before I suggest any next step, were you looking for a way to install JDK or JRE?

gugzote26 wrote:
I wouldn't mind reinstalling Gentoo again, as it doesn't take much time on my PC, but I'd rather prefer learning how to fix my system.

If you go digging through the forum you will see people saying saying stuff "you may reinstall, but that will rob you of the opportunity to learn about your system", or something like "you never need to reinstall gentoo".
That goes for much harder problems than yours. Yours is just a case of not being careful with USE flags while trying to maintain a constrain such as "never install $THING", yet not telling portage to warn you when it tries to install $THING.
Back to top
View user's profile Send private message
gugozte26
n00b
n00b


Joined: 09 Nov 2024
Posts: 6

PostPosted: Sat Nov 09, 2024 11:59 am    Post subject: Reply with quote

bstaletic wrote:
gugozte26 wrote:
post suggested that I should use *"emerge --with-bdeps=n --depclean --pretend"* (huge mistake, as I removed +100 bdeps, almost breaking my systemd)

That command shouldn't have removed anything thanks to the --pretend switch.
Even without it, depclean is most often safe as emerge will check that nothing depends on the packages it would try to remove.

What's questionable is the --with-bdeps=n switch, which makes portage only consider run time dependencies.
Tha you had ~100 build-only dependencies is not strange at all and removing them shouldn't break anything.
Removing BDEPENDs is dubious though, as you will have install them again when building something that you are actually using.

gugozte26 wrote:
As always, I referred to the wiki page, but I accidentally installed **dev-java/openjdk**, and CUPS with it.
(The package already installs JRE too, which pulls dependencias like CUPS for printing, other deps for audio, etc).

Your post explains what you have tried, but is a bit vague on what went wrong and is very vague on what was the intention.
Before I suggest any next step, were you looking for a way to install JDK or JRE?

gugzote26 wrote:
I wouldn't mind reinstalling Gentoo again, as it doesn't take much time on my PC, but I'd rather prefer learning how to fix my system.

If you go digging through the forum you will see people saying saying stuff "you may reinstall, but that will rob you of the opportunity to learn about your system", or something like "you never need to reinstall gentoo".
That goes for much harder problems than yours. Yours is just a case of not being careful with USE flags while trying to maintain a constrain such as "never install $THING", yet not telling portage to warn you when it tries to install $THING.


Thanks a lot for taking the time to help me.

What I'm trying to do is removing the openjdk package (I only have this one installed, not the -bin one), which I can't remove as it depends on other packages (I was able to remove it before reinstalling the bdeps I told you about, but after doing so, it became dependent ghostscript-gpl, as this one package has "cups" set on "/etc/portage/package.use"

/// It seems that openjdk depends on cups BUT you can avoid this by adding "-cups" before installing, step that I didn't reproduce by mistake. I'd like to remove openjdk and build it again without cups. ///

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

About the command I used for removing "bdepends=n", I used it after removing "orphan" dependencies with --depclean (by orphan I mean, not used by other packages. I come from Void Linux ;)), but this one didn't remove anything, so I used "w..bdeps=n" ane removed around 180~182 packages. I'm a little bit obsessed with disk space, and after doing my fresh install with X + Xfce4 + other software I use daily, I had around 792 packages.

I didn't read the entire USE flag list, but I made sure I didn't have support for things that take much of the space on a system (Wayland, Bluetooth, Qt(1,4,5,6), gnome, cups, etc). I know everything is installed by source in Gentoo, if you don't install binaries, but seeing this huge number made me try this command.

The bdepends I removed, along other ones, were packages like: clang, ninja, note.js, etc. I searched on-line and read that, as much as they are just used on building time, removing them isn't a good idea as: 1. Some of then take a good bit of time (note.js...), 2. They can lead to a broken system. Also, whenever I updated the system they'd still be installed all over again, and not having them (I suppose) would let to version conflict (as you could install a previous package version of these bdeps?)

I know that -c "--depclean" and "--with-bdeps" are two different switches with both different uses, but, are the bdeps I listed above necessary for running your system? Or do I need to leave them installed and update them whenever I update Gentoo?

If this is the case, is there any way I can reduce the number of installed packages if --depclean doesn't output anything? (At least to 600~650 XD)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sorry for the long reply, but I wanted to ask this two things, for both learning how to fix my issue and for learning for once what I did wrong when removing bdeps.

Best regards! :)
_________________
Ily gugi<3


Last edited by gugozte26 on Sat Nov 09, 2024 7:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
gugozte26
n00b
n00b


Joined: 09 Nov 2024
Posts: 6

PostPosted: Sat Nov 09, 2024 1:00 pm    Post subject: Reply with quote

I've successfully removed cups from my system, by removing the entry for ghostscript from "/etc/portage/package.use" and updating with "emerge -avuDN @world". After doing this, I removed openjdk and went back to the starting point.

This time, I made sure I'd set the correct USE flags for JRE (which gets installed when you install openjdk), as stated on the wiki page: https://wiki.gentoo.org/wiki/Java

"dev-java/openjdk headless-awt -alsa -cups
dev-java/openjdk-bin headless-awt -alsa -cups"

After doing so, I tried reinstalling openjdk with "emerge --ask --oneshot virtual/jdk" and it finally didn´t pull CUPS. However, the program I'm trying to run requires Java 8, so I tried installing this version with "emerge --ask dev-java/openjdk:8" and it seems that is pulling CUPS again! I tried installing JDK8 without installing JDK17 first, and I got the same dependency tree output.

Searching on-line, I found this post: https://bugs.gentoo.org/show_bug.cgi?id=806127

"runtime optional dependency is not meaningless though.
as you can delete bdeps after build is done.
try building it with USE=-cups
and running emerge --with-bdeps=n --depclean --pretend"

Running "--with-bdeps=n --depclean --pretend" after building JDK8 *may* remove CUPS, but as I previously stated on my previous reply, other bdeps like *clang*, *note.js*, etc, will get removed too (around 180~182 packages), and I'm not sure if removing them will break my system or not.
(The bug report above states: "portage will offer to clean it, as it's not required at runtime because of that additional dependency", but, how do I know if a bdep is a runtime or a build dependency? For example, node.js.).



What I don't get is, if I remove those 182 bdeps, whenever I update the system, they will get installed all over again, BUT on the version they were removed or with the, suppose they got update, new one? And, if they get installed again, will I need to remove them every single time I update the system? (As I just need them for building/updating, not for runtime).
_________________
Ily gugi<3
Back to top
View user's profile Send private message
gugozte26
n00b
n00b


Joined: 09 Nov 2024
Posts: 6

PostPosted: Sat Nov 09, 2024 6:59 pm    Post subject: Reply with quote

gugozte26 wrote:
I've successfully removed cups from my system, by removing the entry for ghostscript from "/etc/portage/package.use" and updating with "emerge -avuDN @world". After doing this, I removed openjdk and went back to the starting point.

This time, I made sure I'd set the correct USE flags for JRE (which gets installed when you install openjdk), as stated on the wiki page: https://wiki.gentoo.org/wiki/Java

"dev-java/openjdk headless-awt -alsa -cups
dev-java/openjdk-bin headless-awt -alsa -cups"

After doing so, I tried reinstalling openjdk with "emerge --ask --oneshot virtual/jdk" and it finally didn´t pull CUPS. However, the program I'm trying to run requires Java 8, so I tried installing this version with "emerge --ask dev-java/openjdk:8" and it seems that is pulling CUPS again! I tried installing JDK8 without installing JDK17 first, and I got the same dependency tree output.

Searching on-line, I found this post: https://bugs.gentoo.org/show_bug.cgi?id=806127

"runtime optional dependency is not meaningless though.
as you can delete bdeps after build is done.
try building it with USE=-cups
and running emerge --with-bdeps=n --depclean --pretend"

Running "--with-bdeps=n --depclean --pretend" after building JDK8 *may* remove CUPS, but as I previously stated on my previous reply, other bdeps like *clang*, *note.js*, etc, will get removed too (around 180~182 packages), and I'm not sure if removing them will break my system or not.
(The bug report above states: "portage will offer to clean it, as it's not required at runtime because of that additional dependency", but, how do I know if a bdep is a runtime or a build dependency? For example, node.js.).



What I don't get is, if I remove those 182 bdeps, whenever I update the system, they will get installed all over again, BUT on the version they were removed or with the, suppose they got update, new one? And, if they get installed again, will I need to remove them every single time I update the system? (As I just need them for building/updating, not for runtime).



According to this post: https://reddit.rtrace.io/r/Gentoo/comments/ya2i7s/do_i_really_need_to_keep_bdepends_installed/
Yes, they can be removed, but updating will build them again. I pretend on updating my system maybe once a week, as I find Gentoo very stable, but still, I wouldn't like spending whole days fixing a dependency loop hole.

What I don't understand is how people say they have 600~650, I guess 2 years (since the post I've read on the matter were written) it's a lot of time, and distros get heavier and heavier, but it's incredible how X, a DE like XFCE, Perl modules and other non used packages can get almost to 300~400 packages. I guess I'll need to get used to seeing a number starting with "8" or "9" when running neofetch ;_)
_________________
Ily gugi<3
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 367

PostPosted: Sat Nov 09, 2024 7:25 pm    Post subject: Reply with quote

I see you've found the solution you were looking for - USE=-cups

gugozte26 wrote:
What I don't get is, if I remove those 182 bdeps, whenever I update the system, they will get installed all over again, BUT on the version they were removed or with the, suppose they got update, new one? And, if they get installed again, will I need to remove them every single time I update the system? (As I just need them for building/updating, not for runtime).


You will get the "best" version available at the time you run emerge, which might be a new version at some point in the future.
If you want to not keep BDEPENDs installed, you will have to remove them after every update.

gugozte26 wrote:
What I don't understand is how people say they have 600~650


I have 516. I'm using dwm, which I'm sure saves a lot compared to a system that uses XFCE/KDE/GNOME.
I've also been using lilo as the bootloader, which is tiny.
There's only 3 perl packages here, not counting virtuals.

One of my previous machines was even slimmer, as it didn't have anything Xorg related.
Back to top
View user's profile Send private message
gugozte26
n00b
n00b


Joined: 09 Nov 2024
Posts: 6

PostPosted: Sat Nov 09, 2024 7:44 pm    Post subject: Reply with quote

bstaletic wrote:
I see you've found the solution you were looking for - USE=-cups

gugozte26 wrote:
What I don't get is, if I remove those 182 bdeps, whenever I update the system, they will get installed all over again, BUT on the version they were removed or with the, suppose they got update, new one? And, if they get installed again, will I need to remove them every single time I update the system? (As I just need them for building/updating, not for runtime).


You will get the "best" version available at the time you run emerge, which might be a new version at some point in the future.
If you want to not keep BDEPENDs installed, you will have to remove them after every update.

gugozte26 wrote:
What I don't understand is how people say they have 600~650


I have 516. I'm using dwm, which I'm sure saves a lot compared to a system that uses XFCE/KDE/GNOME.
I've also been using lilo as the bootloader, which is tiny.
There's only 3 perl packages here, not counting virtuals.

One of my previous machines was even slimmer, as it didn't have anything Xorg related.



As a sum up of the post, for newcomers that may enter and read:

* Always be sure to read EVERY single line on the wiki, as USE flags can do what you need the 99.9% of the time

* Removing building deps can save some disk space, but you will need to remove and recompile them again every update. Doing so can lead to version conflicts, so I'd recommend to leave them installed and use the "--clean" switch instead (as it will remove previous versions ONLY if you emerged them before the newer version).

* DEs and X take A LOT of space xD


Now, about the main topic. I got to install JDK8 without cups by installing "dev-java/openjdk-bin:8", which is the (I suppose) binary pkg. The thing is, I didn´t even set any binary mirror when following the Installation Handbook, and I didn´t even pass the "--getbinpkg" switch. Does this mean that a "-bin" package doesn´t need to be installed with binary support when emerging it? (I know there are more cases like this, like "firefox-bin", but on the Wiki it's emerged WITHOUT "--getbinpkg".

On the man page for emerge, it's stated:

"--getbinpkg ~~~ Using the server and location defined in PORTAGE_BINHOST (see make.conf(5)), portage will download the information from each binary package found and it will use that information to help build the dependency list. This option implies -k. (Use -gK for binary-only merging"

So, if I emerge bin pkgs without this switch, will I need to add it when updating the system so it ALSO updates binaries? Or will it get updated as any other package installed? If so, will it give me dependency issues when updating as it didn´t "help build the dependency list" when emerging the first time?


Thanks :)
_________________
Ily gugi<3
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 367

PostPosted: Sat Nov 09, 2024 7:50 pm    Post subject: Reply with quote

--getbinpkg has little to do with packages that have the -bin suffix.
Rather, if you set up a binhost (/etc/portage/binrepos.conf), then, instead of emerge reading and executing ebuilds, --gebinpkg will contact the binary host and see if there's an already compiled package with the matching USE flags.
Back to top
View user's profile Send private message
gugozte26
n00b
n00b


Joined: 09 Nov 2024
Posts: 6

PostPosted: Sat Nov 09, 2024 8:13 pm    Post subject: Reply with quote

bstaletic wrote:
--getbinpkg has little to do with packages that have the -bin suffix.
Rather, if you set up a binhost (/etc/portage/binrepos.conf), then, instead of emerge reading and executing ebuilds, --gebinpkg will contact the binary host and see if there's an already compiled package with the matching USE flags.


Amaaazing, thanks a lot for our your help, you solved all my doubts. I don´t know if there is a way of upvoting your replies, like on Reddit, if it exists, let me know so I can thank you :)
_________________
Ily gugi<3
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum