Why df fails to show one or more file systems when run as an unprivileged user
One of my friends recently reached out with a fun problem. His monitoring system was periodically not firing when file systems grew past the thresholds he defined. When we hopped on one of his EC2 instances to debug the issue, I noticed that we were getting a permission denied (EACCES) errno when running df as their monitoring user: When we ran the same command as trusty UID 0, everything worked as expected: A quick check with strace verified this as well: If you aren't familiar with statfs(2), it returns information about a mounted file system in a statfs structure. Here is a blurb from the manual page describing which information is returned: I thought that df was setuid root like the mount uility, so when I initially saw the permission denied error I thought it was something unrelated to permissions…
$ read more →Upgrading an RPM to a specific version with yum
This past week I got to spend some time upgrading my CI/CD systems. The Gitlab upgrade process requires stepping to a specific version when you upgrade major versions, which can be a problem if the latest version isn't supported by the upgrade scripts . In these types of situations, you can tell yum to upgrade to a specific version. To list the versions of a package that are available, you can use the search commands "--showduplicates" option: Once you eye the version you want, you can pass it to yum install: This can also be useful if you want to stick to a minor version vs…
$ read more →Improving my Linux diff experience with icdiff
I recently came across icdiff. This little gem allows you to see the difference between two files, but what makes it special is its ability to highlight the differences (sdiff, which was my go to diff tool, doesn't have this feature): In the example above, icdiff highlighted the keyword "something" on line 11 in column 2. I really dig the highlighting, and its ability to print X lines before and after the match. You can also define the output column size which is helpful when you are working on the command line.
$ read more →TRIM support is enabled by default in Fedora 32
As a long time Fedora user, I like to keep up with the planning discussions that go into each release. These discussions are super useful for understanding what is coming to Redhat Enterprise Linux and CentOS. One feature I've been keeping my eye on is the FSTRIM enabled by default feature. Using TRIM can free unused space on your storage arrays, and is especially important if you use thin provisioned storage devices…
$ read more →Disabling cron jobs globally on CentOS machines
As a long time CentOS user, I've always winced when I took ownership of new systems with e-mail notifications enabled. Whether this was through setting MAILTO to a distribution list, or using the default and sending it to the user who created the job. Having cron send mail has woken me up more than once when /var/spool/* filled up. Give the awesome searching capabilites that come with solutions like Elasticsearch, Loki, and Gray log, I now turn cron mailing off on all of my systems…
$ read more →