Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Saturday, October 25, 2014

When 'chsh' simple does not work

I got into this problem lately in a Live environment of the new Ubuntu MATE release where no matter how many times I change the password using 'sudo passwd' it simply does not effect 'chsh'. So, when I type in
chsh -s /usr/bin/zsh
It asks for the password. And when I type the password in, it does not work. It simply says "PAM: Authentication Failure". Ok, so go for Googling. Later, I found out that all user 'home' and 'shell' infos are stored in a file located by '/etc/passwd'. Now you need root to do this. So how do you get root? For a Live system, that's simple. just type in
sudo -i
It should give you the '#' prompt so you're root now. Now just open the file using your favorite editor like
nano /etc/passwd
Then find your user name and change the string right after the last ':' on that line. Done. Reboot and go. For now, I seriously don't know why 'chsh' didn't work. :( anybody have any clues?

Friday, June 20, 2014

[Fix] Android ADB "No such file or directory" error

After I started using Ubuntu 14.04 recently and had my go with Android development, the immediate first wall I hit was I was welcomed with the error, "No such file or directory". Thanks to the power fo Google search I found this little fix in Stackoverflow. [ https://askubuntu.com/questions/143774/android-sdk-having-trouble-with-adb/182765#182765 ]. I could not install ia32-libs for unknown reason so used the second method of installing just the following 2 packages.
sudo apt-get install libncurses5:i386
sudo apt-get install libstdc++6:i386

Wednesday, March 12, 2014

[Lubuntu]Workaround to compile BBCP in Lubuntu

BBCP is a useful program to speed things up when sending files between network machines. It can used multiple streams to make the magic happen. But recently, while trying to compile it (you can't find a prebuilt DEB) in Lubuntu, I faced with the error
*** No rule to make target `makeLinuxi686'.  Stop.
It meant there was to defined rule in the Makefile for my architecture (that I was using in Lubuntu). So, dirty the hands. Open the Makefile in a text editor and look for the line
Linux
Right after it you'll see a line similar to this.
makeLinuxx86_64:
        @make $(MKPARMS)  \
        CC=$(LNXCC) \
        BB=$(LNXcc) \
        CFLAGS="$(ENVCFLAGS) $(LNXOPT)" \
        BFLAGS="$(ENVCFLAGS) $(LNXOPT_B)" \
        INCLUDE="$(ENVINCLUDE)" \
        LIBS="$(LNXLIBS64)"
So, I just crossed my fingers (taking my chances) and cloned that part like this
makeLinuxi686:
        @make $(MKPARMS)  \
        CC=$(LNXCC) \
        BB=$(LNXcc) \
        CFLAGS="$(ENVCFLAGS) $(LNXOPT)" \
        BFLAGS="$(ENVCFLAGS) $(LNXOPT_B)" \
        INCLUDE="$(ENVINCLUDE)" \
        LIBS="$(LNXLIBS64)"
Saved the file
Then again followed the compilation instructions [like here] and VOILA!!! :D

Saturday, March 08, 2014

[Ubuntu] Streaming your PC / Laptop audio stream (alsa) to another LAN connected device

I constantly like to change where in the room I sit for some computing. I get bored too easily in one place so I keep switching places. But, sadly, my sound system isn't wireless. So, how to fix this issue? I wanna move around but still want all my songs keep sounding through my central surround sound? WiFi. Yep.
With the help of the amazing power of Linux, it's too much cute sound architecture ALSA and a little SSH, I stream my whole soundcard feed to another "Old, and slow" laptop that stays with my sound system. I tried Pulseaudio, but it didn't quite get me where I wanted to be. I just use it for selected which feed goes to the other laptop and which stays native.
Stictly, Ubuntu instructions
Requirements
For this work, you need
1. An extra Linux machine (Raspberry Pi/another Laptop/Netbook anything that can run ssh-servr)
2. WiFi network setup (Router, tethered from Laptop etc) 3. A little bug fixing here and there if this tutorial becomes too old

First of all, let's install the following packages
pulseaudio paprefs pavucontrol sox [on the machine that sends the sound data]
openssh-server [on the machine that receives sound data]
I'm assuming both laptops have working sound system setup.

Then, on the streamer (the machine from which we'll send the sound) run this command
modprobe snd-aloop index=0 pcm_substreams=1
This is a module you must load in order to get a loop back device in your soundcards list. What this device does is put all your audio data so that any device can pick that from there. In this case my Laptop connected to the speakers.
If you happen to fail to load this module, check for some instruction on the internet. I found some tutorials that may help you to resolve issues. These are two good tutorials
http://confoundedtech.blogspot.com/2012/08/building-installing-alsa-loopback.html
http://www.sm5bsz.com/linuxdsp/install/snd-aloop.htm
To be able to load this automatically on each boot just add this to
/etc/modules

Now, when your modules is up, you should be able to see a loop back device in your "Sound Settings" that is called "Analog Output, Loopback device"
Now open up ~/.asoundrc and add this to that, if the file doesn't exist create it.
pcm.!default {
  type dmix
  slave.pcm "hw:Loopback,0,0"
}
pcm.loop {
  type plug
  slave.pcm "hw:Loopback,1,0"
}
This basically puts all your sound data in the loopback device. If you want to select manually instead use this.
pcm.loop {
  type plug
  slave.pcm "hw:Loopback,1,0"
}
Save the file. Now, the configuration part is over. You just need to reboot your system. If after rebooting your system does not come up with the loopback device, just load the module again. Now to access the sound on the other device, log into it (or ssh into it from the source machine) and run this command.
ssh -C streamer_username@lan.ip.of.streamer sox -q -t alsa loop -t wav -b 24 -r 48k - | play -q -
This basically will, log in from the laptop that is connected to the sound system to my workspace machine and create a stream file that will be fed back to it via ssh. Then that stream file will be played out on that machine. Neat right?
Afterwards when you are playing something, just run the command
pavucontrol
And from the list of running sound feeds, redirect anyone (or all, your wish) to the "Loopback Audio" device via the menu on the right.

I researched a lot for this setup. Initially my searches kept telling me that I should use "pulseaudio" to expose sound cards to the network, from which the player machine can pick up it's feed and play it back through the system. That setup worked but had a lot of interceptions in the output. The problem might have been of pulseaudio alone. I had almost lost hope but I accidentally stumbled upon these two tutorials that saved me. Thanks a lot to them
http://ywwg.com/wordpress/?cat=13
http://plasmasturm.org/log/soundserverhack/
Both of them are amazing write ups.
Gotchas
Even though this system works flawlessly in quality of output, but it has a huge disadvantage of using up many resources and having a huge sync flaw with videos. But I resolved it by using VLC to adjust it, via the J and K keys.

Wednesday, July 24, 2013

[Ubuntu] How to fix dependency problems

This is not a very generic method to solve dependency hells but in many obvious cases this is a very good one. It solved one of my problems with some components of "MySQL" being replaced / removed by some mysterious force. I'll pick the scenario here and try to draw a picture on the approach. The solution is based on the askUbuntu answer here [ http://askubuntu.com/questions/227978/problem-after-mysql-server-installation-i-cant-install-any-thing-in-ubuntu-12-04/228450#228450 ]

The problem: I was trying to access a web app that I was working on inside my 'localhost', but for some reason the mysql components were not functioning properly.
The server configuration: Apache2, PHP5, MySQL. The server was setup using 'Automatic virtual hosting' method.
The packages used were installed using:
apt-get install ia32-libs-multiarch build-essential ncurses-term g++ mc lfm unrar firefox apache2 apache2-doc apache2-suexec git zsh vim aria2 awesome curl chromium-browser mpd ncmpcpp git conky pcregrep unagi mysql-server libapache2-mod-auth-mysql php5-mysql php5 php-pear php5-sqlite php5-curl php5-imap php5-intl php5-mysql phpmyadmin openssh-server php5-mcrypt 
It's the full string from my server setup script, you can see the apache, php and mysql packages being used in the list.
How did I find the cause: I tried the package installation script again and it threw these errors
The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
 php5-curl : Depends: php5-common (= 5.4.9-4ubuntu2) but 5.4.9-4ubuntu2.1 is to be installed
 php5-mysql : Depends: php5-common (= 5.4.9-4ubuntu2) but 5.4.9-4ubuntu2.1 is to be installed
E: Unable to correct problems, you have held broken packages.
Then I Googled the first line (mysql) and found the askUbuntu answer page.
This indicated the cause to be a recent addition of and external repo into my repo list.
How did I fix the problem : I first removed repos that were added by me from Synaptic > Other softwares. [ Open Synaptic and then untick repos from "Other software" tab
First I executed the commands
sudo apt-get -f remove mysql-server-core-5.5 mysql-server-5.5 mysql-server-5.5 mysql-server
sudo apt-get -f remove php5-curl
sudo apt-get -f remove php5-common
Then executed the installation commands again and the problem was fixed.

Saturday, January 26, 2013

[Linux/Ubuntu][Fix] MATLAB on an NTFS Partition

To start with, I was in a huge mess yesterday because today was my Image Processing exam and all of a sudden, MATLAB wasn't working on my computer (Linux Mint). Apart from installing in a Windows partition, everything was exactly the same as the last one and I didn't have a Windows version to go to. It started throwing all sorts of errors related with Java and JVM. 4 hours from the exam I still didn't have any luck, when all of a sudden searching with the Error strings, I hit an Ubuntu forums page describing the same scenario as mine. MATLAB on an NTFS Partition. This was also the first time I used the fstab file in Linux.
Source: [ http://ubuntuforums.org/showthread.php?p=10157469#post10157469 ]
First, Linux cannot change permisssions on a Windows filesystem outside of a mount or through fstab. This is the way it's always been. Second, the default permissions set on mounting NTFS partitions through File Manager has changed since Gutsy which is why it used to work and now it doesn't. You will need to automount your partition by adding a line to fstab so that you can force the permissions you want. The general steps to automount are as follows:
[1] Go back to File Manager and unmount the drive (Or use a command, your choice. Generally I use
sudo umount /media/<partition-name>

[2] Create a permanent mount point for the partition
sudo mkdir /media/NTFS1

[3] Find out how you system sees your partition
sudo blkid -c /dev/null

You'll get something that looks like this:
/dev/sda2: LABEL="WinXP2" UUID="DA9056C19056A3B3" TYPE="ntfs"

[4] Using the info above as an example you would add a line in fstab that looks like this:
/dev/sda2 /media/NTFS1 ntfs defaults 0 0

This might be a bit different for your system. Just open the fstab file using nano, using
sudo nano /etc/fstab

and see how your system lists them. If your system uses UUID, replace the first part with the UUID
UUID=DA9056C19056A3B3 /media/NTFS1 ntfs defaults 0 0

[5] Running the following command will check for errors and mount the partition:
sudo mount -a
That, should do it. Now try running MATLAB. Hopefully there won't be any errors.

Sunday, November 11, 2012

[Ubuntu Linux] Installing a program and making it accessible through CLI and Unity

So, today, I wanted to install a famous text editor called "Sublime Text 2" in my Ubuntu installation. I downloaded the tar file provided by them. Like many programs, I found no installer package or program but just the executables. Yes it was usable but I wanted more. I wanted to call the program with it's name not always navigate to the directory where I downloaded it just to use it. So I found this tutorial here and made it accessible via both Unity Dash and CLI (Terminal). I realized I often fall into this kind of problem when I'm using Ubuntu / Linux in general. So, I decided to write down the things I have to know when I'm doing such a thing.
First of all, you need to move your executables folder to the /usr/lib directory. Suppose you're too installing Sublime Text. You extract it via the tar tool like this.
tar xf Sublime\ Text\ 2\ Build\ 2181\ x64.tar.bz2
Then you get the folder "Sublime Text 2". You move it to the /usr/lib directory using this command.
sudo mv Sublime\ Text\ 2 /usr/lib/
Now you create a Symbolic Link, more like a Command to call the application via command line interface (CLI) using this
sudo ln -s /usr/lib/Sublime\ Text\ 2/sublime_text /usr/bin/sublime
Now create a launcher (icon you search for using HUD)
sudo sublime /usr/share/applications/sublime.desktop
Edit that .desktop file (specify what it does) and configure it to run Sublime Text when it's clicked on, paste all this in it, you can even spend time trying to understand it (for future applications)
[Desktop Entry]
Version=1.0
Name=Sublime Text 2
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor

Exec=sublime #The symbolic link
Terminal=false #Don't run it using terminal
Icon=/usr/lib/Sublime Text 2/Icon/48x48/sublime_text.png #Which icon to use
Type=Application #Type type type :P
Categories=TextEditor;IDE;Development #More info
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity
That's it, now you can run the program using terminal (without pointing to where it's stored) and click on a launcher to run it. :)

Connect Rapoo MT750S with Linux (Tested on Manjaro)

 I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...