iFolder 3.8 on Opensuse 12.1 (or 11.4), Part 2

First things first.  I want to thank all the folks that have poured a ton into making iFolder work for me.  To all the unknown and un-named, thank you.  Now, of course there are a few of you for which I have names, and I most definitely thank you too (in no particular order): Daniel and the NoFolder crew, Ravi Kumar, Stan, Mike, Peter, Shanti, and Chris… and everyone else who commented on the previous iFolder posts.

Now to bring you up-to-speed — Thanks to Chris’ latest posts in the comment section of “iFolder 3.8 on Opensuse 12.1 (or 11.4), Part 1“, I’ve been able to repair my running iFolder server built to the specs and steps as I wrote in the post (you can read all the comments there to find out why it didn’t work right).  My iFolder system was already fully running in support of the local client on the PCs for the last year or more, but now I have working webaccess too!  Woo-hoo!  And I wanted to take Chris’ comments and turn it into a step-by-step repair guide, so nobody has to destroy a running system (if you already have one).

So to repeat/summarize/clarify, this is to take a previously-built iFolder system (again, as built in Part 1), on a 64-bit Opensuse server, and update it to get a working file upload/download functionality.  Basically, we need to do surgery to get the new/current mono out, and replace it with the old mono, without killing the patient.  ;)   As always, no promises;  as your result may be different.  And for pete’s sake get a backup or snapshot before doing these steps!  Now, on to the nitty-gritty…

Stop apache:

rcapache2 stop

To find out what mono items I had installed:

zypper se -i mono-*

I think zypper can be dangerous to do the removal, unless you are extremely careful; as it is inclined to remove other stuff too, if you’re not watching closely.  In fact, just to prove it, here’s what it wants to do if you start to remove a few of the RPMs (note the unnecessary removals of the iFolder RPMs):

The following packages are going to be REMOVED:
apache2-mod_mono ifolder3-enterprise log4net mono-core mono-data mono-data-sqlite mono-extras mono-mvc mono-wcf mono-web mono-winforms
novell-ifolder-enterprise-plugins xsp

So, I prefer to use the good ol’ rpm for this removal, and tell it that it needs to ignore the dependencies on a few things:

rpm -e --nodeps apache2-mod_mono mono-core mono-data mono-data-sqlite mono-extras mono-mvc mono-wcf mono-web mono-winforms xsp

Now on to installing the lower-version mono files.  These few can be installed in this order, separately:

rpm -Uvh http://download.opensuse.org/repositories/home:/shantikulkarni:/ifolder/openSUSE_12.1/x86_64/mono-core-2.6.7-4.1.x86_64.rpm
rpm -Uvh http://download.opensuse.org/repositories/home:/shantikulkarni:/ifolder/openSUSE_12.1/x86_64/mono-data-2.6.7-4.1.x86_64.rpm
rpm -Uvh http://download.opensuse.org/repositories/home:/shantikulkarni:/ifolder/openSUSE_12.1/x86_64/mono-data-sqlite-2.6.7-4.1.x86_64.rpm

These should be installed together to cover all the dependencies (note that they are all on one command):

rpm -Uvh http://download.opensuse.org/repositories/home:/shantikulkarni:/ifolder/openSUSE_12.1/x86_64/mono-wcf-2.6.7-4.1.x86_64.rpm http://download.opensuse.org/repositories/home:/shantikulkarni:/ifolder/openSUSE_12.1/x86_64/mono-winforms-2.6.7-4.1.x86_64.rpm http://download.opensuse.org/repositories/home:/shantikulkarni:/ifolder/openSUSE_12.1/x86_64/mono-extras-2.6.7-4.1.x86_64.rpm http://download.opensuse.org/repositories/home:/shantikulkarni:/ifolder/openSUSE_12.1/x86_64/mono-web-2.6.7-4.1.x86_64.rpm

Then back to separate installs (just for clarity in the blog format, really; they could all be done at once):

rpm -Uvh http://download.opensuse.org/repositories/home:/shantikulkarni:/ifolder/openSUSE_12.1/noarch/xsp-2.6.5-38.1.noarch.rpm
rpm -Uvh http://download.opensuse.org/repositories/home:/shantikulkarni:/ifolder/openSUSE_12.1/x86_64/apache2-mod_mono-2.6.3-4.1.x86_64.rpm

(NOTE:  I’ve saved all these RPMs myself for future reference, in case these disappear someday too…  If it happens, let me know…)

The re-start apache:

rcapache2 start

