You are not logged in.

#1 2011-11-12 15:05:10

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,645
Website

Removing everything but base group-wiki advice broken [solved]

One liner on the wiki gives dep errors for me.  Thoughts?

My goal is to remove everything but the base group.

# pacman -Rs $(comm -23 <(pacman -Qeq) <(pacman -Qgq base))
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: acl: requires attr>=2.4.46
:: coreutils: requires pam
:: libcap: requires attr
:: libmediainfo: requires curl
:: libusb-compat: requires libusb
:: logrotate: requires cron
:: shadow: requires pam
:: usbutils: requires libusb

Last edited by graysky (2011-11-12 15:45:59)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2011-11-12 15:31:30

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Removing everything but base group-wiki advice broken [solved]

e.g. pam is not in 'base' group but it's required by e.g. coreutils, which are in 'base' group.
Try

for i in $(pacman -Qqg base); do pactree -ul $i >> base1; done

and

pacman -Rs $(comm -23 <(pacman -Qeq|sort) <(sort -u base1|cut -d ' ' -f 1))

Offline

#3 2011-11-12 15:40:46

Shark
Member
From: /dev/zero
Registered: 2011-02-28
Posts: 686

Re: Removing everything but base group-wiki advice broken [solved]

karol wrote:

e.g. pam is not in 'base' group but it's required by e.g. coreutils, which are in 'base' group.
Try

for i in $(pacman -Qqg base); do pactree -ul $i >> base1; done

and

pacman -Rs $(comm -23 <(pacman -Qeq|sort) <(sort -u base1|cut -d ' ' -f 1))

The last comand works flawlessly.

Last edited by Shark (2011-11-12 15:42:33)


If you have built castles in the air, your work need not be lost; that is where they should be. Now put foundations under them.
Henry David Thoreau

Registered Linux User: #559057

Offline

#4 2011-11-12 15:45:42

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,645
Website

Re: Removing everything but base group-wiki advice broken [solved]

I actually nuked my chroot and rebuilt so I'm reluctant to try it smile  Shark - since you have established that it worked, would you update the wiki page?

Thanks karol as usual smile


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2011-11-12 15:47:18

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Removing everything but base group-wiki advice broken [solved]

Shark wrote:
karol wrote:

e.g. pam is not in 'base' group but it's required by e.g. coreutils, which are in 'base' group.
Try

for i in $(pacman -Qqg base); do pactree -ul $i >> base1; done

and

pacman -Rs $(comm -23 <(pacman -Qeq|sort) <(sort -u base1|cut -d ' ' -f 1))

The last comand works flawlessly.

About the error you posted a second ago, both commands work for me, but I've just remembered I'm using pacman 4 ;P

Notes:
1. comm requires sorted input otherwise you get e.g. 'comm: file 1 is not in sorted order' error.
2. pactree prints the package name followed by what it provides e.g.

[karol@black ~]$ pactree -lu logrotate
logrotate
popt
glibc
linux-api-headers
tzdata
dcron cron
bash
readline
ncurses
gzip

Here it's the 'dcron cron' line.

[karol@black ~]$ sudo pacman -Rs $(comm -23 <(pacman -Qeq|sort) <(sort -u base1))
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: logrotate: requires cron

If we keep just 'dcron', things seem to work.


@graysky
It's safe to try, you'll get a prompt:

Total Removed Size:     1370,77 MiB

Do you want to remove these packages? [Y/n] 

Answer 'n' and you're fine.


======== Edit ========
Maybe the second command should be

pacman -Rs $(comm -23 <(pacman -Qq|sort) <(sort -u base1|cut -d ' ' -f 1))

The first bracket now has 'pacman -Qq' instead of 'pacman -Qeq', in case you have some package that's 'Installed as a dependency for another package' but not actually required by any.
The proper way of fixing such situation is

pacman -D --asexplicit <packagename>

======== Edit 2 ========
Oneliner w/o a temp file:

pacman -Rs $(comm -23 <(pacman -Qeq|sort) <((for i in $(pacman -Qqg base); do pactree -ul $i; done)|sort -u|cut -d ' ' -f 1))

Last edited by karol (2011-11-12 16:09:07)

Offline

#6 2011-11-12 16:05:13

Shark
Member
From: /dev/zero
Registered: 2011-02-28
Posts: 686

Re: Removing everything but base group-wiki advice broken [solved]

I have edited the wiki. https://wiki.archlinux.org/index.php/Pa … base_group
It is my first edit of wiki. I hope i did right.

Last edited by Shark (2011-11-12 16:09:14)


If you have built castles in the air, your work need not be lost; that is where they should be. Now put foundations under them.
Henry David Thoreau

Registered Linux User: #559057

Offline

#7 2011-11-12 16:10:59

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Removing everything but base group-wiki advice broken [solved]

Edited your edit so it uses this oneliner w/o a temp file:

pacman -Rs $(comm -23 <(pacman -Qeq|sort) <((for i in $(pacman -Qqg base); do pactree -ul $i; done)|sort -u|cut -d ' ' -f 1))

I'll add the notes explaining what's being done in a minute.

Offline

Board footer

Powered by FluxBB