Showing posts with label lucid lynx. Show all posts
Showing posts with label lucid lynx. Show all posts

Saturday, October 2, 2010

Ubuntu 10.04 and Windows XP Dual-Boot: GRUB2 Woes

I was installing Windows XP SP3 and Ubuntu.  I encountered some error messages early in the process.  This post describes the steps I took in an attempt to resolve those problems.

First, I got this error:
Setup did not find any hard disk drives installed in your computer.
In my search for a solution, I found a thread offering a number of suggestions.  The one that worked for me was to go into the BIOS (hit Del at startup) and make sure the SATA controller was set to ATA, not AHCI.  Mine had started out as ATA, but a notice had popped up when I was first booting it, offering to change it to the AHCI, and I had accepted.  After I fixed this, the next bootup problem was this message:
Windows could not start because the following file is missing or corrupt:
\system32\hal.dll
Please re-install a copy of the above file.
My search on that led to a page offering a number of suggestions.  I started with just rebooting.  That didn't fix it.  suggesting that I go into the BIOS and switch the order in which the BIOS would try to boot my hard drives.  This led to a new message:
error: no such device: [UUID number]
grub rescue>
This apparently happened because I had previously installed Ubuntu on that hard drive.  For this one, I took the advice to boot from the WinXP installation CD, choose R to repair an existing installation, choose the existing installation (no administrator password), and type this sequence of commands:
D:\WINDOWS> C:
C:\> CD \
C:\> FIXBOOT C:
C:\> FIXMBR
C:\> BOOTCFG /rebuild
The last one led to an offer to add D:\WINDOWS to the boot list.  I took that offer.  But then it asked "Enter Load Identifier" and "Enter OS Load Options."  I didn't know what to add, so I just hit Enter for each.  This led to a new error message:
Error: Failed to add the selected boot entry to the boot list.
I guessed that the system was seeing the Windows installation on drive D because I had reversed the boot order in the BIOS.  I did think I had cabled them correctly, with the Windows drive going to SATA0 (i.e., the first SATA connector) on the motherboard.  I looked into Load Identifier and found a Microsoft page with information on that and other parts of this situation.  It told me to type the name of my operating system:  Microsoft Windows XP Professional, though apparently anything would do.  For OS Load Options, it said, type /fastdetect.  Unfortunately, this was not satisfactory.  I got the "failed" error again.

The responses to this seemed to lean in the direction of editing the boot.ini file.  A thread on that gave me the idea of just copying my boot.ini file from another computer.  A Microsoft page gave information on editing it if I was already in WinXP, which I wasn't.  A webpage devoted to boot.ini said it should be possible to just delete the boot.ini file in order to boot the system.  The webpage also gave some sample boot.ini files.  I typed "help" at the prompt and got a list of options.  There didn't seem to be an editor in the Repair Console.  I typed "dir" to verify that boot.ini was there, and then typed "type boot.ini" to see what was in it.  It didn't look very complicated.  What's more, it looked like my XP Pro entry was already there, which could explain why my BOOTCFG command didn't work.  I pressed the up arrow to retrieve my BOOTCFG command and hit Enter to run that again, just in case.  It failed again.

I typed "exit" and shut down the computer and swapped cables so that maybe this drive would show up as C rather than D.  That merely resurrected the "no such device" GRUB error.  I decided to explore that one for a while.  A search led to some commands that I could have entered, but then I saw a suggestion that maybe I could fix it by just installing Ubuntu, which I had planned to do anyway, and let it sort itself out.  So I went ahead with that, following the Ubuntu installation approach I had worked out previously.  But at this point I only did the initial installation from the CD, and then rebooted to see what the Windows situation was now.  Sadly, I still had the "no such device" error.

I guessed that the problem was that I was using two drives.  One of them had perfectly reasonable Windows and Ubuntu installations on it.  The other had leftovers from some previous Ubuntu installation.  I didn't know for sure, but on that hunch I unplugged the second drive and rebooted.  But no, that gave me the "no such device" error either way, no matter which disk I plugged in.  I plugged in both drives, rebooted with the live CD, and ran System > Administration > GParted to take a look.  Interestingly, it showed that a partition on the second drive was marked as a boot drive, when it should not have been.  I changed that.  It didn't make a difference.

Ultimately, I plugged in a USB drive while booted with the Ubuntu live CD, copied over the data files, wiped both of the drives in the machine, and reinstalled WinXP and Ubuntu, in that order.  That solved the problem.

Thursday, September 30, 2010

Connecting Network Attached Storage (NAS) to a WinXP Guest in VMware: FAIL

I had two desktop computers running Ubuntu 10.04.  On one of them, I was running VMware Workstation 7.1, with Windows XP SP3 as a guest operating system in a virtual machine (VM).  I had just figured out how to network these two computers using Samba shares within a home network, where the two computers were connected via ethernet cables to a shared router.

Now there was a new question.  Could I add a Synology DS109 network-attached storage (NAS) device (essentially an external hard drive enclosure designed for network backup and file serving) to this network?  Of course I could, in the sense of running an ethernet cable from the Synology to the router; but what I was wondering was whether I could make this work despite the fact that the software for the Synology was available only for Windows and Mac, and not Linux.

It was a question, in other words, of whether I could run the Synology software in Windows XP in a guest VM.  I gave it a whirl.  I ran the Synology installation CD and went through the steps to set up the Synology Server.  This opened the Synology Assistant, a setup wizard; and after a moment, it gave me an error message:

No Synology Server was found on the local network.  Please make sure:

1.  Synology Assistant is not blocked by the firewall of your computer OS or anti-virus applications.

2.  Synology Server and your computer are both connected to the network.

3.  You have switched on the power of Synology Server.
Option 1 was the only one that seemed to explain the situation.  I decided to back up and make sure that I could see a shared folder on the other computer from within Windows.  In my first try, I set up that shared folder on an NTFS partition, and that led to a separate investigation of the difficulties of sharing an NTFS partition in Ubuntu.

That wound up taking longer than expected, so in the meantime I just focused on the link between the Synology and the computer in which I had VMware running.  I noticed that, in Ubuntu's Places > Network, it listed three items:  ANTEC (the name of this computer), Windows Network, and WINXP8 (the name of the computer running in the WinXP VM).  Plainly, Ubuntu was seeing Windows.  Was Windows seeing Ubuntu?  Or did it need to?  A first answer was that, of course, you could go into Windows Explorer > Tools > Map Network Drive and (assuming you had VM > Settings > Options tab > Shared Folders set up) you could gain access to NTFS and ext3 partitions outside of the drive C that existed inside the virtual machine.  These drives would be visible in Windows Explorer > My Network Places > Entire Network > VMware Shared Folders.

I tried running the Synology setup wizard again.  It gave me the same error as before.  I did a search and found webpages describing how to use NAS freeware to use another computer as an NAS device.  This raised two thoughts.  First, possibly I could use some software other than Synology's CD to make contact with the NAS device.  Second, perhaps I should consider using another computer myself, in lieu of the Synology unit.  I decided to go ahead with the Synology project for now; I could return or sell the device if it really wasn't what I wanted.  I probably could have assembled another computer at equal or lower cost, with far greater potential storage capacity, with more RAID options, with a more powerful processor (for e.g., checksum calculations) if needed, with what might prove to be more options in the choice of software packages and commands to manage and adjust it, and with more flexible hardware troubleshooting options (i.e., more than just fix it or replace it) in the event of malfunction.  Its drawbacks would include time and expense for software and hardware selection, learning, installation, maintenance, and troubleshooting; physical space requirements; power consumption; and noise and heat generation.

For the time being, I searched Synology's website and found a post raising the thought that perhaps a Windows connection was crucial only for the initial setup of the Synology device.  So I rebooted the computer into Windows XP instead of Ubuntu and ran the Synology setup CD from there.  This time, the wizard found the DiskStation right away.  So, really, I probably could have set the thing up using my laptop.  It seemed to be just a matter of connecting a Windows-based computer to configure the hard drive that I had inserted into the NAS unit.

Following the Quick Installation Guide, I looked for a Browse option in the Synology Assistant, but didn't see one.  Instead, in the Management tab of the Assistant, I double-clicked on the DiskStation entry, and that seemed to be the correct thing to do:  it opened a different Setup Wizard, or maybe a continuation of the same one.  The wizard said, "Please input the path of installation file."  Maybe this was where I was supposed to browse to the .pat file?  Sure enough. Browse brought up four different .pat files.  I chose the one for the 109 and opted for One-Click Setup.  It warned me that all data in the hard drive would be deleted.  I hoped it meant the hard drive that I had inserted into the NAS unit.  Lights began flashing on the unit.  It went through several steps:  Apply network settings, Format hard drive, Install DSM (DiskStation Manager) to hard drive, and Write configurations.  For my 2GB drive, the whole process took about 20 minutes.