And that should be it! If all went well, all your data and users and such are exactly as you left them.  At least it was for me.  Obviously, you’d have to get different RPMs for 32-bit, and I haven’t yet tested this on Opensuse 12.2, but there’s always another day…

Next I’ll create a fresh new guide to replace the “Part 1″ post, but I don’t want to take that down due to historical significance.  So expect a “Part 3″ coming soon…  And thanks again…

8-)

 

 

 

How to in-place upgrade from Opensuse 12.1 to 12.2

Following along in my line of “Readers Digest” versions of the official Opensuse upgrades procedures, (here are a couple of my past ones: 11.1, 11.2, 11.4, 12.1) here’s the latest for upgrading in-place from 12.1 to 12.2:

zypper modifyrepo --all --disable
zypper addrepo --name "openSUSE-12.2 OSS" http://download.opensuse.org/distribution/12.2/repo/oss/ repo-12.2-oss
zypper addrepo --name "openSUSE-12.2 Non-OSS" http://download.opensuse.org/distribution/12.2/repo/non-oss/ repo-12.2-non-oss
zypper addrepo --refresh --name "openSUSE-12.2 Updates" http://download.opensuse.org/update/12.2/ repo-12.2-update
zypper ref
zypper dup --download "in-advance"

I like to use the “in-advance” setting so I can be sure all the packages are downloaded before the upgrade begins.  You just never know when there might be a power outage…

Of course, if you were using alternative repos, you might want to add those back too.  For instance, if you had the google-chrome repo, you’d enter this command to re-enable it:

zypper mr -e google-chrome

…you can find the rest of your disabled repos (from the first step above) with this command:

zypper sl

Afterward, you might want to remove your disabled 12.1-based repos, since you no longer need them. So based on the list from the command above, you can remove them in one command.  Here’s the command I used to remove all my 12.1 repos on a machine that was upgraded in-place like this in the past:

zypper rr zypper rr repo-12.1-non-oss repo-12.1-oss repo-12.1-update

…and here’s the command I used on a machine that had OpenSUSE 12.1 installed fresh:

zypper rr Updates-for-openSUSE-12.1-12.1-1.4 openSUSE-12.1-12.1-1.4 repo-debug repo-debug-update repo-non-oss repo-source

…of course your repos may be different so make sure to check the list and remove only the old one that you don’t want.

And that’s it; enjoy your upgraded machine!

:)

 

 

OpenSUSE 12.2, out now…

By now, you’ve figured out that I’m an OpenSUSE fan.

I’ve been kicking the tires on the newest release, 12.2, as a desktop OS and server OS. As a desktop, the new Gnome environment takes a bit of getting used to, but boy is it beautiful.

Honestly, I don’t care as much about the Desktop though, as much as I do about using the distro as a Server platform. And so far, I’ve been using it as a Samba server, a LAMP platform, and a mail platform. So far, in a few days, it’s been rock-solid….

…I wonder if I’ll be able to get iFolder to work… ;)

I’ll keep you posted!
8-)

How to in-place upgrade from Opensuse 11.4 to 12.1

Following along in my line of “Readers Digest” versions of the official Opensuse upgrades procedures, (here are a couple of my past ones: 11.1, 11.2, 11.4) here’s the latest for upgrading in-place from 11.4 to 12.1:

zypper modifyrepo --all --disable
zypper addrepo --name "openSUSE-12.1 OSS" http://download.opensuse.org/distribution/12.1/repo/oss/ repo-12.1-oss
zypper addrepo --name "openSUSE-12.1 Non-OSS" http://download.opensuse.org/distribution/12.1/repo/non-oss/ repo-12.1-non-oss
zypper addrepo --refresh --name "openSUSE-12.1 Updates" http://download.opensuse.org/update/12.1/ repo-12.1-update
zypper ref
zypper dup --download "in-advance"

I like to use the “in-advance” setting so I can be sure all the packages are downloaded before the upgrade begins.  You just never know when there might be a power outage…

Of course, if you were using alternative repos, you might want to add those back too.  For instance, if you had the google-chrome repo, you’d enter this command to re-enable it:

zypper mr -e google-chrome

…you can find the rest of your disabled repos (from the first step above) with this command:

zypper sl

You might want to remove your disabled 11.4-based repos, since you no longer need them. So based on the list from the command above, you can remove them in one command.  Here’s the command I used to remove all my 11.4 repos (your repos may be different!):

zypper rr Updates-for-openSUSE-11.4-11.4-0 openSUSE-11.4-11.4-0 repo-debug repo-debug-update repo-non-oss repo-source

Enjoy your upgraded machine!

