{"id":1523,"date":"2007-10-26T11:43:00","date_gmt":"2007-10-26T11:43:00","guid":{"rendered":"http:\/\/gleamynode.net\/articles\/1523\/rpmdepclean-uninstalling-unnecessary-rpms"},"modified":"2022-12-28T01:46:23","modified_gmt":"2022-12-27T16:46:23","slug":"rpmdepclean-uninstalling-unnecessary-rpms","status":"publish","type":"post","link":"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/","title":{"rendered":"rpmdepclean – Uninstalling unnecessary RPMs"},"content":{"rendered":"

I spent a couple of sleepless nights to switch from Gentoo Linux<\/a> to Fedora Core<\/a>, since I became a Red Hat employee. Although Fedora Core is really a nice Linux distribution, I still miss the concept of ‘world’ in Gentoo.
\nWhen a user installs a Gentoo package, the name of the installed package is appended the ‘world’ file. What’s interesting is that the dependencies of the installed package are not added to the ‘world’ file. What happens when you uninstall the package registered in the world file is that the name of the package is removed. It’s very simple, but it’s powerful when you don’t want unnecessary packages take up disk space. (Yeah, I am a paranoid. \ud83d\ude42
\nNow, from the world file, we know what packages were installed by our own request and what were installed just as dependencies, so Gentoo can identify the unnecessary packages that is safe to be removed. Consequently, running ‘emerge --depclean<\/tt>‘ cleans up all the unnecessary packages.
\nCan’t we do this in Fedora Core or any RPM-based Linux distribution? The answer is yes.
\nFirst off, you have to install ‘
rpmorphan<\/a>‘. rpmorphan has the ‘keep’ file which does the same role with the ‘world’ file. It’s located at \/var\/lib\/rpmorphan\/keep<\/tt>, which should be empty initially.
\nLet’s try to find what packages are unnecessary:<\/p>\n

\n
$ rpmorphan -all<\/pre>\n<\/blockquote>\n

Unfortunately, you will see so many essential packages that you want to keep. It’s just because you didn’t add them to the ‘keep’ file yet. For example, you can add ‘gnome-terminal’ to the keep file like the following:<\/p>\n

\n
$ rpmorphan -add-keep gnome-terminal<\/pre>\n<\/blockquote>\n

Once you finished adding all the packages that you want to keep to the keep file, now you are ready to run the following shell script file (rpmdepclean<\/tt>).<\/p>\n

\n
#!\/bin\/sh\n# rpmdepclean\nwhile true; do\n    ORPHANS1=\"`rpmorphan --all | xargs echo`\"\n    if [ -n \"$ORPHANS1\" ]; then\n        echo -n \"$ORPHANS1 \"\n        yum -q -y remove $ORPHANS1 > \/dev\/null 2>&1 || exit 1\n    fi\n    ORPHANS2=\"`rpmorphan --guess-all | xargs echo`\"\n    if [ -n \"$ORPHANS2\" ]; then\n        echo -n \"$ORPHANS2 \"\n        yum -q -y remove $ORPHANS2 > \/dev\/null 2>&1 || exit 1\n    fi\n    if [ -z \"$ORPHANS1\" ] && [ -z \"$ORPHANS2\" ]; then\n        echo\n        exit 0\n    fi\ndone<\/pre>\n<\/blockquote>\n

Please double-check you added required packages to the keep file. Otherwise, things can go screwed up. You have been warned.<\/em> If you are in doubt, you can always run yum remove<\/tt> manually, which is safer.<\/p>\n","protected":false},"excerpt":{"rendered":"

I spent a couple of sleepless nights to switch from Gentoo Linux to Fedora Core, since I became a Red Hat employee. Although Fedora Core is really a nice Linux distribution, I still miss the concept of ‘world’ in Gentoo. When a user installs a Gentoo package, the name of the installed package is appended… Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"yoast_head":"rpmdepclean - Uninstalling unnecessary RPMs — T's message of the day<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"rpmdepclean - Uninstalling unnecessary RPMs — T's message of the day\" \/>\n<meta property=\"og:description\" content=\"I spent a couple of sleepless nights to switch from Gentoo Linux to Fedora Core, since I became a Red Hat employee. Although Fedora Core is really a nice Linux distribution, I still miss the concept of ‘world’ in Gentoo. When a user installs a Gentoo package, the name of the installed package is appended... Continue reading →\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/\" \/>\n<meta property=\"og:site_name\" content=\"T's message of the day\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/trustin\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/trustin\" \/>\n<meta property=\"article:published_time\" content=\"2007-10-26T11:43:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-27T16:46:23+00:00\" \/>\n<meta name=\"author\" content=\"Trustin Lee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/www.twitter.com\/trustin\" \/>\n<meta name=\"twitter:site\" content=\"@trustin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Trustin Lee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/\"},\"author\":{\"name\":\"Trustin Lee\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"headline\":\"rpmdepclean – Uninstalling unnecessary RPMs\",\"datePublished\":\"2007-10-26T11:43:00+00:00\",\"dateModified\":\"2022-12-27T16:46:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/\"},\"wordCount\":334,\"publisher\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/\",\"name\":\"rpmdepclean - Uninstalling unnecessary RPMs — T's message of the day\",\"isPartOf\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#website\"},\"datePublished\":\"2007-10-26T11:43:00+00:00\",\"dateModified\":\"2022-12-27T16:46:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vault.motd.kr\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"rpmdepclean – Uninstalling unnecessary RPMs\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#website\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/\",\"name\":\"T's message of the day\",\"description\":\"the best is yet to come\",\"publisher\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vault.motd.kr\/wordpress\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\",\"name\":\"Trustin Lee\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png\",\"contentUrl\":\"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png\",\"width\":966,\"height\":966,\"caption\":\"Trustin Lee\"},\"logo\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/t.motd.kr\/\",\"https:\/\/www.facebook.com\/trustin\",\"https:\/\/www.instagram.com\/trustinlee\/\",\"https:\/\/www.linkedin.com\/in\/trustin\",\"https:\/\/twitter.com\/https:\/\/www.twitter.com\/trustin\",\"https:\/\/www.youtube.com\/@trustinlee\"]}]}<\/script>","yoast_head_json":{"title":"rpmdepclean - Uninstalling unnecessary RPMs — T's message of the day","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/","og_locale":"en_US","og_type":"article","og_title":"rpmdepclean - Uninstalling unnecessary RPMs — T's message of the day","og_description":"I spent a couple of sleepless nights to switch from Gentoo Linux to Fedora Core, since I became a Red Hat employee. Although Fedora Core is really a nice Linux distribution, I still miss the concept of ‘world’ in Gentoo. When a user installs a Gentoo package, the name of the installed package is appended... Continue reading →","og_url":"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/","og_site_name":"T's message of the day","article_publisher":"https:\/\/www.facebook.com\/trustin","article_author":"https:\/\/www.facebook.com\/trustin","article_published_time":"2007-10-26T11:43:00+00:00","article_modified_time":"2022-12-27T16:46:23+00:00","author":"Trustin Lee","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/www.twitter.com\/trustin","twitter_site":"@trustin","twitter_misc":{"Written by":"Trustin Lee","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/#article","isPartOf":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/"},"author":{"name":"Trustin Lee","@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"headline":"rpmdepclean – Uninstalling unnecessary RPMs","datePublished":"2007-10-26T11:43:00+00:00","dateModified":"2022-12-27T16:46:23+00:00","mainEntityOfPage":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/"},"wordCount":334,"publisher":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/","url":"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/","name":"rpmdepclean - Uninstalling unnecessary RPMs — T's message of the day","isPartOf":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#website"},"datePublished":"2007-10-26T11:43:00+00:00","dateModified":"2022-12-27T16:46:23+00:00","breadcrumb":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/1523\/rpmdepclean-uninstalling-unnecessary-rpms\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vault.motd.kr\/wordpress\/"},{"@type":"ListItem","position":2,"name":"rpmdepclean – Uninstalling unnecessary RPMs"}]},{"@type":"WebSite","@id":"https:\/\/vault.motd.kr\/wordpress\/#website","url":"https:\/\/vault.motd.kr\/wordpress\/","name":"T's message of the day","description":"the best is yet to come","publisher":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vault.motd.kr\/wordpress\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d","name":"Trustin Lee","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png","contentUrl":"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png","width":966,"height":966,"caption":"Trustin Lee"},"logo":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/t.motd.kr\/","https:\/\/www.facebook.com\/trustin","https:\/\/www.instagram.com\/trustinlee\/","https:\/\/www.linkedin.com\/in\/trustin","https:\/\/twitter.com\/https:\/\/www.twitter.com\/trustin","https:\/\/www.youtube.com\/@trustinlee"]}]}},"_links":{"self":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/1523"}],"collection":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/comments?post=1523"}],"version-history":[{"count":1,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/1523\/revisions"}],"predecessor-version":[{"id":5801,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/1523\/revisions\/5801"}],"wp:attachment":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/media?parent=1523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/categories?post=1523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/tags?post=1523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}