CentOS – Less Command Workaround

I use c-shell (tcsh) as my shell; have been from 25+ years. I know, I know, bash is supposedly better, but I’ve never had issue using c-shell and it’s what I started with. Anyway, I recently switched one on my VMs to CentOS and found that the less command insists on sourcing .cshrc. This is fine provided you don’t have any output (i.e., echo command). If you do, or have a menu selection (like I do for a certain user), then less will just use that output versus the file you want to look at. I should note, the doesn’t appear to happen in the bourne shell (or derivatives of it), nor is it a problem in other Linux distros, but I’m not switching. To workaround the issue, I create a simple less.csh script with the following:

#!/bin/tsch -f
setenv LESS_CMD 1
setenv LESS -Xe
/bin/less $argv
unsetenv LESS_CMD

I then add the following to the beginning of ~/.cshrc:

if ($?LESS_CMD) then
  #echo executing less
else
  # ... normal processing
endif

I shouldn’t have to do this because I’ve never seen this behavior in any other Linux distro, or any other *NIX OS (Solaris, AIX, HPUX, etc.) for that matter either. So it seems to be something unique to how CentOS is building less that causes it to behave differently under c-shell.

And that’s all I have to say about that.

Re: CentOS – VirtualBox Shared Folder

Yesterday I wrote about how to work around CentOS 7 in a VirtualBox environment not automaticaly mounting shared folders. While that method will work, it’s not the most correct answer. A better answer is to create a /etc/modules-load.d/vboxsf.conf with the following entry: vboxsf. After reboot, you should then see a similar type message in from dmesg:

automount vbsvcAutoMountWorker: Shared folder 'Documents' was mounted to '/media/sf_Documents'

I still think this is unnecessary, but is a cleaner method than hacking /etc/rc.local.

Just goes to show that there’s more than one way to do everything in software; especially Linux.

And that’s all I have to say about that.

CentOS – VirtualBox Shared Folder

I’m not sure if this is just a thing with CentOS or what, but I experienced some difficultly in getting shared folders to mount inside the a CentOS VirtualBox image. What I found was that the vboxsf kernel module was not loaded as indicated by the following message in dmesg:

automount Error: vbsvcAutoMountWorker: Could not mount shared folder 'Documents' to '/media/sf_Documents': No such device (19)

The solution is to do:

modprobe vboxsf

Followed up with:

mount.vboxsf -o rw,uid<UID>,<GID>dmode=775,fmode=664 <SF_NAME> <MOUNT_POINT>

Where:

  • UID: default file owner user id to UID
  • GID: default directory owner group id to GID
  • SF_NAME: name of shared folder
  • MOUNT_POINT: where to mount the shared folder

To get this to happen at boot, add the following to /etc/rc.d/rc.local:

modprobe vboxsf
mount.vboxsf -o rw,uid<UID>,<GID>dmode=755,fmode=644 <SF_NAME> <MOUNT_POINT>

On CentOS, the permissions on /etc/rc.d/rc.local are set to 0644 (-rw-r--r--) by default so be sure to change permissions to 0744 (-rwxr--r--) so that it’s executed on boot.

I’ve been using Linux in a VirtualBox environment for a number of years, and this is the first distro I had to jump through so many hoops to get working properly. I won’t even get into the BS of having to deal with a proxy and getting YUM & RPM to operate properly in that paradigm; because why should those two programs not use the system level proxy settings, right? Wrong; they have a separate configuration for them to understand proxy settings.

And that’s all I have to say about that.

Political Parties

The Democrats and Republicans can only agree on one thing: that they both need to exist. Other than that, they will disagree about everything just for the sake of disagreeing with the other side. They are certainly not in the least bit concerned about the people they claim the represent; they represent their own self-interests aimed at gaining power and telling people how to live.

They are without a doubt the two largest hate groups in the country, with the KKK and NAACP following a distant second. A little over the top, you think? Riddle me this then. Why is it then that anyone who is not a white male is labeled (for lack of a better term) a minority? Both parties are guilty of needing to “get the <insert derogatory label here> vote.”

They make laws that allow them to get away with not paying taxes on the billions of dollars they raise to support their campaigns through the use of PACS, Super PACS and the uninformed individual that buys into their rhetoric. Imagine if they put that money towards something good; like schools, getting the homeless off the streets, etc. Imagine if the people, instead of throwing away money towards these political groups, that they throw at something worth while; like the schools, getting the homeless off the streets, helping out our wounded veterans, etc.

And as for the presidential election, I’m of the opinion that the President should not be affiliated with any party, for the President represents the country as a whole, not a select group of greedy, hypocritical elitists. This won’t happen anytime soon since it would require a candidate with an ounce of character to break ranks from the status quo; instead we continue to have elitists pandering to a larger group of elitists. Care to guess the last President who wasn’t associated or beholden to a political party?

And that’s all I have to say about that.

Cache Busting CSS

If you maintain your own site you’ve probably run into overzealous caching of CSS by either the web server, ISPs, the browser or some combination of all of all three. Here’s a quick-n-dirty way to bust the caching of CSS without compromising performance:

<?php echo '<link rel="stylesheet" type="text/css" href="/css/index.css?<?php echo(time());?>"/>

The above results in:

<link rel="stylesheet" type="text/css" href="/css/index.css?1492810248" />

The highlighted portion tricks whatever’s caching the .css file into thinking that it has been updated and forces download of a new one to the client. Using the current time (seconds since the Unix Epoch [January 1 1970 00:00:00 GMT]) keeps you from having to generate your own versioning scheme. You can do the same for .js files as well.

And that’s all I have to say about that.