When it was done, it said, "System has been installed successfully."  Then it just sat there.  Now what?  The other programs on the CD's Installation Menu were Data Replicator, in case I wanted to use the unit for backup rather than as a file server, and Download Redirector, for some purpose I didn't fully understand.  For lack of any better ideas, I rebooted into Ubuntu > Places > Network.  The list of places was the same as before.  I tried another search of the Synology website.  The product page for the DS109 definitely said that the unit was "designed for data storage and sharing among Windows, Mac, and Linux."  But how?

I knew I was desperate when I thought that perhaps I should consult the User's Guide.  But then -- what's this?  When I went to the downloads website, I saw that Synology Assistant was also available for Linux!  I had no idea.  I downloaded that and, while I was at it, also snagged what appeared to be a more recent DSM patch (.pat) file.  The User's Guide on the CD was for DSM 2.3, but the one online was for DSM 3.0, so I copied that too.  Apparently DSM was the firmware updater.  The included instructions were incorrect, as I eventually figured out.  All I had to do was to navigate to the folder where I had put the downloaded .tar.gz file ("cd /LOCAL/Synology") and the accompanying install.sh file, type "install.sh," designate /usr/local as the target directory, watch a bunch of error messages roll by, accept its offer to try again by sudo, copy and paste the command it offered to create a symbolic link, and then type "SynologyAssistant."

With that, Synology Assistant was up and running, and it found the DiskStation.  I double-clicked on it.  It opened a webpage in Firefox.  Having used the One-Click installation previously, I knew there was no administrator password, so I just clicked right on in.  Now I was looking at Management and Online Resources icons.  Management gave me all kinds of options.  I noticed I was in DiskStation Manager 2.3; did this mean that there was no DSM 3.0 for Linux?  On the left side, under System, I clicked on DSM Update.  Ah, of course.  This was the part where I got to Browse to the new .pat file I had downloaded.  It said, "Transferring data to the server.  Please wait."  This time, it was done in under 10 minutes.  It then confronted me with a signin screen.  I could not just click on through; it demanded that I enter something.  I tried Administrator without a password.  No go.  I tried my normal Ubuntu login.  Aha! . . . er, no.  That wasn't it either.  The hell.  I was locked out of my own NAS.  I wasn't alone.  Several other people had experienced this just within the last few days.  I suspected it was due to some quirk in newly released software.  I posted a "me too" note on it in Synology's moderated forum and waited.

But then -- reverting again, desperately, to the manual -- I noticed I was supposed to log in as "admin" with no password.  That worked, and now I was in DiskStation Manager 3.0.  I clicked on "Set up a volume and create a shared folder."  That opened Storage Manager.  I selected Storage > Create and that put me in Volume Creation Wizard.  The only option that wasn't greyed out was ISCSI LUN.  The manual didn't define that term, but Wikipedia said it was short for Internet SCSI, where SCSI is short for Small Computer System Interface.  The idea seemed to be that you were using the Internet instead of cables to create a SCSI setup.  LUN was short for "logical unit number."  An ISCSI LUN was apparently just any one of a set of drives in a SCSI array.  In other words, I was creating a logical drive.  So I went with that.

That gave me a choice of some more properties.  One was Thin Provisioning (default = yes), which was said to increase efficiency.  I was supposed to say how much of my 2TB (actually, 1829GB available, according to the dialog) I wanted to allocate to this first volume (default name:  LUN-1).  I was going to be backing up this file server to a 2TB drive, so I didn't worry about splitting the volume to a size that would match the external drive.  I thought it might be a good idea to have more than one volume, in case one went bad or needed maintenance.  The manual said that, on my unit, I could have up to ten.  I looked at my data and decided to go with three volumes of 600GB each.  (This would be changing later.)  Finally, there was an iSCSI Target Mapping option.  Again, the manual didn't explain this.  I found a website that sort of halfway did.  Eventually I just decided to go with the default, which was no, thank you.  I clicked Next > Apply and, in a few seconds, it was done.  I repeated for the other volumes -- or, I guess, LUNs, not volumes.  Then I clicked on the icons this process had created.  Each indicated that it had a 600GB capacity, but none of them actually seemed to have taken a bite out of the 1.8TB total.  Apparently that was how Thin Provisioning worked.  Then, to finish up with Storage Manager, I went to the HDD Management tab > Cache Management > Enable Write Cache.  I also ran a quick S.M.A.R.T. test.

This was all very nice, but I wasn't sure what it was actually accomplishing.  There weren't any new partitions appearing in Nautilus.  I wasn't sure if there were supposed to be.  I bailed out of Storage Manager.  I was looking again at Quick Start.  It said that now I needed to create a shared folder in the Synology.  I followed its link.  It put me into Control Panel - Shared Folder.  I clicked on Create.  In Create New Shared Folder, I set up a folder for LUNDATA, the first of my three LUNs.  It wouldn't let me select "Mount automatically on startup."  I gave both admin and guest read/write privileges for now.  I did the same with the other two LUNs.  I was confused, though:  after completing that step, I still didn't have anything to show for it.

It seemed that Chapter 7 of the User's Guide was where I wanted to be.  It told me to go to Main Menu (i.e., the down-arrow icon) > Control Panel > Win/Mac/NFS if I wanted to enable file sharing.  But that gave me an error:  "You are not authorized to use this service."  So, oops, that meant I had gotten logged out for dillydallying.  (First of many times!)  After re-login, the Quick Start reminded me that next on the list was "Create a User and assign privileges."  It had admin as the system default user already.  I selected that one and clicked edit.  Spooky thing here:  admin did have a password.  I wasn't sure why I didn't have to enter it when logging in.  I wasn't allowed to change the name of admin or disable that account.  I decided to change the password to something that I would actually know.  Admin already had full read/write privileges to my three LUNs.  The guest account was disabled.  I left it that way.  The manual (p. 66) said that each user could also have his/her/its own "home" folder.  It was something I had to enable if I wanted it.  I didn't need it, so I skipped that.

So now I went back to Win/Mac/NFS.  The User's Guide (p. 59) said that the unit supported file sharing in Linux in SMB, FTP, NFS, and WebDAV.  I unclicked the boxes so that the Synology would not offer Windows or Mac file service, which I did not need (and did not intend to provide to anyone else).  Instead, I clicked the Enable NFS box which, the manual (p. 61) said, was for Linux clients.  I figured that, in my Windows XP virtual machine, I would access the folders or LUNs on the Synology as network drives, just as if they had been ext3 drives inside the computer.

The remaining tab in this part of Control Panel had to do with Domain/Workgroup.  I didn't know if I wanted or needed to have the Synology be part of a domain, a workgroup, or both.  But then I found that the Domain/Workgroup tab was greyed out.  As I might have assumed, "workgroup" and "domain" appeared to be Microsoft-specific.  If I went back and enabled Windows file service, the Domain/Workgroup tab became ungreyed.  So that explained that:  it wasn't something I needed in Ubuntu.

In the Control Panel > Groups section of the Synology DSM, I saw that the default "users" group had read/write privileges only to the public folder, which I had disabled.  It was just me, so I didn't need a group.  So I left that all as it was.  Next, in Control Panel > Application Privileges, it appeared I could give users access to specific Synology applications (FTP, WebDAV, File Station, Audio Station, Download Station, or Surveillance Station).  Admin wasn't listed.  I assumed it didn't need to be.  I had no other users, so I skipped that part too.

Chapter 3 in the User's Guide, "Modify System Settings," told me that in Control Panel > Network, I could choose among several types of networks.  In my version of the Network dialog, those options were LAN, PPPoE, Wireless Network, and Tunnel.  The choice for my purposes seemed to be between LAN and PPPoE.  The manual said that I should use PPPoE if I used a cable or DSL modem and if my ISP used PPPoE.  I didn't know how to check that.  It didn't sound familiar, so I decided to start with LAN, the default (first) tab.  It gave me an option of manual or automatic configuration; I chose automatic (which was, again, the default).  That seemed to be about all I could do there.  While I was in the neighborhood, I went to Control Panel > Time and set it to synchronize itself with an NTP server.  

