Saturday, March 23, 2024

There's No Place like Home

I had me another Linux adventure this last week. At work I am setting up a remote development environment. Conceptually, it's really quite interesting. You use an IDE just like you always have, but it's communicating with a session on a server somewhere else and you're actually developing on that remote machine. Interesting times we live in, for sure. 

But the remote session is on a Linux box. And you know I've written before about how I respect the whole x-nix world because it's amazing and powerful, but it's also obtuse and shrouded in hieroglyphics. Well, setting up this remote environment burned up a pile of hours that it shouldn't have because of a very tricky configuration flaw that had me tearing my hair out.

At work there are others who've treaded down this path before, so there are wikis written and setup scripts available to help us get started. But it's proving to be hell for me as I have to assemble the instructions from several wiki pages; there's no cohesive approach to this documentation.

What makes it worse is that when I run various setup scripts and try to do some of the tasks, I keep getting errors. I go back and check my rights and verify I have security access to the remote resources. I check that all the software I'm supposed to install has been set up correctly. I rebuild SSH keys and update the various hosts that need to have them. Nothing is working; it says it can't find my SSH keys and credentials or can't sign into Artifactory. It's maddening and I've spent hours on it. 

Then, finally, I stumble on yet another error that doesn't explicitly tell me what's wrong, but does give me a hint. I notice that my sessions aren't getting some of the configurations they're supposed to be, like colored prompts. I navigate manually to the .bashrc file and other setup files and they're there, but apparently not running automatically when a session starts. I check the rights on the directories and files that session startup uses, and they're all correct with necessary read and execute access. I can run the .bashrc script manually and the colored prompts show up. I log out and then back in and the issue is still there. 

So then while I'm spelunking around and trying to figure out what's going on before I go insane, I accidentally stumble on the root cause. I type the "cd ~" command to jump back to the home directory, and get a "no such file or directory" error. Ah ha! Now we're getting somewhere.

I then try "cd $HOME" and get the same error. That's it, there's a problem with the home directory definition. That has to be it, and explains why none of the scripts work, because they all depend on the $HOME system variable to be correct, and it's not. 

I check it by running "echo $HOME" and get back "home/myuser". Well, that explains it for sure! It's supposed to be "/home/myuser" with a leading slash. 

I could not find anything on the internet about this issue. The home directory is such a given in X-nix environments that only lucky idiots like me get to experience this rare situation where the home directory is broken. Of course, I can't fix it myself with the change user command because it won't work when you're logged in. I have to ask the Linux admins to fix it for me, so it's the waiting game until they get to me. 

But once that's fixed I'm sure all the setups will go more smoothly and once again I can be friends with Linux and the power it brings. If your Linux session is acting squirelly and can't find files you know exist:

  • check the file or directory security rights
  • check that the script referring to it is using the right location
  • check that your home directory is good (and this last one should not happen unless you're really lucky like me)

You want to know why people use Windows? This is why. The only other technology I've used that's as obtuse and cantankerous is Oracle. That's not a compliment!

No comments: