Tag Archives: linux

How to update ONLY installed apps in Linux?

When I used Ubuntu recently via VirtualBox an Ubuntu update would keep making the system larger. Finally an update would fail since the VM image size would be exceeded. Attempts to prune temp folders did not help or where excruciatingly geeky.

I noticed that the update would be installing things I never used or thought were part of Ubuntu. I don’t use it much, so have not not delved into the intricacies, i.e., end user. So, my question, is Update really an update?

In Cygwin, for example, when you do an update, you can pick a view, New, Updates, etc. I did not find this capability in the GUI update app. It must be there, it’s supposed to be so much better than Windoze. 🙂

I searched the web for an answer, btw. Look, end-users don’t want to do apt-get and other geek fantasmisms, besides, a lot of the pages I found confuse update of apps with update of the system.

When time allows will give more info as to what I used and some of the things that were being updated.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Use SED or Groovy to print paths, split with line feeds

Yea, this is easy, IF you use SED much. Now I updated this post with a Groovy approach, since this is easier to install where cygwin may be prohibited.

Using SED
With cygwin installed, SED, the stream editor is available. In a command shell, execute:

set path | sed s_;_;\n_g

Update: fixed the sed above, was missing the backslash before the n.

Explanation

  1. set path will print the Windows path. File path entries are separated by “;”.
  2. sed will invoke the cygwin installed linux SED command. Cygwin\bin is part of the executable path.
  3. “s” indicates the substitute command
  4. “_”, the underscore is used as the delimiter to each part of the substitution. One can use other characters for the delimiter.
  5. “;” is the regular expression to use for a match.
  6. “;\n” is the string to substitute with. \n is the crlf.
  7. “g” is the substitute flag, global replacement

No doubt there are more direct ways of doing this. Using PowerShell would be the most appropriate on Windows if it is available.

Using Groovy
Another approach is using the Groovy language, which has a command line mode using the “-e” switch:

set path | groovy -e "System.in.text.split(';').each{ println it}"

Explanation
The output of set path is piped to an inline Groovy script. The script uses the “text” value of the System.in standard input stream. ‘text’ is some magic Groovy dust. The Groovy development kit (GDK) extends Java io streams with a method, textO(), that gets the string value of the stream, like read a file. This is available as a java bean getter method, which again via magic is available as a field, “.text”. The string is then split, then a closure “each” is used to print each line, passed to the closure with the default variable “it”.

Example
If your path is: C:\fee;d:\fi;c:\foo;fum

The result would be:
C:\fee;
d:\fi;
c:\foo;
fum

You can, of course, pipe these together to allow finer control. However, the high level language makes for very long winded code, for example, find all properties in Java system properties that have the word ‘Java’ or ‘java’:

groovy -e "System.properties.each{println it}" | groovy -e "System.in.eachLine{ if(it.find('[jJ]ava')) println it}"

Better would be, just putting the filtering inside the closure:

groovy -e "System.properties.each{ if(it.key.find('[jJ]ava')) println it}"

Or as a script:

System.properties.each{ 
     if(it.key.find('[jJ]ava')){ 
        println it
     }
}

Consult the Groovy documentation for further Groovy syntax and idioms to make the above even better.

References

  1. GNU sed
  2. Sed – An Introduction and Tutorial by Bruce Barnett
  3. SED, stream editor
  4. PLEAC-Groovy
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Ubuntu 10.10 update in VirtualBox, no gui.

I’ve been running Ubuntu Linux 10.03 on a VirtualBox VM with the Windows 7 host PC. Works fine. Updated to Ubuntu 10.10 – the Maverick Meekat, restarted the system, and now it comes up in console mode and asks for a user/pass. I give it what I have, and it doesn’t accept it. Hosed. Gee ain’t Linux grand.

Hmmm. Let me try again. Ah, it accepted another username/password, which is not the one in my Keepass database, now that needs maintenance.

GUI

But, now how do I get the Ubuntu gui back. Tried to reinstall the Guest Additions. Nope, even though I do the Devices->Install Guest Additions, I don’t see the CD in /media/cdrom folder.

At the end of this blog post the author has:

The Unixmen’s site has a workaround to the X Window issue. Run the following commands:

sudo apt-get update

sudo apt-get install build-essential linux-headers-$(uname -r)

sudo apt-get install virtualbox-ose-guest-x11

I was prompted whether or not I wanted to keep my current configuration file or replace it, I chose to keep it.

Once the last command finishes reboot the virtual machine. The display can then be resized.

It works! Ubuntu is back to normal.

Incidentally, I also had to remove etckeeper. Its been giving some trouble for a while now.

Update:
11Oct10: Oracle just released VirtualBox 3.2.10, that probably fixes this issue.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Rhythmbox on Ubuntu 10.04 won’t play mp3 on NAS

Ah the complexity of computing, no wonder most people only just play games on FaceBook.

Below I describe a problem playing MP3s on a network resource.  I don’t have a solution yet.  And have not at this time (4/24/2010) investigated further.

I installed Ubuntu 10.04 LTS Lucid Lynx in VirtualBox 3.2.2 hosted on Windows 7 Professional 64bit. Rythmbox (the default music software) ver 0.12.8 will play mp3 on the VM’s local file system. However, it won’t play mp3s that are stored on my Networked Attached Storage (NAS), an ancient ReadyNAS (now NetGear) X6 model.

Some observations:

  • If I copy an mp3 from the NAS to the file system, it plays.
  • I can play the same mp3 on the NAS using the Totem Movie Player 2.30.2.

What it could be?

  • Not an access control, since the movie player can play them.
  • Rythmbox has the correct plug-ins, since it can play mp3.
  • It is buggy or some subtle configuration is incorrect when accessing mp3 via network?

Some links
Re: Ubuntu 10.04 – Rhythmbox not working: http://ubuntuforums.org/showthread.php?p=9311110

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.