Now it was time to set up shared folders (User's Guide, p. 69).  In Control Panel > Shared Folder, I saw the three LUNs I had set up.  So apparently a LUN was a shared folder.  I had already taken care of this.  But that raised some questions.  If it was shared, what more did I need to do so that the computer would see it?  Should I have set up a "target" when I was creating the LUNs?  And did I want to encrypt them?

If I clicked on the Encrypt box, the "Mount automatically on startup" option became ungrayed.  I would want to enable that option.  But I had to think about that for a minute.  It seemed that encryption would protect the contents of the Synology in case of theft or loss of the physical device.  But apparently it would not protect those contents while the computer was turned on.  Anyone who could get into my computer, either physically or via the Internet, would have access to those contents.  I wasn't presently requiring myself to enter a login ID when I turned on the computer, so anyone sitting in my position would still have access, despite encryption.  I hadn't yet reviewed the part of the manual having to do with Internet access to the Synology, but evidently I would also have the option of logging in to it from elsewhere.  On the other hand, I had once had the experience of not being able to get into a backup that I had encrypted.  I wasn't sure if I had mis-recorded the password or if the encryption system on that backup had somehow gotten corrupted.  On balance, I decided that it would probably be a good idea to password the Internet-accessible data on the Synology, and to start requiring myself to enter a password to log in on the computer (System > Administration > Users and Groups).  But then, when I entered the password for the Synology and clicked OK, I got a warning telling me, "The performance of the encrypted shared folder will be decreased" and "The encrypted shared folder will not be available via NFS."  That would have defeated the purpose of having the Synology.  So I backed out of that.  No hard drive encryption in the Synology.

Well, the Synology was still not showing up in Nautilus.  I searched the manual for "target," in case that was the missing ingredient.  The User's Guide (p. 41) explained, "An iSCSI Target is like a connection interface . . . . [A]ll the LUNs mapped to the iSCSI Target are virtually attached to the client's operation [sic] system."  So apparently I would map my three LUNs to a target, and Ubuntu would see the target.  As the manual advised, I went into Synology's Storage Manager > iSCSI Target > Create.  There was an option to enable CHAP authentication, where the server would verify the client's identity.  I went with that.  I didn't go further and enable two-way authentication; I didn't need the computer to verify that it was contacting the right NAS unit.  I mapped all three LUNs to a single target.

In Edit > Advanced, I had an option to have it calculate CRC checksums for header and data digests.  The purpose would be to reduce or prevent data corruption.  The calculation would burden the CPU in the NAS, but I suspected the cabling would be more of a bottleneck than the processor nonetheless.  One post said that CRC might be a good idea for data traveling through a router, as would be the case here.  A year-old VMware webpage pertaining to a different VMware product (ESX) said that data digest for iSCSI was not supported on Windows VMs.  I decided to start out with these checksum items turned on, and see what the performance was like.  I also had options pertaining to maximum receive and send segment bytes.  The manual didn't seem to have anything on that, and nothing popped out in several different Google searches.  I decided to leave those at their default values of 262144 and 4096, respectively.

I still didn't see the Synology in Nautilus, but now (as I viewed p. 72 of the manual) I believed that was probably because I had not enabled my own username (ray) to have access.  In Synology's Control Panel > User, I added that username and gave myself full read/write access to the LUNs.  But then, whoa, on the next page, the User's Guide said that, to allow a Linux client to access a shared folder, I would have to go into Control Panel > Shared Folders > select the folder > NFS Privileges > Create and set up an NFS rule.  The first box there called for Hostname or IP.  It looked like the best way to identify the client would be by its IP address.  What was the IP address of my Ubuntu computer?  Zetsumei said I should type "/sbin/ifconfig" in Terminal.  I did that and got a bunch of information regarding eth0, lo, vmnet1, and vmnet8.  Same thing if I just typed "ifconfig -a."  A search didn't shed any light.  The number for eth0 came first and looked most familiar, so I tried that, with no mapping and asynchronous enabled.  This still didn't produce anything in Nautilus, so I thought probably I should have mapped.  But to what?  The only options were "Map to admin" or "Map to guest."  How about "Map to ray"?

A search of the Synology website led to a thread that yielded more questions than answers.  For the first time, the thought crossed my mind that the quality of the Synology organization was possibly not as gold-plated as I had hoped or imagined.  Surely the manual could have been clearer; surely, at these prices, the people posting these questions deserved some enlightenment.  At any rate, links in that thread led to one of those multiyear Ubuntu discussions, this one dealing particularly with NFS.  It seemed I should focus on learning about NFS; among other things, some posters felt that it was far better than Samba for sharing files and folders.

So I did a search and found a recent webpage promising to show me how to set up NFS.  I guessed that the real problem might be on the client side, so I started with that part of the webpage.  First off, they wanted me to install some packages:  portmap, nfs-common, and autofs.  A check of Synaptic told me that Synology had not installed these.  After installing them, I looked in the manual for the Synology IP address.  On page 161 (after many references to the IP address), the manual said that I could find it in Main Menu > System Information -- not, that is, in Control Panel.  The IP address it gave was, however, the same as the default entry it showed in Control Panel > Network > Use manual configuration; it was not the number shown in the DNS Server box.  So in the client, following the instructions on that webpage about NFS, I typed "sudo gedit /etc/hosts.deny" and added a line that said "portmap : ALL."  Then I typed "sudo gedit /etc/hosts.allow" and added a line that said "portmap : [Synology IP address]," using the address I had just found in Main Menu > System Information.  Next, I typed "sudo gedit /etc/hosts" and added a line near the top that said "[Synology IP address] [Synology Server Name]," in the same format as the other lines there.  (The server name was shown in Main Menu > System Information.)

Continuing with the NFS webpage's instructions, I was supposed to type something along the lines of "sudo mount [Synology Folder] [Local Folder]."  For that purpose, I understood that Synology Folder = [Synology IP address]:[Synology Shared Folder].  But I was not sure what the Shared Folder part was supposed to be.  Was I supposed to refer to the LUN or the iSCSI Target on the Synology unit?  Since the User's Guide (p. 41) said that an iSCSI Target was "like a connection interface," and that all the LUNs attached to it would be attached to the operating system, it seemed that I would need only one target, as I had set it up.  But now that I had learned more about security on the Synology, I had changed my mind about the number of shared folders I wanted.  I just wanted two, each 900GB in size:  one to contain stuff that shouldn't be changing very often, and that only the administrator should have write privileges for, and one for everything else, i.e., for the stuff that I would want to be able to mess with on a daily basis.  So after changing the LUNs and target in Storage Manager, I guessed that I would be creating two folders using the pattern of "/home/[username]/[foldername]" (where "username" would be "ray" in my case) -- one for each of the two LUNs on the Synology.  One of them was called SYNDATA.  On that basis, I typed "sudo mount [Synology IP address]:[Synology 900GB folder name] /home/ray/SYNDATA."  This gave me "access denied by server while mounting [Synology Folder]."  Not a desirable answer, but at least it was a reply of some kind!

By now, I was completely confused, and more than a little irritated at how very long this was taking.  The NAS was supposed to be simplifying my situation, not making it more complex.

It did seem, at this point, that it might have been easier to troubleshoot this if I had been using a computer as my NAS:  I could have gone into it and typed various commands to maybe get a bit more insight on what was happening in there.  A search for that error message led to the suggestion that I type "/usr/sbin/rpcinfo -p" to see what ports the server was using, but that gave me a "No such file or directory" error.

I decided to put in a support request at Synology.  The form required me to enter the Firmware Version -- but, of course, this was not provided in the System Information dialog.  I just entered something that seemed approximately right.  It also asked for the serial number -- and that, they helpfully indicated, was located on the bottom or perhaps the rear of the unit.  After turning it around and risking unplugging it, doing gymnastics to hold it while typing, I realized that, well, they might have mentioned that that bit of information actually *was* in the System Information dialog.  But when I got down to the part where they were ready and listening to what I had to say, I was not sure what to type.  There wasn't an option of talking to (or even chatting with) a live person.  I had to type something.  But what?  How could I possibly explain all this in a few words?

What I needed, somewhere in the Synology software, was a tool that would tell me what was happening.  "You have connected to a computer" or "You have not connected to a computer," etc.  I wasn't sure -- I hadn't done much networking before -- but I suspected that I could get that kind of information by using regular Linux commands on a computer in a network.

I decided that what I would tell the Synology people was just that they should look at this post.  I had identified a number of areas they could improve; and if they really got on the stick, they might even be able to respond in time to help me, before I returned the unit to the vendor or resold it.  The unit had more than a dozen positive remarks from other purchasers at Newegg, so I was hopeful.  But meanwhile, I started a post on the alternative of using a separate computer to create my own NAS.

Tuesday, September 28, 2010

Ubuntu 10.04: Ethernet Networking Two Computers and a Router

I had installed Ubuntu 10.04 on two desktop computers.  Both were connected by ethernet cable to a router.  This seemed like the basis for a network, so that the two computers could talk to each other directly.  I had not previously set up a network in Ubuntu.  This post describes that learning experience.

I started with a search for guidance.  This led to a thread that persuaded me to try Samba shares, with Webmin for my Samba GUI.  So I typed these lines, one at a time:

sudo apt-get install samba
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.510-2_all.deb
sudo dpkg --install webmin_1.510-2_all.deb
sudo apt-get install -f
The last line was a response to the error messages.  Then, in Firefox, I went to https://localhost:10000 and, after confirming a security exception, I entered the same username and password that I used to log into Ubuntu on the computer.  This gave me a locally stored Webmin webpage.  I clicked "Refresh Modules" on the left side of the page.  When that process was done, I clicked on Servers, in the top left corner.  Sure enough, it said, "Samba Windows File Sharing."  I went through that same process on both computers.

Then I searched for information on how to use Webmin.  This led to the discovery that Webmin was not fully compatible with Ubuntu, which would explain why it wasn't available for download through Synaptic.  So now it was time to undo what I had just done:
sudo apt-get remove webmin
sudo apt-get autoremove
As an alternative, someone mentioned eBox.  It looked like eBox had had some hard times, but hopefully those were all behind us now.  So I went into Synaptic and marked ebox-samba for installation.  This brought the plain ebox platform and a boatload of other packages along with it.  One of those packages was ddclient, which asked me many questions that I could not answer.  I tried to fake it, just going with the defaults, but wound up with an "Empty host list" message telling me that I had failed in some significant sense.  With that taken care of, Synaptic went ahead and installed all these downloads, presenting me once again with the ddclient Empty host list before it was done.  Yet after all that, there was no eBox icon in my menu and typing "ebox" at the prompt just gave me "command not found."  So I used the same steps as above to remove eBox.

A different search led to a page that advised me to type this command:
sudo apt-get install samba samba-common system-config-samba
With that done, I went to System > Administration > Samba.  This brought up a Samba Server Configuration dialog.  There, it looked like I could go to File > Add Share to designate a folder that would be shared between computers.  I took these same steps on the other computer.  Then I specified a folder on one computer that I did want to share.  I made it writable, visible, and accessible to everyone.  I found that this had to be a folder; I couldn't share a whole partition.  Later, I saw in another source that I should also have gone into Preferences > Server Settings > Security tab, there in the Configuration dialog, and change Authentication Mode to Share and Guest Account to my username, so I went back and did that,  Then, back in Nautilus, I right-clicked on that folder and selected Sharing Options > Share this folder and allowed others to create and delete.  I right-clicked on the folder in Nautilus again and went to Properties > Permissions, but it was already owned by me with all kinds of rights and privileges.

That seemed to be all I was supposed to do.  But I couldn't figure out where I was supposed to go, on the other computer, to see the shared folder on the first computer.  Eventually I saw instructions to go to Ubuntu's menu > Places > Network.  There, it had entries for each of the two computers, plus something called Windows Network.  I found that, if I just double-clicked on the entry for the other computer and then waited patiently for it to do its thing, with no visible indication that it had heard me, eventually (after maybe ten seconds) it would get around to showing me the shared folder on the other computer.  And it worked:  I was able to retrieve a file from that other computer.

Monday, September 13, 2010

Ubuntu 10.04 vs. Windows XP: Can't Delete a File

Many Windows users have encountered files that they cannot delete.  I had been able to handle most of those problems pretty easily.  The tools I used were Unlocker, to delete the problem file from within Windows conveniently, and Ubuntu Linux, when Unlocker failed.

I was able to switch to Ubuntu pretty quickly, if necessary.  I was using Ubuntu 10.04 on a dual-boot system.  I had installed VMware Workstation 7.1 in Ubuntu, and had created a virtual machine (VM) running Windows XP SP3 in Workstation.

But in this case, I wasn't having file deletion problems in Windows; I was having file deletion problems in Ubuntu.  Specifically, I was running into difficulties when trying to use an external USB hard drive.  For instance, when I tried to delete a file from the external hard drive, I first got this message:

Cannot move file to trash, do you want to delete immediately?
No problem there, to my knowledge; it was a 2.2GB .avi (i.e., video) file, so maybe it was too big for the trash.  So I clicked Delete.  This gave me "Error while deleting," and when I clicked on "Show more details," I got this:  "Error removing file:  Input/output error."  Similarly, when I tried to move some .avi files manually from the internal hard drive to the external USB drive, I got "Error while copying" and, in the details, "Error opening file [filename]:  Input/output error."

Through a relevant search, I came across a post that made me think I should try to approach this from the Windows side.  That seemed ironic at first, but then I reflected that the target drive was NTFS.  That is, it was formatted for use by Windows.  I wasn't having this problem with my Ubuntu ext3-formatted drives.

So I went into Windows and tried to do the same maneuvers I had just tried in Ubuntu:  connect to the USB drive; delete one file from the external (NTFS) USB drive; move files from an internal (ext3) drive to that external USB drive.  I didn't get too far.  Windows said the folder on the USB drive "is not accessible.  The file or directory is corrupted and unreadable."  Was that what "input/output error" in Ubuntu meant?

I ran Disk Management (Start > Run > diskmgmt.msc), right-clicked on the USB drive > Properties > Tools > Error-checking > click both boxes > Start.  I clicked on out of there and rebooted so that the error check would run.  But this did not repair the drive.  On a second try, I watched more closely.  The VM did reboot, but it did not run a disk check.  Apparently the problem was that the external USB drive did not become connected to the VM until after the operating system had already restarted, by which time it was too late for a disk check.  So I rebooted the VM again, this time with a WinXP installation CD in the CD/DVD drive, and ran CHKDSK /R from the Recovery Console.

CHKDSK ran for a while and then said, "The volume appears to contain one or more unrecoverable problems."  This particular external drive consisted of a hard drive in an external enclosure.  I took the drive out of the enclosure and put it directly in the computer.  This time, CHKDSK ran successfully.  I repeated CHKDSK until it reported no more errors, and then put the drive back in its enclosure.  Now I was able to delete the file.  Problem solved!

Saturday, July 10, 2010

Interrupted Upgrade from Ubuntu 9.10 to 10.04 (Lucid Lynx)

Using Update Manager, I was downloading an upgrade from Ubuntu 9.10 to 10.04 (Lucid Lynx) on my laptop.  I had to interrupt it.  When I started the laptop again and tried to resume the upgrade, I had problems.  For one thing, I wasn’t located in a place with wireless, and my wired ethernet connection was not working.  I had already downloaded the remaining upgrade packages at a wireless location, though, so I hoped it would be just a matter of starting the computer and installing those updates.  This, unfortunately, was not the case.  It seemed I had completely screwed up the Ubuntu kernel, and therefore had to choose an older kernel to install from in GRUB.  Then, when I went into System > Administration > Update Manager, I began to learn that my problems had only begun.

What I got, in Update Manager, was this message:
Not all updates can be installed.
Run a partial upgrade, to install as many updates as possible.
I clicked on the Partial Upgrade button.  This led to another message:
Broken packages
Your system contains broken packages that couldn’t be fixed with this software.  Please fix them first using synaptic or apt-get before proceeding.
I went into System > Administration > Synaptic Package Manager.  It said this:
You have 7 broken packages on your system!
Use the “Broken” filter to locate them.
In Synaptic, I went to Edit > Fix Broken Packages.  This said:
An error occurred.
The following details are provided:
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages
E: Unable to correct dependencies
I clicked Reload.  Synaptic was not able to download package information.  I canceled that.  I got a new message:
Could not download all repository indexes.
The repository may no longer be available or could not be contacted because of network problems.
I closed that.  Synaptic’s status bar said, “30190 packages listed, 1277 installed, 0 broken, 135 to install/upgrade, 7 to remove; 51.6 MB will be used.”  That sounded good.  I clicked Apply.  It asked me, “Apply the following changes?”  It had a warning:  “You are about to install software that can’t be authenticated!”  If it had been one or two items, I might have thought twice, but it was dozens of packages, some of which (e.g., seed) even had community documentation.  So I disregarded that warning.  Again, Synaptic tried to download package files and couldn’t, and it wouldn’t go any further until that was done.  So at this point I hibernated the Ubuntu installation and used the laptop solely in Vista mode until I could work through the ethernet problem or go to a wireless location again to continue.

When I did get back to this situation, I tried a number of solutions but ultimately was not able to recover from the interrupted upgrade process.  I therefore started over:  I used an Acronis True Image backup to restore Ubuntu 9.10 and then tried the upgrade again from there.

Ubuntu 10.04: Broken Packages - Unable to Correct Dependencies

I was trying to finish an installation of Ubuntu 10.04 (Lucid Lynx). It got interrupted partway through. When I tried to finish it, I got error messages. At the point where I decided to start blogging the situation, I had just tried the advice to enter these commands:

apt-get clean
apt-get autoclean
apt-get update
apt-get upgrade
apt-get dist-upgrade
(These required "sudo" before each command or "sudo -i" by itself first.)  The first three went OK, but after "apt-get upgrade," I got this:

You might want to run `apt-get -f install' to correct these.
The following packages have unmet dependencies:
  gnome-power-manager: Depends: devicekit-power (>= 011) but it is not installable
  indicator-session: Depends: devicekit-power but it is not installable
  initramfs-tools: Breaks: mountall (< 2.0~) but 1.0 is installed
  mountall: PreDepends: libc6 (< 2.11) but 2.11.1-0ubuntu7 is installed
  ubuntu-desktop: Depends: usplash but it is not installed
  usplash-theme-ubuntu: Depends: usplash (>= 0.5.30) but it is not installed
E: Unmet dependencies. Try using -f.
Running "apt-get -f install" generated a similar message, ending with these two lines:
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies
Just before this, I had run into an error, "Could not resolve 'us.archive.ubuntu.com,'" to which one suggested solution was just to wait for a certain software repository to sort out a problem with its server.  In the present case, however, I had been having these dependency errors for weeks, each time I had booted up Ubuntu on this particular computer and had attempted to update it.  So I did not think the problem was with the repository in my case.

I ran a different search and got a new set of suggestions.  In at least one case, the suggestion to uninstall and reinstall the Gnome and KDE desktops did not seem to have solved the problem.  I tried the approach of going through the list of problem packages (quoted above) and attacking them one by one.  The error for initramfs-tools (above) looked simple enough:  I went into Synaptic, clicked on Edit > Fix Broken Packages, right-clicked on initramfs-tools, and marked it for reinstallation.  But when I clicked "Apply," it said, "Could not apply changes!  Fix broken packages first."  I tried again, this time selecting "Mark for removal."  It said it would have to "mark additional required changes."  I said OK.  It marked dozens of other packages, including some that Synaptic labeled as "(ESSENTIAL)."  I clicked Apply.  It said, "Essential packages will be removed.  This may render your system unusable!"  I cancelled that.  I tried marking a different package -- usplash-theme-ubuntu -- for reinstallation.  Again, it showed me a list of dozens of other packages that would be removed; and again, when I tried to go ahead with that, I got an indication that I was trying to remove essential packages.  I tried the suggestion to type "dpkg --purge (package name)," beginning with initramfs-tools.  I had to quit Symantec to make that go.  But it still just listed a dozen programs that depended on initramfs-tools.  I figured that trying to remove those would quickly lead to the same long list as before.

It seemed that the option, mentioned by many, of just reinstalling Ubuntu might turn out to be the fastest (if not the only) option left.  Facing that possibility, I went back and proceeded through the option of uninstalling initramfs-tools in Synaptic, including the essential packages.  This generated a new list of problems.

I had to call it quits for the time being.  I got back to this situation a few days later.  To see where things stood now, I went back into Symantec.  It said I had seven broken packages.  I marked the first on the list, gnome-power-manager, for updating, and clicked Apply.  It said this:
An error occurred
The following details are provided:
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/f/fontconfig/fontconfig-config_2.8.0-2ubuntu1_all.deb
Undetermined error [IP: 91.189.92.166 80]
[It gave me a number of other error messages similar to this one.]
That made it look like us.archive was still definitely dysfunctional.  I killed Synaptic and went into System > Administration > Software Sources > Other Software.  I checked all of those us.archive.ubuntu.com/ubuntu/ sources and clicked Remove.  Then I clicked Close > Reload.  Not surprisingly, I got this:
Could not download all repository indexes
The repository may no longer be available . . . .
I closed that.  Now I got another message:
An error occurred
The following details are provided:
E: The package fontconfig-config needs to be reinstalled, but I can't find an archive for it.
I closed that too.  Software Sources closed.  I tried restarting Synaptic, but that last error message ("An error occurred") recurred.  I retried the sequence suggested at the start of this post:commands:

sudo -i
apt-get clean
apt-get autoclean
apt-get update
apt-get upgrade
apt-get dist-upgrade
The "apt-get update" line gave me a bunch of error messages along the lines of "Ign http://security.ubuntu.com/ lucid-security" and then another bunch along the lines of "W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/lucid-security" errors, and closed with this:
E: Some index files failed to download, they have been ignored, or old one used instead.
I repeated the apt-get update command, but got the same thing.  I went ahead with "apt-get upgrade," but got this:  "E: The package fontconfig-config needs to be reinstalled, but I can't find an archive for it."  So Synaptic wouldn't start.  I tried "dpkg --purge fontconfig-config."  It said "dependency problems prevent removal of fontconfig-config."  Those problems were that "libfontconfig1 depends on fontconfig-config" and "fontconfig depends on fontconfig-config." I tried dpkg with libfontconfig1, but that gave me a list of about a hundred dependencies.

I had seen several other threads in which a complete reinstall seemed to be the only solution.  I had now reached that point myself.

Sunday, June 13, 2010

Olympus Digital Wave Player -- Where Is Folder A? What Time Is It?

I was using an Olympus VN-960PC digital voice recorder, and was downloading recordings from that device to Windows XP via mini-USB cable.  Unlike the Olympus VN-6200PC, the VN-960PC used the Digital Wave Player (DWP) program to download and display recordings.  DWP showed the actual time and date when the recording was made.  That information was not visible in Windows Explorer; WinEx would just show the date and time when the file was downloaded.


I was able to rename DWP's files (in the format DW_A0001.wav) so that the date and time of creation were contained in the filenames.  I did this using the Aqua Deskperience screen capture program to save the onscreen data from DWP into a text file, and then massaging the contents of that file with text commands (e.g., MID) in Microsoft Excel to produce a batch file to rename the files.  The batch file would run on the WinXP command line, and each line in the batch file would contain the command to rename one file.  The Excel formula for this conversion was something like ="ren "&char(34)&[old filename]&char(34)&" "&char(34)&[new filename]&char(34).  (The meaning of that command becomes visible when you run it.)  The resulting batch file line would say something like "ren DW_0001 2010-06-03 08.41 Recording.wav."

To make that approach work, I needed to be able to view the downloaded recordings in DWP.  The recordings were typically saved in a folder whose name matched the name of the folder I had used to save them on the VN-960PC.  Since I typically used Folder A, the usual location of the downloads, in WinXP, was \My Documents\Digital Wave Player\Message\Folder A.

But now I had a problem.  I was copying the downloaded files from a machine running WinXP SP3 to another machine running WinXP SP2 in a VMware Workstation virtual machine (VM) on Ubuntu 10.04 (Lucid Lynx).  I had installed DWP in this VM, and when I ran DWP in the VM it did show the usual set of folders (Folder A, Folder B, etc.), but I could not find where on the computer those folders were actually located.

The answer was that I was looking for the wrong folder name.  It was not Folder A.  It was FolderA, without a space, and it was being created in the usual place.  That part was simple enough.  I wanted to explain my setup, though, so that I could address some questions that I have seen in other posts online, and to pass along a couple of related insights.

One such insight was that, as it turns out, it was also possible to run DWP in Ubuntu.  The basic solution was to install Ubuntu with Wine, and then just find the DWP installation file (setup.exe) and double-click on it.  (You could also use Wine to run other Windows programs.)  The DWP installation file was already on my system because I set it up as a dual-boot, but I could also have copied it over.

Someone had also created an Ubuntu command-line program to download files from the DVR.  My search led to the discovery that this program, odvr, also had a GUI in its latest version.

Incidentally, in case anyone wonders, I was not able to get the VN-960PC to work directly with Ubuntu itself, nor with WinXP in an Ubuntu VM.  In other words, I could run DWP in a VM to view the DW*.wav files that I had copied there, and I could run DWP in Ubuntu via Wine, but I could not get the hardware to work such that DWP would offer to transfer the files from the DVR to the computer.  All I could get in the WinXP VM was a "usb device not recognized" error.

The other thing I wondered was whether Ubuntu might have a way of extracting the date and time from the DW_A0001.wav file without making me jump through those hoops in Aqua Deskperience and Excel.  The creation date and time information had to be in there somewhere, but how could I get it out?

I took a look at a DW_A0001.wav file in WinXP (right-click > Properties > Summary).  It said it was a 4-bit mono file saved in IMA ADPCM format at a bit rate of 88kbps and an audio sample rate of 22 kHz.  Those values would probably have been different if I had been using the VN-960PC's SP or LP rather than HQ recording modes.  Properties did not state the correct date for file creation; as just noted, it claimed that the created, modified, and accessed dates and times were identical.  I couldn't figure out a solution, so I posted a question on it in an Ubuntu forum.  That didn't draw a quick response, so I tried again in a Windows forum.  No luck there either.  I wasn't turning up much in a search, so I had to let this slide for now.

Ubuntu 10.04: "rsync: failed to set permissions on [folder]: Operation not permitted" -- and Beyond Compare

Using rsync to automate backups on Ubuntu 10.04 (Lucid Lynx), I got a million iterations of this message:  "rsync: failed to set permissions on [target drive & folder]: Operation not permitted."

I had previously had a somewhat similar problem with an external USB drive.  The solution there had been to reformat the drive.  I didn't want to have to do that again if it wasn't necessary.  I ran a search and, following what i understood from one post, I set out to change ownership on the target folder so as to match the ownership of the source folder.  To do that, I went into Ubuntu's Terminal and typed "sudo nautilus," and then navigated Nautilus to File System/media/[target drive].  (It could instead have been in File System/mnt/.)  I right-clicked on that and got Properties > Permissions.  The owner was root.  When I tried to change it, it changed back.

I exited Nautilus and followed instructions in Ubuntu Community Documentation, combined with advice from another post and the Ubuntu manual page for chown.  I typed "sudo chown -R ray /media/[target drive]."  That ran for five or ten minutes, as the chown (change ownership) command recursed (i.e., -R) all of the subdirectories on the target drive.  But that, by itself, did not fix the problem; indeed, it didn't seem to change anything.  Root was still the owner of the target drive.  Then again, the properties of the target allowed others to create and delete files as well, so why was rsync complaining?

There appeared to be another way.  In Terminal, I typed "sudo gedit /etc/fstab."  I already had a line for the target drive, which I'll call simply TARGET.  That line was as follows:

UUID=[UUID for the drive] /media/TARGET ntfs-3g defaults,umask=000 0 0

The Ubuntu documentation I was now looking at said, "Permissions are set at the time of mounting the partition with umask, dmask, and fmask and can not be changed with commands such as chown or chmod."  So possibly that's why my chown command wasn't doing anything.  Following the advice, I changed it to dmask=027,fmask=137, since this was going to be just a backup drive anyway.  I also saw that "defaults" meant these options:  rw,suid,dev,exec,auto,nouser,async.  All of those were fine, as far as I knew, except for this information from the documentation:

user - Permit any user to mount the filesystem. This automatically implies noexec, nosuid,nodev unless overridden.

nouser - Only permit root to mount the filesystem. This is also a default setting.
I wanted user, not nouser.  I decided it might be easier to spot this sort of thing, in future visits to fstab, if I just changed all occurrences of "defaults" to make these options explicit.  Besides, in light of the statements just quoted, it seemed that I would have to override several defaults anyway.  So the resulting fstab line looked like this:

UUID=[UUID for the drive] /media/TARGET ntfs-3g rw,suid,dev,exec,auto,user,async,dmask=027,fmask=137 0 0

I saved fstab and, in Terminal, typed "sudo mount -a" to mount the partitions according to these new instructions.  Then I ran the rsync command again.  Sadly, these changes made no visible difference.  I still got a million error messages.  So, OK.  I had been overlooking the first three error lines in the log output of my rsync command.  The second and third lines followed the pattern of this first line, but were for subdirectories:

rsync: failed to set times on /media/TARGET/.": Operation not permitted (1)

I hadn't previously investigated the "failed to set times" error, so now I did.  What I got out of the forums I came across was that possibly I had a syntax error in my rsync command.  Here's how it went:

rsync -qhlEtrip --progress --delete-after --ignore-errors --force --exclude=/.Trash-0 --exclude=/.Trash-1000/ --exclude=/lost+found/ /media/SOURCE /media/TARGET 2> /media/SOURCE/Backuplog.log

This was identical to the perfectly working rsync command that I was occasionally using to back up SOURCE to a different partition, with one exception:  in the one shown above, I didn't have a slash after Trash-0.  So I changed that to --exclude=/.Trash-0/ and re-ran it.  That didn't solve it.  I then noticed (I was using two desktops) that I had gotten a message telling me that the system was not able to mount the partition:  "Device or resource busy."  So possibly that fstab step still needed to be tested.  I rebooted the system.  None of the the parittions that I had adjusted in fstab were mounted.  I went back, deleted the dmask and fmask parts, and returned it to umask=000, and rebooted.  Now the partitions were all mounted.  I ran the rsync command again.  The problem had not changed.

I found an informative thread in which bscbrit suggested trying to use cp to copy a single file from the source partition to the target partition.  If it worked, s/he said, the problem was not with permissions; it was just with trying to use rsync.  So in SOURCE I copied a file, renamed it "x.txt," and typed "cp /media/SOURCE/x.txt /media/TARGET," and it worked:  there was a copy of x.txt on TARGET.  It sounded like there could be a kind of mismatch between the ext3 source drive and the ntfs target.  I also came across an informative post by djgrandmarquis that said rsync could have problems with Windows file systems.  That was in response to a question about very slow backup times, which  I had also experienced.  I needed Windows file systems because I was backing up to an offsite drive that I sometimes shared with a Windows system.

I had previously investigated Beyond Compare (BC) as another way of synchronizing drives.  BC had drawn  a lot of praise.  Since my previous writeup, I had bought a copy and had been using it for several months on Ubuntu, WinXP, and Linux.  I had subsequently found a comparison of many such programs; but since I had already bought BC and was using it with good results, I didn't explore that comparison.  I could verify that BC was fast and trouble-free when compared to rsync, especially when going between ext3 and ntfs drives.  I also liked the visible information about what was being changed and backed up.  So I decided to stop using rsync and start relying only on BC for my backups.

There were a few differences between the Windows and Linux versions of BC; but in an impressively thorough reply to my post, Craig from BC said that the portable version of BC ran well on Wine in Ubuntu.  I had already installed Wine, and I had also already been using the portable version of BC3; I preferred portable versions to save time during reinstallations, as I was able to save them elsewhere than drive C and therefore they weren't wiped out during a Windows reinstall.  So to try this out, I copied over the BC3 portable installation and tried using a funky procedure involving PortableApps to try the Windows version.  But now it seemed I had not properly understood or used that procedure:  PortableApps now appeared to be looking, not for .exe files, but for ".paf exe" files.  Meanwhile, it looked like Beyond Compare 3 would run fairly well under Wine, so I gave it a try.  Following the steps described in that previous post, in Terminal I navigated to the folder where I had the original BC installer, typed "ls" to get the exact filename, and typed "wine BCompare-3.1.10.11626.exe" to install that file.  Terminal reported some "fixme" and "err" messages; nonetheless, the Beyond Compare 3 Setup Wizard ran.  I had a licensed version, so I entered the license key, and followed the instruction to restart.  It worked, but now I came to the new realization that Windows identifies drives by letter (C: etc.), while Ubuntu identifies them by name (/media/DATA, etc.).  So of course a Windows version of Beyond Compare, looking for Windows-type folder paths, running in Ubuntu, is going to find only a limited number of Ubuntu locations.  I didn't pursue that problem.

This left at least one issue unresolved.  While I was OK with doing manual comparisons for now, I was still not at the point of being able to write scripts to automate BC backup processes.  I started another post on that.

IrfanView Error: Windows Can't Play This File

I was using Windows XP SP3 as the guest operating system in a VMware Workstation 7 virtual machine (VM) on Ubuntu 10.04 (Lucid Lynx).  For some months, I had been using IrfanView to play various audio and sometimes video files in that VM.  Suddenly, with a number of files, I started getting this error message:

IrfanView
Error:  Windows can't play this file!
Windows error text:  The specified file cannot be played on the specified MCI device.  The file may be corrupt, not in the correct format, or no file handler available for this format.
You can try to install additional video/audio codecs from this site:
http://www.fourcc.org/indexcod.htm
or try the DirectShow option in 'Properties->Video'
At first I thought this was a problem with IrfanView.  I upgraded to the most current version of IrfanView and tried again.  The error was still there.  I tried playing the file in Windows Media Player (WMP).  I got this message:
The file you are attempting to play has an extension (.wav) that does not match the file format. Playing the file may result in unexpected behavior.
Do you want the Player to try to play this content?
I said Yes.  It took a few seconds, but then it was able to play the file.  So yes, IrfanView was not handling it as well as WMP, but both of them were telling me there was a problem with the file.  And then I knew what the problem was.  I had bulk-renamed a bunch of files, and had inadvertently named some *.wma files to be *.wav files instead.  I renamed this file to be filename.wma instead of filename.wav.  Now IrfanView was able to play it without a problem.

I was surprised to encounter this problem.  IrfanView had an "Ask to rename if incorrect extension" option, and I had enabled it.  That option had often asked me if I wanted to rename a file that had somehow acquired an incorrect extension.  Why not this time?  Apparently IrfanView was not able to detect the problem in this particular scenario.  I checked what codecs I had been installing.  I was not too sure what codecs were all about, and for some years I had been using K-Lite Codec Packs as a sort of all-purpose Band-Aid.  But as I checked on it, it appeared that I had just been reinstalling the same old copy of version 3.5.9 or possibly 4.7.0, whereas K-Lite was now up to version 6.0.4.  So I downloaded and installed the latest 32-bit K-Lite Mega Codec Pack.  It was a big honker -- 25MB -- but my understanding was that, if somebody sent me a file of a Mongolian shepherd beating on a bucket and recording it on a 1960-era IBM tape drive, this would be all I would need to enable Windows to play it in five-channel glory with four-part harmony.

Saturday, June 12, 2010

Ubuntu 10.04: IrfanView and Other Portable Apps via Wine

According to Tom Wickline, the process for installing IrfanView 4.23 on Ubuntu 8.04 was just a matter of installing winetricks and MFC42.dll and then installing IrfanView.  I wasn't sure how to do each of those steps, and I wasn't using quite the same setup as he was.  This post traces through my own installation process.

I was using Ubuntu 10.04 (Lucid Lynx).  I had just downloaded IrfanView 4.27, and thought I would try to install that latest & greatest version.  Also, unlike Tom's system, mine was not "a clean configuration directory, with no other applications or games installed."  According to Ubuntu's System > Administration > Synaptic Package Manager, I was using Wine 1.2.

My first hurdle was to figure out how to install MFC42.dll.  A WineHQ webpage said that I could get MFC42.dll from Microsoft or via winetricks.  They said I might already have gotten winetricks installed during my Wine installation, but they also said that I could run it even if it wasn't installed; I would just have had to type "sh winetricks" instead of just "winetricks" to run it.  I checked Synaptic.  Sure enough, there it was.  The purpose of winetricks seemed to be to add Windows-friendly support files so that Wine would run Windows programs.  That sounded about right.  The winetricks webpage listed MFC42.dll among the files that it was prepared to help me with.  I went ahead and typed "winetricks mfc42.dll."  That ran and appeared to change some settings.  I went into the wine subdirectory under my Ubuntu user folder:  File System/home/ray/.wine/drive_c/windows/system32.  Tyler Style had said that it needed to be there, but it wasn't.  Amusingly, he had posted that a few months earlier in response to my previous attempt, a year earlier, to get IrfanView running in Ubuntu.  Well, I thought, maybe MFC42.dll had known what it was doing when it installed itself; maybe Tyler was wrong as to the location where it would be found.  The other thing he said that I needed to do was to go into Applications > Wine > Configure Wine > Libraries tab and register MFC42.dll there.  I typed mfc42.dll into the "New override for library" box, at that location, and clicked Add.  It seemed to accept it:  it listed "mfc42 (native, builtin) as an Existing override.  I clicked Apply > OK.

This was fine, for whatever it was worth, but it didn't add IrfanView to my program menu.  To install IrfanView, I had gathered somewhere that I needed to type "wine iview427_setup.exe" to install IrfanView.  I tried that.  It replied with this:

wine: cannot find L"C:\\windows\system32\\iview427_setup.exe"
That raised two questions, which may be summarized as "why not?" and "so what?"  I didn't know why the error message had put that L in front of the C, but whatever; I had since discovered that, in Windows, IrfanView would install as a standalone program, and had therefore moved it to a different partition where I kept all of my Windows standalones (so that I wouldn't have to reinstall them whenever I had to reinstall Windows, but could instead just copy the whole folder to drive D (or whatever) on the new computer.  In other words, I wondered whether I could skip the installation; I wondered whether Wine could run portable or standalone programs.  According to MoebusNet, it could, and one way to make it do that was to download and install PortableApps to the USB drive where you were going to keep your portable programs.  In my case, I wasn't going to keep them on a USB drive; I was going to keep them in a folder on my hard drive.  I wasn't sure how that would work, but I gave it a try.  I downloaded and ran the little 2MB PortableApps Platform.  They said it was self-contained -- PortableApps was, itself, portable -- so I wondered if I could install it on the folder on my hard drive where I kept my other portable programs.  After a brief search, I decided the best way to find out was just to try it.  So when it came time, in the installation process, to choose the install location for PortableApps, I named that folder as the destination.  When the installation finished, in Windows Explorer I copied my IrfanView portable folder to the PortableApps folder.  (I kept a copy in the original location so that it would be available outside of Portable Apps as well.  I thought I would probably prefer to run it that way from my WinXP boot.)  I deleted iv_uninstall.exe from this copy, since I didn't want the uninstaller to show up in PortableApps.  I created a shortcut to PortableAppsPlatform.exe and put that in my Start Menu.  I started up PortableAppsPlatform and, following instructions, clicked on its Options > Refresh App Icons.  I clicked on the IrfanView icon and, sure enough, IrfanView started up.

So now that I had acquired this lovely knowledge about PortableApps, it was time to get back to what MoebusNet had started telling me, about running portable apps in Ubuntu via Wine.  I typed this:
wine "/media/DATA/Standalones/PortableApps/PortableApps.com/PortableAppsPlatform.exe"
and that worked:  IrfanView started up.  So the concept seemed to be that any portable app that I would put into a folder on the same level as the PortableApps.com folder would show up when I ran that command.  So I could make a single PortableApps menu pick for Ubuntu, and it would lead, via PortableApps, to any portable application program that I would set up that way.  I set up a launcher for that wine command by highlighting, right-clicking, and copying it into the Ubuntu Applications menu:  right-click on Applications and choose Edit Menus > Applications > Accessories > New Item.  Name it PortableApps, paste the copied command into the Command box, and Comment it as "Launch portable Windows applications."

This was all wonderful.  But when I tried to play a .wav file in IrfanView, I was still getting the same error message from the previous year, the one that Tyler Style had tried to help me with.  The message read as follows:
IrfanView
Error:  Windows can't play this file!
Windows error text:  Invalid MCI device ID.  Use the ID returned when opening the MCI device..
You can try to install additional video/audio codecs from this site:
http://www.fourcc.org/indexcod.htm
or try the DirectShow option in 'Properties->Video'
The fourcc.org/indexcod.htm webpage seemed to offer video but not audio codecs.  Some Ubuntu documentation pointed me toward the Ubuntu restricted extras repository.  I thought I had already set myself up for everything I could get from there, but the documentation was saying, "Installation only works completely and properly when done from the command-line Terminal. The entire package will not usually install completely from within a Package Manager."  So possibly Synaptic had not brought me all of the codecs I needed.  I killed IngrfanView and then, obeying the documentation, I typed this:
sudo apt-get install ubuntu-restricted-extras
but it said I already had the newest version.  I could have tried completely removing and reinstalling ubuntu-restricted-extras, but that sounded like it could lead to other difficulties.  Besides, another post made it sound like the codecs might actually be in Medibuntu, which I had also installed.

There were two other things to think about.  One was that I might just try a different audio player.  I posted a question on that.  The other was that I maybe I should take a shot at that actual error message.  What did "Invalid MCI device ID" mean?  Turns out I had posted a bug report on it the previous year.  I posted an update to that bug report.

Meanwhile, in response to the question about an alternative audio player, I got a suggestion to try an older version of IrfanView (namely, 3.98), or to try mpg123 if my reason for wanting IrfanView was to enable skipping to the next file in a folder with just one keystroke.  IrfanView 3.98 dated from 2005, so I would be missing out on some newer functionality.  It didn't seem to be available on the official IrfanView site, but I found numerous other locations for it.  It was a bit harder to find the plugins for version 3.98, but eventually I did.  I installed 3.98 and its plugins on a Windows XP machine and then moved the installed folder over to the Ubuntu machine.  I deleted the previous IrfanView folder from the PortableApps folder, and put this new IrfanView 3.98 folder into PortableApps in its place.  (This time, I didn't keep a copy outside of PortableApps, since I didn't plan to run 3.98 in WinXP.)  Once again, I deleted the Uninstall.exe file from this IrfanView 3.98 folder.  I went to Ubuntu's Applications > Accessories > PortableApps > Options > Refresh and then clicked on IrfanView.  It opened up.  I went to Help > About.  Sure enough, I was now running version 3.98.  To test it, I hit Print Screen.  This opened Ubuntu's Save Screenshot dialog.  I clicked Copy to Clipboard, moused to IrfanView, and hit Ctrl-V.  Sure enough, I had the screenshot in IrfanView.  I tried cropping it (left mouse click / drag / release, Ctrl-Y), set View > Display Options > Fit Images to Window, and, sure enough, IrfanView was functioning normally.  Cool!

To try IrfanView's audio functioning, I navigated to a folder containing several .wav files, double-clicked on the first one, and it played -- in Ubuntu's Totem Movie Player.  Oops.  I right-clicked on the .wav, but Ubuntu wasn't listed as a possibility for the program to play it in.  I went back to PortableApps and started IrfanView again.  I went into its Options > Properties -- but, of course, I had already set those.  So, a problem:  could I get Ubuntu to treat IrfanView as the default viewer or player for a filetype?  My first search didn't turn up much.  PortableApps had a live support chat, but no joy for me there, so I posted a question on it in a PortableApps forum.  Then, resuming my tinkering, I right-clicked on the .wav again and chose Open With > Other Application > Wine Windows Program Loader, but that gave me "Error:  There is no Windows program configured to open this type of file."  Well, I had definitely configured IrfanView to do so, but maybe Wine didn't agree.  I tried a search for that error message, and followed one particularly painful thread from that search.  Somewhere along the way, I got the idea to try Ubuntu's Applications > Wine > Configure Wine > Applications.  With Windows XP as the version of Windows specified at the bottom of the dialog, I clicked on Add Application and navigated to the folder where I had put PortableApps; and in there, I navigated to the IrfanView folder, selected i_view32.exe, and clicked Open > OK.  Now I went back to the original Ubuntu right-click on the .wav, selected Open With > Wine Windows Program Loader . . . and still got the same "no Windows program configured" error.

I had forgotten the option of installing IrfanView as an Ubuntu application via Wine.  Following my steps from a year earlier, I navigated to the IrfanView 3.98 folder and typed "wine i_view32.exe."  But no, that wasn't right; that just ran the portable version.  That command-line approach wasn't necessary anyway; I discovered that I must already somehow have set up Wine to run .exe files automatically, apparently following advice like that provided by a relevant Community Documentation page.  All a bit puzzling.  I continued playing and posting on it, trying to dig my way out.

Meanwhile, I experimented with mpg123.  Some time had passed, and I couldn't remember if I had already installed it, so I just typed "mpg123" at the Ubuntu command line.  This gave me an odd error message:
The program 'mpg123' is currently not installed.  You can install it by typing:  sudo apt-get install mpg321.
What was odd was that the installation line said mpg321, not mpg123.  I checked Synaptic.  It confirmed that I didn't have mpg123 installed yet, and it also showed me a program called mpg321 on the next line.  The description of the latter characterized it as an "mpg123 clone that doesn't use floating point."  Apparently someone at mpg123 decided that mpg321 was a superior alternative, and thus gave me that command line suggestion to use mpg321 instead.  Just to be sure, I did a search and got the impression that mpg123 began as nonfree software, so mpg321 was prepared as a free alternative and it just became more popular.  I installed both of them in Synaptic, but after playing around with them for a half-hour or more, I was still not getting playlists to work properly.

I found a page listing top Linux music players.  I looked at the webpages for several on that list, but none of the six or eight pages I looked at provided a simple explanation of how the players actually worked -- of whether, to cite an example, you could hit the 6 key on the numeric console at the right end of a standard keyboard to move on to the next file, as you could do in Winamp.  From that list, in the name of trying something rather than nothing, I installed Audacious.  It was a nice enough player, but it did not have the ability to delete a file that I was listening to, as IrfanView did.  It was also not as responsive:  IrfanView would stop immediately when I told it to, so that I could mark a file for resorting or other handling; Audacious would continue on for maybe a second or so, which is not much except when it results in the program's moving on to the next file, which was not the one that I wanted to delete, re-listen to, or otherwise handle.  I decided, once again, that what I wanted was undeniably IrfanView, until further notice.

By this time, Ringi had replied to my latest post in that thread.  It seemed that s/he was doing just fine with the latest version of IrfanView in Ubuntu.  Since there seemed to be no need for 3.98 after all, I deleted the IrfanView 3.98 folder from PortableApps and replaced it (again, without the uninstall.exe) with a copy of 4.27.  Ringi asked whether I had installed IrfanView's plugins, and that was a good question; I was not sure.  Actually, by now I wasn't even sure I had actually installed IrfanView via Wine; it wasn't appearing in Applications > Wine > Programs.  Returning to my notes at the start of this post, I decided that the PortableApps thing was a dead end, at least for purposes of getting IrfanView to run the way I wanted.

I went back, specifically, to the advice (above) that I needed to type "wine iview427_setup.exe" to install IrfanView.  In Terminal, I navigated to the original setup folder (i.e., not the unpacked, ready-to-run standalone folder) where I had stored iview427_setup.exe and irfanview_plugins_427_setup.exe.  I typed that  Wine command:  "wine iview427_setup.exe."  It said, "err:module:import_dll Library MFC42.DLL (which is needed by L"D:[path]\iview427_setup.exe") not found."  So, OK.  I had not correctly installed MFC42.DLL after all.  Following the Winetricks instructions, I typed "sh winetricks mfc42.dll."  I got an error:  "Can't open winetricks."  I verified, in Synaptic, that I did have cabextract installed.  Synaptic also confirmed that I had winetricks installed.  Nonetheless, following those instructions, I typed "wget http://www.kegel.com/wine/winetricks."  It ran.  I tried "sh winetricks mfc42.dll" again.  This time, it said, "Unknown arg mfc42.dll," followed by a list of the packages that it did have.  Oops:  just plain mfc42, not mfc42.dll.  I retried:  "sh winetricks mfc42."  It ran without error.  So, interesting:  it seemed that Synaptic (or whatever approach I had used previously) had not done the job of installing winetricks properly.  Now I got a dialog for "VCRedist Installation."  I okayed through that; something ran in Terminal; and it concluded with this statement:  "Install of mfc42 done.  Winetricks done."  Cool.  I had finished the mfc42 part.  Now back, once more, to "wine iview427_setup.exe."  This gave me the IrfanView Setup dialog.  I set it to install for all users in C:\Program Files\IrfanView\.  It completed, and IrfanView was up and running.  I killed it and typed "wine irfanview_plugins_427_setup.exe."  That ran OK, and now I had an IrfanView entry in Applications > Wine > Programs.  I started IrfanView and set its options, including naming it as the default handler for all audio files.

So IrfanView now seemed properly set up for sure.  In IrfanView, I did a File > Open.  It was listing only image files, but I changed it to show all files, and then tried to play one of the .wav files in that folder.  It gave me the "Error:  Windows can't play this file!" message again, same as before.  I killed IrfanView, double-clicked on a .wav file in Nautilus, and the file played -- in Totem!  It certainly appeared that I had installed IrfanView correctly -- at least once, if not multiple times -- and yet it was still not functioning properly for me in Ubuntu.  I returned to a Wine bug report that I had started to file a year earlier.  I didn't know how to file bug reports, but I gave it a whirl.  The concept seemed to be that you get a debug trace on the uncooperative program.  In this case, that seemed to call for going to the folder where I had installed portable IrfanView and running the following command:

WINEDEBUG=+relay,+seh,+tid wine i_view32.exe &> /tmp/output.txt

That opened IrfanView and waited while I repeated the steps I had taken:  open a .wav file, get a repeated error message, etc.  When I closed IrfanView, the output file was there.  But when I looked in it, it only contained repeated instances of this message:  "fixme:mciwave:MCIWAVE_DriverProc Unsupported yet command [2115]."  That last number changed, in each of the six repetitions of that message:  2115, 2114, 2132, 2114, 2132, 2132.  Maybe that was all it was supposed to say.  Whatever.  I attached the output.txt file to the bug report and sent it off.  Meanwhile, I posted a link to this note in the discussion thread, in case Ringi or someone else felt like reviewing it and possibly detecting what I had done wrong.