:)

 

 

How to drop your IP address into a share…

I have an Opensuse 12.1 workstation that I use as a script “toolbox”,  out in the regular cubicle space where I work.  Because it sits smack-dab in the middle of a DHCP-based environment — and the corporate policy is to block all out-going SMTP/email — I can’t just email myself the IP Address like I might in other locations.  However, I do need to know when it reboots (power outages, etc.) and potentially grabs a new IP address.

In this case, the one thing that I *do* have access to is a Windows server share (this is a corporation, after all), so why not drop the IP address there…?  To do this, I’ve written a quick little script to mount the share at boot, and dump the address to a text file on the share….

…But, I need to take an aside here.

While I would normally just add a scripted call to the “/etc/rc2.d/after.local“, something about systemd and the latest Opensuse 12.1 has caused this to stop working correctly.  The good news is that jdmcdaniel3 has put together some quick steps to fix that for you, and you can find it all here on the Opensuse forum.  For the rest of this post, I’ll assume you’ve followed his steps and fixed it on 12.1, or you are using an earlier version where the after.local just works.

First, create the script that will run at boot (after a delay), mount the share, and plop in a file with the address:

vi /home/jpavlov/IpAddress.bash

#!/bin/bash
# Better wait for network...
sleep 60
# What time is it!
RightNow=`date +%Y%m%d%H%M`
# What file to write results?
OutFile="$HOSTNAME-IpAddress.wri"
# Check the status of the mount first...
MountResult=`mount|grep "cifs"`
if [ "XX$MountResult" == "XX" ]; then
  mkdir /media/cifs
  # Mount the corporate share, mine is DFS-based...  set it to your path
  mount -t cifs -o username=YourDomain/YourUsername,password=YourPassword //YourDomain/DfsParent/DfsPath1/DfsPath2/ /media/cifs
fi
# Switch to my work-group user sub-folder, again, set to taste and escape spaces
cd /media/cifs/User\ Folders/User\ -\ Jeremy/linuxtoolbox/
# Finally, what we are waiting for
echo "Results from $0 on $RightNow" > $OutFile
/sbin/ifconfig eth0|grep "inet addr"|sed s/"inet addr:"//g|awk '{ print $1 }' >> $OutFile
# And I may as well drop an info message in case it doesn't work
echo "$RightNow ifconfig export sccript done!" >> /var/log/messages

…And protect that file (and the password) from prying eyes with:

chmod 700 /home/jpavlov/IpAddress.bash

Now, we need to add it to the after.local so it will launch at boot:

echo "/home/jpavlov/IpAddress.bash" >> /etc/rc.d/after.local

…And that’s about it.  After a reboot, you should find something like HOSTNAME-IpAddress.wri in your folder, with the IP address from your workstation at last boot.  Of course, you probably won’t do this is you have other folks who have root access to this machine, or they’d see your password in the script.  Or you could create a drop-box type share that permits the deposit of the file, etc…

Now go play!
;)

 

The Future of iFolder and noFolder

There’s just nothing like iFolder.  And soon (if not already), there may not even be iFolder.

Make sure to stop by the noFolder.com site, read Dan’s plea, and vote in his “What is iFolder worth to you?” poll.

You see, the challenge with iFolder is that it isn’t trying to *sell* you something on the back-end.  It doesn’t have an *angle*.  It isn’t trying to *hook* you.  As a result, there’s no business in it as a commodity.  It’s just an awesome, unassuming service that everyone would love; if only they knew about it.

I’m not sure what will become of iFolder down the road, but I’ll still be using the last functioning version for as long as I can..

 

The while-read loop controversy…

For about as long as I’ve been able to spell “bash”, I’ve seen the debates on the ‘Net about the proper way to use the shell to loop through a text file line-by-line (rather than item-by-item).

Of the small handful of common methods, it often comes down to this:

Using Cat
With this method, you call cat to pipe the contents of the file into the while loop.

cat $inputFile | while read loopLine
do
  (some stuff)
done

Using Redirection
With this method, you are redirecting the file into the loop, as indicated by the redirection arrow to the done statement in last line.

while read loopLine
do
  (some stuff)
done < $inputFile

So Which Way?
Once you talk the purists down off the ledge about you not using the IFS variable, and they get over the fact that you aren’t awk in the first place, you can move on to the discussion regarding which while read approach you’ll use; since most people do it that way anyway, and it’s easier to understand.  There.  I said it.

Between the two methods I describe above, it’s often said that the cat method is “wasteful”, but easier to understand for the person who comes after you. This is apparently because you see right away — as you read through the code in order — the thing that is getting passed into the loop, rather than having wonder or look for it.

