Monday, October 21, 2013

Mounting a Windows Share from Windows 7 in Linux: Mount Error(12): Cannot Allocate Memory

I wanted to mount a network share from a Windows 7 host in Fedora Linux. I encountered a problem below,

[user@fedora]$ sudo mount -t cifs -o username=my-windows-7-username,uid=my-linux-user-name,rw  //windows7host/path-to-network-share /directory-to-mount
[sudo] password for user:
Password for my-windows-7-username@//windows7host/path-to-networshare: ********
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
[user@fedora]$

A few web searches produced quite a few hits. Most suggest to change "IRPStackSiz"; however, that is not for Windows 7 host. The correct answer is from the "archlinux" site that has a page,
which explicitly states "Note: Googling will reveal another tweak recommending users to add a key modifying the "IRPStackSize" size. This is incorrect for fixing this issue under Windows 7. Do not attempt it." Kudos to that!

For the impatient, run the following as administrator in Windows 7,
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "LargeSystemCache" /t REG_DWORD /d 1 /f

reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "Size" /t REG_DWORD /d 3 /f
Then reboot the Windows 7 host.




Sunday, October 20, 2013

The Windows.old Folder

After I upgraded Windows 8 to Windows 8.1, I found a Windows.old folder that occupied more than 1 GB disk space.

Here is what Microsoft says about the folder,


Wednesday, October 9, 2013

Massively Open Online Courses

This just serves as a bookmark for the leading websites offering Massively Open Online Courses (MOOCs). I found many good computing courses.

Coursera
Udacity
edX
EduKart

Sunday, October 6, 2013

Join Multiple Video Files

I wanted to join a few .mp4 video files together on a Linux host using free software.With my limited experience with avconv (and ffmpeg) and some web search, I attempted to join the .mp4 files using the following command,
avconv -i concat:1.mp4\|2.mp4\|3.mp4 all.mp4
Unfortunately, the above command did not produce the expected result. It threw an exception and stopped at the end of the first .mp4 file, which was also observed by a few frustrated users, e.g.,

The reason turns out to be that the concatenation operation cannot be performed on .mp4 file, which is also suggested in the answer to the last of the three examples above.

The solution to the problem is in fact included in the FAQ of libav and that of ffmpeg, which is suggested by a stackoverflow post and answer.  Below is how I actually got it done,
avconv -i 1.mp4 1.mpeg
avconv -i 2.mp4 2.mpeg
avconv -i 3.mp4 3.mpeg
cat 1.mpeg 2.mpeg 3.mpeg | avconv -f mpeg -i - -vcodec mpeg4 -strict experimental output.mp4
or
ffmpeg -i 1.mp4 1.mpeg
ffmpeg -i 2.mp4 2.mpeg
ffmpeg -i 3.mp4 3.mpeg
cat 1.mpeg 2.mpeg 3.mpeg | ffmpeg -f mpeg -i - -vcodec mpeg4 -strict experimental output.mp4
This solution is also suggested by a few posts, such as, this one, this one.

If you observe quality degradation in the resulting video, you may add the "-qscale" option, such as,
avconv -i 1.mp4 -qscale 1 1.mpeg
where the value of qscale is between 1 and 0 with 1 being the highest quality (also the largest file) and 0 being the lowest quality (also the smallest file).


Note that many web posts, when discussing the tools, refer the "sameq" option, which apparently not supported any more, as discussed here.

By the way, when I was looking for a solution to the "join-mp4-vidoe" problem, I happened to come across a post on the history of libav and ffmpeg that I enjoyed reading and that answers my question, "why are there two almost identical but different libraries and tools, libav and ffmpeg?"





Sunday, September 29, 2013

Convert VirtualBox VDI to VMWare VMDK

You can run virtual machine instances created in one virtualization software in another. QEMU is a good tool to do this. The following example converts a VirtualBox VDI file to a VMDK file that can be loaded in VMWare.

I did the conversion on a Windows host. You can download the precompiled Windows binaries of QEMU, provided by Prashant Satish,  or those provided by Eric Lassauge.

The procedure is the same in Linux hosts.

  1. To convert VirtualBox virtual appliance to a VMDK file.
    qemu-img convert  virtualbox.vdi  -O vmdk vmware.vmdk
  2. If you have VMWare Workstation or more luxury version, you can start with creating a new virtual machine. During the process, you have the option of selecting an "existing disk". In this case, you simply select the .vmdk file.

    However, I would like to stick to the free VMWare Player that does not provide the option of selecting an "existing disk". I have to use a workaround.

    Start VMWare Player, then create a new virtual machine, for instance, a virtual machine called "vboxvmware".  You must select "I will install the operating system later." option as the two images show. 



    Since you created or downloaded the VirtualBox virtual machine, you should know what guest operating system it is and what memory capacity is allocated. Choose them accordingly.



    Next step, choose the option of "Store Virtual Disk as a Single File".


    Upon confirming your choice, you will see that the virtual machine is created.



    The last step is to edit the VMWare virtual machine configuration file (.vmx file). Go to the directory where the virtual machine is located, locate the .vmx file, and edit the file using your favorite text editor. In the editor, locate the line of "scsi0:0.fileName = ..." and replace the virtual disk file by the .vmdk file previously converted using QEMU. Note that when you edit the file, make sure the path of the .vmdk file is correct if it is not copied to the directory. Then, you can safely remove the vboxvwmare.vmdk file that your virtual machine does not really use. You can then safely launch the virtual machine from the summary screen.



Thursday, September 26, 2013

Tracing System Calls and System Events

I found strace and ltrace were good tools on Linux to diagnose many problems.

On Windows, similar tools actually exist. The equivalent to strace, perhaps is, Process Monitor and that to ltrace, Logger and LogViewer.

 In addition, Windows' event instrumentation is useful.

A good article is http://jbremer.org/intercepting-system-calls-on-x86_64-windows/ . The post is based on the discussion at http://stackoverflow.com/questions/3847745/systrace-for-windows.




Tuesday, September 24, 2013

Web Pages Never Expire

Heard this website http://perma.cc from Marketplace Tech. "Some of the most prestigious institutions in the country are taking efforts to create a new, permanent archive of scholarly work online. new, permanent archive of scholarly work online" as it states. Sounds quite interesting.The site is still in beta -- I hope that it will go alive soon.