{"id":6580,"date":"2014-04-20T13:42:24","date_gmt":"2014-04-20T13:42:24","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/sudo-usr-lib-sudo-sudoers-so-must-be-owned-by-uid-0-collection-of-common-programming-errors\/"},"modified":"2014-04-20T13:42:24","modified_gmt":"2014-04-20T13:42:24","slug":"sudo-usr-lib-sudo-sudoers-so-must-be-owned-by-uid-0-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/sudo-usr-lib-sudo-sudoers-so-must-be-owned-by-uid-0-collection-of-common-programming-errors\/","title":{"rendered":"sudo: \/usr\/lib\/sudo\/sudoers.so must be owned by uid 0-Collection of common programming errors"},"content":{"rendered":"<p>Ownership of at least one of your important system files is wrong. That&#8217;s a bad thing; if this has happened to many system files (perhaps you ran a big <code>sudo chown<\/code> command with the <code>-R<\/code> flag at some point?), it could cause a number of other system errors and instabilities. So <em>if you recently installed Ubuntu<\/em>, you might want to reinstall as Adam Heathcote suggests.<\/p>\n<p>But <strong>you do not have to reinstall to fix this problem<\/strong>. Instead, just fix the ownership on that file. If you get errors about other files after that, you can fix them too (though you might have to tell us what the error messages are, so we can tell you how to fix them also).<\/p>\n<p><code>sudo<\/code> does not work, but using <code>sudo<\/code> is one of <em>two<\/em> ways for administrators to perform actions as root on Ubuntu. The other is PolicyKit.<\/p>\n<p>Run this command, which uses PolicyKit (via <code>pkexec<\/code>) to change the ownership of <code>\/usr\/lib\/sudo\/sudoers.so<\/code> back to <code>root<\/code> (i.e., uid 0):<\/p>\n<pre><code>pkexec chown root \/usr\/lib\/sudo\/sudoers.so\n<\/code><\/pre>\n<p>Then try using <code>sudo<\/code> again. You can run something trivial like <code>sudo ls<\/code>, and see if you get an error message.<\/p>\n<p>Finally, I recommend running <code>history<\/code> to reveal all the commands you&#8217;ve run. Hopefully that will list all the commands you&#8217;ve run that have changed permissions. Assuming <code>sudo<\/code> now works, I recommend posting a new question including the output of <code>history<\/code>, to get help undoing <em>all<\/em> the file ownership and permissions changes you&#8217;ve done.<\/p>\n<h2>If <code>pkexec<\/code> doesn&#8217;t work either&#8230;<\/h2>\n<p>You tried <code>pkexec<\/code> and it didn&#8217;t work. Since neither <code>sudo<\/code> nor PolicyKit is working to allow you to perform actions as root, you&#8217;ll have to boot into recovery mode and get a root shell. To do this, hold down Shift while booting up your computer, to ensure you get a visible GRUB boot menu. Select an entry that contains the words <em>recovery mode<\/em> (generally, you should select the one closest to the top that has those words). Then you&#8217;ll get a menu where you have a number of options&#8211;select the option to drop to a root shell.<\/p>\n<p>Detailed instructions on accessing a root shell in recovery mode are here:<\/p>\n<ul>\n<li>How do I boot into a root shell?<\/li>\n<\/ul>\n<p>Once you have a root shell, run:<\/p>\n<pre><code>chown root \/usr\/lib\/sudo\/sudoers.so\n<\/code><\/pre>\n<p>If you get an error about the file or filesystem not being modifiable, then remount it readwrite:<\/p>\n<pre><code>mount -rw -o remount \/\n<\/code><\/pre>\n<p>(Source for the idea of remounting and how to do it: this mostly unrelated answer.)<\/p>\n<p>Then after running that <code>mount<\/code> command, run the above <code>chown<\/code> command again and see if it works.<\/p>\n<p>Once you&#8217;re done in recovery mode you can reboot by running:<\/p>\n<pre><code>reboot\n<\/code><\/pre>\n<p><code>sudo<\/code> should then work, or at least give some <em>other<\/em> error.<\/p>\n<p>Finally, please note that given the errors you showed, it&#8217;s likely that many files now have the wrong ownership or permissions. It would be ideal if you could figure out which files you modified in this way. For example, if you could figure out that it was all files in a couple specific folders, then it might be possible to correct the complete extent of the recent problems you&#8217;ve been having.<\/p>\n<p>Reinstalling is definitely an option, but especially if all you changed was <em>ownership<\/em> (and not permissions, which are somewhat harder to reconstruct as they vary more), it should be possible to simply set the permissions back recursively to their original owners (probably usually root) and reverse the damage entirely.<\/p>\n<p>Getting <code>sudo<\/code> working again is a first step. Hopefully the above technique will enable you to do that.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ownership of at least one of your important system files is wrong. That&#8217;s a bad thing; if this has happened to many system files (perhaps you ran a big sudo chown command with the -R flag at some point?), it could cause a number of other system errors and instabilities. So if you recently installed [&hellip;]<\/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":[],"class_list":["post-6580","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6580"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6580\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}