Conversely, the redirected method is much more efficient (since you aren’t executing cat), but someone might not easily understand how it’s happening since they have to scroll down to see the input file , or may not understand what is being looped.

Both points are kinda’ true.  But when it comes down to it, the redirected method is just not that hard to understand, and I almost always use  it…

Sometimes, Joel…
…except in on situation, which is why I write this post; and this is almost always never mentioned in the argue-posts I read on this:  What if you need to manipulate the content *before* is gets parsed by the while read loop?  For instance, backslashes in the line, newlines in the wrong place, etc., read in from a group of files.

Take this example; I have a few files with a path in one of the fields that is to be parsed, like this:

servername volumename folder1\folder2

…and I want to read in the contents of all the few files into the one loop with an ls and a wildcard.

Using the standard redirection method in this case, the backslash is interpreted as an “escape”, and is parsed and dropped.  Since it’s a filesystem path, I obviously need that backslash; so the way I solved this situation was to use cat, and for each time I encountered the backslash, pass it to sed to add a second backslash as an escape before it gets parsed by the shell while read loop.

Here’s how I did that:

for inputfile in `ls $fewFiles`
do
  cat $inputfile | sed -e s/'\\'/'\\\\'/g | while read loopLine
  do
    # Then I grab the foldername from the short parent path
    item=`echo $line |awk -F '\' '{ print $2 }'`
    (some stuff)
  done
done

Of course, you notice that the backslash even has to be escaped in the sed command, as with the double-backslash that I use to replace it…

I know, I know what you’re thinking…  Just use Perl…
;)

While I’m at it… (Other Opensuse/Postfix Clean-up Items)

Following up my last post, “X11Forwarding Fails on Opensuse 12.1 with IPv6 Disabled“, there are a couple postfix items that seem to need to be cleaned up on all my servers.

IPv4-Only

If you get this error:

Apr 10 18:35:53 tools postfix/sendmail[23696]: fatal: parameter inet_interfaces: no local interface found for ::1

It’s because it’s searching for the IPv6 interface to run on.  Again, this is only because I like to disable IPv6 (as explained in the post referenced above).  As a result, you need to stop Postfix from trying to run on “ALL” protocols, and specify good ol’ IPv4.  Just vi /etc/postfix/main.cf and change inet_protocols = all to inet_protocols = ipv4 and rcpostfix restart.

Permissions Goofiness

Not sure why, but the permissions are goofed up on all my Opensuse 12.1 servers.  If you get these errors:

Apr 10 18:39:46 tools postfix/postfix-script[23808]: warning: not owned by group maildrop: /usr/sbin/postqueue
Apr 10 18:39:46 tools postfix/postfix-script[23809]: warning: not owned by group maildrop: /usr/sbin/postdrop

This just seems to have been buggy out of the box, or perhaps I did something wrong on all my installations….  Not a big deal for me at least (though I’ve read some others have had some struggles), this was an easy fix; I just ran /usr/sbin/postfix set-permissions and it cleaned it all up.  Another quick restart and I’m in business…

I hope that helps!

8)

X11Forwarding Fails on Opensuse 12.1 with IPv6 Disabled

I’m one of those people that still disables IPv6 on all my Linux boxes. And, I guess I’m being punished for it, since if you disable IPv6 on Opensuse, then X11Forwarding will no longer function in its default form.

The good news is that it’s an easy fix.  All you have to do is to force sshd to listen purely on IPV4.  So, just do the following:

vi /etc/ssh/sshd_config

(or gedit /etc/ssh/sshd_config, or kedit /etc/ssh/sshd_config)

…and change this block from:

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

…to…

Port 22
AddressFamily inet
ListenAddress 0.0.0.0
#ListenAddress ::

With this change, the inet statement causes it to use IPv4 only, the 0.0.0.0 means listen on any valid IPv4 address (change to suit), and the Port command specifies the IPv4 port, usually changed to taste.

Enjoy!

iFolder 3.8 on Opensuse 12.1 (or 11.4), Part 1

It looks like some people are working very hard out there to try and preserve iFolder for future versions of Opensuse.  To those people (the NoFolder crew, Ravi Kumar, etc.), I’m indebted; I simply would be at a loss without iFolder.  Yes, I use DropBox, and a couple other things, but there’s just nothing like iFolder for complete control over the server and the sync’d content.

But the sad fact is, it has suffered a bit of neglect as of late.  Okay, a LOT of neglect.  And you’re probably here because you have an Opensuse 12.1 (or 11.4) server, and you tried to install iFolder 3.8.x on it, and had some trouble.

Notes: I strongly recommend you see my old post about setting up iFolder 3.8 on Opensuse 11.1 for background and additional detail, as this post will be brief and to-the-point without much supporting detail.  All the work in this doc was performed on the x86_64 version of Opensuse, and was tested on both 12.1 and 11.4.

First, build up an Opensuse 12.1 box.  I tend to build them with “Minimum X Window”, “IPv6 Disabled”, “SSH enabled”, and a dedicated partition for iFolder database and content (like /ifolder); other then that, fairly typical.  And I never install patches during installation.  So updates are the first thing we do after completion:

zypper ref; zypper up

So first, decide on a single name that you will use for the server for the host configuration, certificate creation, Apache2 configuration, and iFolder service configuration; it is imperative that you use one name!  For the following examples, I use “ifolder.yourLinuxGuy.com“.  Let’s configure that critical name and static address:

yast lan
vi /etc/hosts

Now, let’s install all the supporting software we need (of course findutils isn’t needed for iFolder, but I can’t live without it; but mono-wcf is the one most people seem to miss):

zypper in apache2-worker findutils-locate apache2-mod_mono log4net mono-core mono-data mono-data-sqlite mono-web mono-winforms mono-wcf xsp libflaim

Next we configure apache2 and related components, starting by generating a certificate (obviously, replace the values to suit):

/usr/bin/gensslcert -c US -s MI -l "City" -o "Your Linux Guy" -e email@yourLinuxGuy.com -d -n ifolder.YourLinuxGuy.com

Add SSL to the APACHE_SERVER_FLAGS section:

vi /etc/sysconfig/apache2

Un-comment and change “ServerName” to match the name you put in /etc/hosts, and optionally set “ServerAdmin” to your email address:

cd /etc/apache2/vhosts.d/; cp vhost-ssl.template vhost-ssl.conf; vi vhost-ssl.conf

Now to open ports 80 and 443, set FW_SERVICES_EXT_TCP="80 443":

vi /etc/sysconfig/SuSEfirewall2

Next, we install the stars of the show, the iFolder packages:

rpm -Uvh http://download.opensuse.org/repositories/home:/rkumar1:/branches:/network:/ifolder:/server_stable/openSUSE_11.4/x86_64/ifolder3-enterprise-3.8.4.0.11091.1-6.2.x86_64.rpm
rpm -Uvh http://download.opensuse.org/repositories/home:/rkumar1:/branches:/network:/ifolder:/server_stable/openSUSE_11.4/x86_64/novell-ifolder-enterprise-plugins-3.8.4.10192.1-6.3.x86_64.rpm

Update: Reader Mike informs me that these links above are no longer in service. In the interim, here’s an alternate download location:

rpm -Uvh http://yourlinuxguy.com/wp-content/uploads/2012/03/ifolder3-enterprise-3.8.4.0.11091.1-6.2.x86_64.rpm
rpm -Uvh http://yourlinuxguy.com/wp-content/uploads/2012/03/novell-ifolder-enterprise-plugins-3.8.4.10192.1-6.3.x86_64.rpm

And run all 3 configuration scripts (remember, see my older post for reference and detail, and please note I use an alternative simias datastore location of /ifolder):

simias-server-setup
ifolder-admin-setup
ifolder-web-setup

A note about the next step: If you just stopped here, you’d be able to pull up the /admin page, but not log in; you’d get a red message saying that your password doesn’t match or whatever.  I see this error quite commonly out there…  So let’s change the FlaimWrapper softlink pointer to an existing location:

rm /usr/lib64/simias/web/bin/FlaimWrapper.so
ln -s /usr/lib64/libFlaimWrapper.so.0 /usr/lib64/simias/web/bin/FlaimWrapper.so

Let’s make sure Apache2 comes up at each boot:

chkconfig apache2 on

And lastly, restart stuff:

rcSuSEfirewall2 restart;rcapache2 stop; rcapache2 start

And that should do it!  Log in at /admin, configure some users, etc., etc., etc.  I’m guessing you are here because you know already how to *use* iFolder, just got stuck installing and configuring it, so I’ll not go into any usage detail.

By the way, the NoFolder.com page has some good troubleshooting tips, but if you follow these steps accurately, and you use the SAME hostname throughout the configuration, you should be fine.

See, it’s not that bad.  And it’s totally worth it.  Enjoy!
;)

Update, 20130324: Please see PART 2 of this post and story, after reading through the comments below to see how we arrived there….