Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, March 27, 2021

BASH tricks with strings

I've been trying to leave Bash Scripting for a long time, favoring Python scripting. But when I guess I can't go further with Bash scripting, it just brings me something cool and new!

I must accept ICMP from a few OVH IPs, and among them are 2 IPs from my server network, where the last octet will be 250 and 251. To make it easier to understand, suppose that my server IP is a.b.c.d. So I must ACCEPT ICMPs from a.b.c.250 and a.b.c.251.

So, this is the amazing solution Bash Scripting offers me:

# ==========================================

# Dedicated Server IP external interface

IF_EXT="enp2s0"    # define here your external interface, such as eth0, vmbr0, etc

IP_EXT=$(ip -4 a|grep "${IF_EXT}$"|awk '{print $2}'|cut -d/ -f1)


# OVH monitoring IPs array

#    Here is the thing: the last item of this array!

IP_MONITORING=(37.187.231.251 151.80.231.244 151.80.231.245 151.80.231.246 151.80.231.247 213.186.33.62 92.222.184.0/24 92.222.185.0/24 92.222.186.0/24 167.114.37.0/24 213.186.45.4 213.251.184.9 37.59.0.235 8.33.137.2 213.186.33.13 213.186.50.98 ${IP_EXT%.*}.25{0,1})


# And finally the iptables command

for i in $(seq 0 $[${#IP_MONITORING[@]}-1]) ; do

        iptables -A INPUT -p icmp -s ${IP_MONITORING[$i]} -d ${IP_EXT} -j ACCEPT

done

# ==========================================


Notes:

- Obviously, you must run this script as root!

- I know Python would do it too. What I didn't know is that Bash could carry it out so "gracefully"!!

- I welcome any suggestion that may improve this code!!!


I hope it can help somebody out there. If it does, make me aware of it!

Wednesday, December 30, 2020

LVM GUI Tools

LVM is not simple to deal with. And although I do believe that I must know how to deal with it by using CLI environment, it's always a good thing to know how to use some LVM GUI tools. This article presents some good ones. Just remember: first and foremost, you must understand how it works under the hoods, and then dare to test some of these good tools.

Read the article at https://www.linuxjournal.com/content/review-gui-lvm-tools

bpytop – Awesome Linux, macOS and FreeBSD resource monitor

It is always a good idea to keep a resource monitor open. HTop has been my pet for years. But now, I guess it is time to change. 

BPyTop is an awesome alternative, lightweight, and fully featured. Excellent job, written in Python. After that, I haven't seen my Htop interface for days! Read this concise article, and give BPyTop a try, if you haven't already!

Read more here: https://www.cyberciti.biz/open-source/command-line-hacks/bpytop-awesome-linux-macos-and-freebsd-resource-monitor/

Monday, December 14, 2020

Are Linux Smartphones about to KILL Android?

In this video, not only another Linux phone will be presented. The author will dive into some questions about privacy and profit. In the end, he will think about Linux as a good option for mobiles.

Worthy a peek!

Are Linux Smartphones about to KILL Android? 

Monday, December 7, 2020

Microsoft Defender for Linux adds new security feature

Microsoft's server-based Linux protection program is now offering a public preview of improved endpoint detection and response features.

I know it's still hard for some of you to wrap your minds around it, but Microsoft really does support Linux these days. A case in point: Back in June, Microsoft released Microsoft Defender Advanced Threat Protection (ATP) for Linux for general use. Now, Microsoft has improved the Linux version of Defender, by adding a public preview of endpoint detection and response (EDR) capabilities.

This is still not a version of Microsoft Defender you can run on a standalone Linux desktop. Its primary job remains to protect Linux servers from server and network threats. If you want protection for your standalone desktop, use such programs as ClamAV or Sophos Antivirus for Linux.

For businesses, though, with workers from home now using their Macs and Windows PCs here, there, and everywhere, it's a different story. While based on Linux servers, you'll be able to use it to protect PCs running macOS, Windows 8.1, and Windows 10. 

With these new EDR capabilities, Linux Defender users can detect advanced attacks that involve Linux servers, utilize rich experiences, and quickly remediate threats. This builds on the existing preventative antivirus capabilities and centralized reporting available via the Microsoft Defender Security Center. Specifically, it includes:

  • Rich investigation experience, which includes machine timeline, process creation, file creation, network connections, login events, and advanced hunting.
  • Optimized performance-enhanced CPU utilization in compilation procedures and large software deployments.
  • In-context AV detection. Just like with the Windows edition, you'll get insight into where a threat came from and how the malicious process or activity was created.

To run the updated program, you'll need one of the following Linux servers: RHEL 7.2+; CentOS Linux 7.2+; Ubuntu 16.04 or higher LTS; SLES 12+; Debian or higher; or Oracle Linux 7.2.

Next, to try these public preview capabilities, you'll need to turn on the preview features in Microsoft Defender Security Center. Before you do this, make sure you're running version 101.12.99 or higher. You can find out which version you're running with the command: 

mdatp health

You shouldn't switch all your servers running Microsoft Defender for Endpoint on Linux to the preview in any case. Instead, Microsoft recommends you configure only some of your Linux servers to Preview mode, with the following command:

$ sudo mdatp edr early-preview enable 

Once that's done, if you're feeling brave and want to see for yourself if it works, Microsoft is offering a way to run a simulated attack. To do this, follow the steps below to simulate a detection on your Linux server and investigate the case. 

1 - Verify that the onboarded Linux server appears in Microsoft Defender Security Center. If this is the first onboarding of the machine, it can take up to 20 minutes until it appears. 

2 - Download and extract the script file from here aka.ms/LinuxDIY to an onboarded Linux server and run the following command:

./mde_linux_edr_diy.sh

After a few minutes, it should be raised in Microsoft Defender Security Center.

Look at the alert details, machine timeline, and perform your typical investigation steps.


Good luck!  


By Steven J. Vaughan-Nichols for Linux and Open Source | November 17, 2020 -- 21:16 GMT (13:16 PST) | Topic: Security

Source: https://www.zdnet.com/article/microsoft-defender-for-linux-adds-new-security-feature/

Linux 5.10 LTS Debut Expected Next Weekend

Linux 5.10-rc7 Arrives - Linux 5.10 LTS Debut Expected Next Weekend
Written by Michael Larabel in Linux Kernel on 6 December 2020 at 06:00 PM EST. 4 Comments
While for a while the Linux 5.10 development was trending concerningly high on changes late in the cycle, 5.10-rc7 is out today and Linus Torvalds appears comfortable in planning to release the 5.10 kernel next weekend.

Linux 5.10-rc7 is looking "pretty good" and "solidly in the average size department", much to Linus Torvalds delight. There are changes all over from the past week but seemingly nothing too bad.

Thus in the 5.10-rc7 announcement, Torvalds expresses optimism about releasing Linux 5.10 final next weekend rather than a 5.10-rc8 release. That's good news too given the Linux 5.11 merge window immediately opens and it doing so next weekend would at least allow the two-week window to be open ahead of the Christmas and New Year's holidays.

Besides Linux 5.10 being the last kernel release of 2020 and coming with many changes, it's also a notable release for being a Long Term Support (LTS) kernel build to be supported for at least five years.

See our Linux 5.10 feature overview to learn about all the changes and new driver capabilities for ending out the hell of the year that was 2020.
Source: https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.10-rc7-Released

Wednesday, December 21, 2016

Bash Script Check

You like to Bash Script, and would like someone to review your code?

KoalaMan is constantly working on such a project, and it looks to be very good! You just have to paste your Bash Script at the left box and it will be evaluated. Easy like that!

That's my example, a simple BashScript that does nothing. But KoalaMan implemented classic Bash scripting rules to it. Awesome!

This is a "MustHaveInMyList" link: http://www.shellcheck.net/


No automatic alt text available.

Sunday, October 16, 2016

SD Card on Ubuntu 16.04

I have tried to access my pictures on my Ubuntu desktop 16.04, the Xenial Xerus. Did not work! The solution was install some packages that were lacking:

sudo apt-get install exfat-fuse exfat-utils

After that, it still did not work! I should have to do something else manually. Simply restarted and it worked!

Thanks to Ubuntu Geek for this tip!

If this post may be useful to you, please let me know: "Like" it and share it.

Thursday, January 21, 2016

Resizing a bunch of pictures

I want to upload some of my pictures to some social network. But all of them have big resolution, and so will take a long time to upload. Besides, some time I need to save storage space.

Again, I can use Gimp for that. But when you have 200 pics, or even much more Gimp is not a good option. Let's see how we can get this done easily in command line.

You need:
  • The software graphicsmagick installed (sudo aptitude install graphicsmagick)
  • A directory with your original pictures
  • A directory for your signed pictures
For this example, consider that:

  • My pictures are in ~/Pictures/Lake
  • My resized pictures will be at ~/Pictures/Lake/Small 
  • All my original pictures have an extension .jpg.
This task is resolved with this simple CLI instruction:

for i in $(ls ~/Pictures/Lake/*.jpg) ; do echo $i; gm convert -resize 30% "${i}" "$(dirname ${i})/Small/$(basename ${i})" ; done

Note that my result will be pictures 30% of the original, and with the same name. After this, view the results and make the pictures bigger or smaller.

See the results of my example:
Compare the size of both files


If this post may be useful to you, please "Like" it and share it.

Wednesday, January 20, 2016

How to add watermark to a bunch of pictures

Adding a watermark to many pictures using a powerful tool as GIMP may take a long time. Let's see how we can get this done easily in command line.

You need:
  • The software graphicsmagick installed (sudo aptitude install graphicsmagick)
  • Your watermark with transparent background (mine is a PNG image)
  • A directory with your original pictures
  • A directory for your signed pictures
For this example, consider that:

  • My pictures are in ~/Pictures/Lake, my signed pictures will be at ~/Pictures/Lake/Signed and my watermark is ~/Pictures/sign.png.
  • All my original pictures have an extension .jpg.
  • Also, my watermark will be written in lower right corner (SouthEast), but there are more options (NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast).
This task is resolved with this simple CLI instruction:

for i in $(ls ~/Pictures/Lake/*.jpg); do echo ${i}; gm composite -gravity SouthEast ~/Pictures/sign.png ${i} "$(dirname ${i})/Signed/$(basename ${i})"; done

Of course, if your directory is different, you will have to modify the CLI instruction above.

Here is the result:
Without my watermark
With my watermark


If this post may be useful to you, please "Like" it and share it. If people "Like" it, I may show how I did my watermark using Gimp.

Saturday, June 20, 2015

Installing Java 8 in Ubuntu

I have another post here about how to do this. But it is outdated, and I decided to rewrite it.

There are more simple ways to have Java installed on your Linux. But I do prefer do make it step by step, in the command line. Let's suppose that we are installing version 8.45 of Java
  1. Download Java 8 JDK from Oracle. Accept it's License Agreement, and select jdk-8u45-linux-x64.tar.gz to be downloaded, if your system is 64bits or jdk-8u45-linux-i586.tar.gz if it is 32 bits.
    If you are in doubt about your system, you may confirm with the following command:


    uname -m

    If the answer is x86_64, you have a 64 bits Ubuntu. If the answer is  i686, you have a 32 bits Ubuntu.
  2. Create a variable jv that will point to the installation directory of Java. By downloading the jdk-8u45-linux-x64.tar.gz, we will have /usr/lib/jdk1.8.0_45 as the installation directory.
    We need to create another variable ub, that will point to the the system binaries.
    We do that with the following command:

    jv="/usr/lib/jdk1.8.0_45"
    ub="/usr/bin"
    ATTENTION:
    Not only copy and paste above lines.
    Update Java version in variable jv.
     
  3. I usually do not use the previous versions, so I do remove them Since I always install them in /usr/lib, I will remove them with the following command:
    sudo rm -rfv /usr/lib/jdk* /usr/lib/jvm/jdk*
    

    It is important to repeat to the novice: The command above wil permanently delete the contents of
     /usr/lib/ e /usr/lib/jvm/ that start with jdk. Be sure you do not have in there any other files or directories that may be deleted.
    ATTENTION:
    In case you are not sure whether you may delete this files or not, just do not do it.
      
  4. Open the file you have downloaded from Oracle in /usr/lib/:

    sudo tar xf jdk-8u45-linux-x64.tar.gz -C /usr/lib/
  5. Update alternatives system with the binaries of this version of Java:

    sudo update-alternatives --install ${ub}/java java ${jv}/bin/java 1
    sudo update-alternatives --install ${ub}/jcontrol jcontrol ${jv}/bin/jcontrol 1
    sudo update-alternatives --install ${ub}/javac javac ${jv}/bin/javac 1
    sudo update-alternatives --install ${ub}/javaws javaws ${jv}/bin/javaws 1
    sudo update-alternatives --install ${ub}/keytool keytool ${jv}/jre/bin/keytool 1
    sudo update-alternatives --install ${ub}/pack200 pack200 ${jv}/jre/bin/pack200 1
    sudo update-alternatives --install ${ub}/rmid rmid ${jv}/jre/bin/rmid 1
    sudo update-alternatives --install ${ub}/rmiregistry rmiregistry ${jv}/jre/bin/rmiregistry 1
    sudo update-alternatives --install ${ub}/unpack200 unpack200 ${jv}/jre/bin/unpack200 1
    sudo update-alternatives --install ${ub}/servertool servertool ${jv}/jre/bin/servertool 1
    sudo update-alternatives --install ${ub}/tnameserv tnameserv ${jv}/jre/bin/tnameserv 1
    sudo update-alternatives --install ${ub}/jexec jexec ${jv}/jre/lib/jexec 1

    The following command only applies to 32 bits desktop systems:

    sudo update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so ${jv}/jre/lib/i386/libnpjp2.so 1

    The following command only applies to 64 bits desktop systems:

    sudo update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so ${jv}/jre/lib/amd64/libnpjp2.so 1
     
  6. In case of having more than one Java version installed, only one will be the default version. The following command will perform this action:

    for i in keytool jcontrol pack200 rmid rmiregistry unpack200 servertool tnameserv jexec java javac mozilla-javaplugin.so javaws; do sudo update-alternatives --config ${i}; echo; done

    The above instruction will list all available versions of each binary, if they exist. Choose those listed in step 2. If not, you will obviously have nothing to choose.
After that, we should test the installation to confirm that it is all ok:
java -version
javac -version
Now, we need to set the environment variables correctly. I adapted it from WikiHow. You must edit /etc/profile, adding the following lines by the end of it:
# Environment Java Variables defined IF Java is listed in "alternatives"
if [ -h /etc/alternatives/java ]; then
     a=$(/bin/ls -l /etc/alternatives/java | cut -d \> -f2|cut -d' ' -f2)
     export JAVA_HOME=${a%/bin/java}
     export PATH=${PATH}:${JAVA_HOME}/bin
fi
After editing /etc/profile, we need to close this user section and open it again. Finally, to check it use the following commands:
echo $JAVA_HOME
You will have /usr/lib/jdk1.8.0_45 as answer, according to the version you installed.
echo $PATH
Will give you the whole PATH, and by the end the Java directory. On mine the answer was /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jdk1.8.0_45/bin


Most of this article was written after studying Ubuntu Documentation and resolving some problems on Tomcat7 instalation at a Ubuntu Server.

If you liked it, please write a comment or click on "+1" button.

Saturday, March 30, 2013

Ubuntu MD5SUM Hashes

Have you ever needed to check MD5SUM hashes of any downloaded file? Ubuntu ISOs can always be checked here:
https://help.ubuntu.com/community/UbuntuHashes
After downloading your ISO file, you should always check it's MD5 hash:

$ md5sum Documentos/ISOs/lubuntu-12.10-desktop-*
bddb521817360540c0e54616427c003e  lubuntu-12.10-desktop-amd64.iso
a7fed6c40b4969d4a3c9c0a9ee228cf2  lubuntu-12.10-desktop-i386.iso
You can read the lines above as follows:
1) MD5 hash for lubuntu-12.10-desktop-amd64.iso is bddb521817360540c0e54616427c003e
2) MD5 hash for lubuntu-12.10-desktop-i386.iso is a7fed6c40b4969d4a3c9c0a9ee228cf2

With both hashes, access the page mentioned above and search for the name of ISO file. If the hash from the page is EXACTLY the same you got, so the file is okay, and you can make the correct use of it.

Make me know if it was somehow useful for you!

Monday, March 4, 2013

Manual instalation of Oracle Java on Ubuntu

This is the English version of this article of mine.

I had some versions of Java JDK installed in my Ubuntu Server 10.04, and I needed to install a new version (7u15). Here how I did it, trying to go straight to the point. This works for every Ubuntu (Desktop or Server) up to 12.10 (Quantal Quetzal).

  1. This is my crowded JVM directory:

    $ ls -lh /usr/lib/jvm/

    total 12K
    lrwxrwxrwx 1 root root   21 2012-05-27 20:19 java -> /usr/lib/jvm/jdk1.7.0_15
    drwxr-xr-x 4 root root 4,0K 2012-07-16 21:19 java-1.5.0-gcj-4.4
    drwxr-xr-x 8 root root 4,0K 2012-07-26 11:17 java-7-oracle
    drwxr-xr-x 8  500  143 4,0K 2013-02-15 18:21 jdk1.7.0_15


     
  2. I do not want a messy system. So I wiped it all up.

    $ sudo rm /usr/lib/jvm/j*
     
  3. Download Java JDK from Oracle. Today, this is the correct link for it. Choose the .tar.gz version. I downloaded both architecture versions:
    1. jdk-7u15-linux-i586.tar.gz
    2. jdk-7u15-linux-x64.tar.gz
  4.  Unpack the tar file to the correct directory, which is /usr/lib/jvm/. If this does not exist, create it.

    $ sudo tar xf jdk-7u15-linux-x64.tar.gz -C /usr/lib/jvm/
     
  5. Make each binary of ths new version of Java visible to Alternatives system:

    $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_15/bin/java" 1

    $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_15/bin/javac" 1

    $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_15/bin/javaws" 1

    This is for 32bits systems:
    $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/
    jdk1.7.0_15/jre/lib/i386/libnpjp2.so" 1

    This is for 64bits systems:

    $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/
    jdk1.7.0_15/jre/lib/amd64/libnpjp2.so" 1
  6. Choose each one of the binaries correctly:

     $ sudo update-alternatives --config java
     $ sudo update-alternatives --config javac
     $ sudo update-alternatives --config mozilla-javaplugin.so
     $ sudo update-alternatives --config javaws

This last step will list the versions available, if any. Choose the one from /usr/lib/jvm/jdk1.7.0_15, for this example.


After that, you just need to test the version. Do this for each one of the binaries:
$ java -version  
$ javac -version
This article was built upon Ubuntu Documentation.

Tuesday, November 6, 2012

Best tools for Ubuntu 12.10

After installing Ubuntu (starting on 12.10), there are some CLI and GUI tools that must be installed. Here I want to enlist some of them. I will keep this post in constant modification.

Here how to install the CLI tools:
$ sudo apt-get install nmap vim traceroute iptraf iftop ipcalc aptitude rar zip unzip arj htop whois ssh tree smem
There are also some GUI tools really cool:
$ sudo aptitude install k3b vlc audacity easytag wireshar
kazam guvcview ubuntu-restricted-extras
And here is a brief description about each one:
  • nmap - Remote Host Scanner
  • vim - Text editor
  • traceroute - Network tracer
  • iptraf - Network monitor
  • iftop - Display bandwidth usage on an interface by host
  • ipcalc - Network Calculations
  • aptitude - Better than apt-get
  • rar, zip, unzip, arj - File compression tools
  • htop - Show process activities
  • whois - Show data about Internet domains
  • ssh - Allows remote connection
  • tree - Shows directory structure with ASCII characters
  • smem - Powerful memory utilzation tool
  • k3b - Excellent CD/DVD burner
  • vlc - Excellent media player
  • easytag - Excellent media tag editor
  • wireshark - Excellent and very complete sniffer, 100% compatible with tcpdump
  • kazam - Make videos from whatever is working on your desktop 
  • guvcview - Webcam software

Some PPAs that I like and recommend:

Ubuntu Tweaks

According to the project in Launchpad, "Ubuntu Tweak is an application which makes configuring Ubuntu easier for everyone. It allows tweaking of many useful desktop and system configuration options which are unavailable via native system tools".

According to Ubuntu Tweaks site, "Ubuntu Tweak is an application designed to config Ubuntu easier for everyone. It provides many useful desktop and system options that the default desktop environment doesn't provide. At present, it's only designed for the Ubuntu GNOME Desktop, and always follows the newest Ubuntu distribution".

To install it, type this in a command line:
sudo add-apt-repository ppa:tualatrix/ppa
sudo aptitude update
sudo aptitude install ubuntu-tweak
For more info, read Web UPD8 site on this subject.

Unity Tweaks

According to it's site, "Ubuntu Tweak is an application designed to config Ubuntu easier for everyone. It provides many useful desktop and system options that the default desktop environment doesn't provide. At present, it's only designed for the Ubuntu GNOME Desktop, and always follows the newest Ubuntu distribution".

To install, type this in a command line:
sudo add-apt-repository ppa:tualatrix/ppa
sudo aptitude update
sudo aptitude install ubuntu-tweak



Monday, October 15, 2012

Installing Acrobat Reader on Ubuntu

Type the following commands:
sudo add-apt-repository "deb http://archive.canonical.com/ [distro] partner"
Where [distro] is, for example, lucid, natty, oneiric, precise, quantal.

This is for command-line options. This and desktop way cand be found here.

Friday, February 4, 2011

Disk full with Squid3

Besides working in an excellent company, I have some networks I help to administer. And recently, one of these friends called me complaining about the internet dropping. Immediately I got a SSH session to his firewall, and started my investigation job.

In fact, SQUID was not working anymore. Starting it was unuseful. Reading it's log gave me the following details:
$ sudo less /var/log/squid3/cache.log


CPU Usage: 0.044 seconds = 0.016 user + 0.028 sys
Maximum Resident Size: 23936 KB
Page faults with physical i/o: 0
2011/02/03 15:16:42| Starting Squid Cache version 3.0.STABLE19 for i486-pc-linux-gnu...
2011/02/03 15:16:42| Process ID 4628
2011/02/03 15:16:42| With 1024 file descriptors available
2011/02/03 15:16:42| Performing DNS Tests...
2011/02/03 15:16:42| Successful DNS name lookup tests...
2011/02/03 15:16:42| DNS Socket created at 0.0.0.0, port 35799, FD 7
2011/02/03 15:16:42| Adding nameserver 192.168.1.9 from squid.conf
2011/02/03 15:16:42| Unlinkd pipe opened on FD 12
2011/02/03 15:16:42| Local cache digest enabled; rebuild/rewrite every 3600/3600 sec
2011/02/03 15:16:42| Swap maxSize 10240000 + 8192 KB, estimated 788322 objects
2011/02/03 15:16:42| Target number of buckets: 39416
2011/02/03 15:16:42| Using 65536 Store buckets
2011/02/03 15:16:42| Max Mem  size: 8192 KB
2011/02/03 15:16:42| Max Swap size: 10240000 KB
2011/02/03 15:16:42| /var/spool/squid3/swap.state.new: (28) No space left on device
FATAL: storeDirOpenTmpSwapLog: Failed to open swap log.
I figured the problem was solved, but surprisingly, space was not the problem, as I could notice:
$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             9,2G  2,0G  6,8G  23% /
none                  434M  208K  433M   1% /dev
none                  438M     0  438M   0% /dev/shm
none                  438M   68K  438M   1% /var/run
none                  438M     0  438M   0% /var/lock
none                  438M     0  438M   0% /lib/init/rw
/dev/sda3              63G   42G   18G  70% /var
After some minutes mulling over this problem, I remembered that not only disk space is defined when a partition is formatted, but also the quantity of free inodes. To inspect this, I used df again:
$ df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda1             610800   70254  540546   12% /
none                  110874     692  110182    1% /dev
none                  111925       1  111924    1% /dev/shm
none                  111925      36  111889    1% /var/run
none                  111925       2  111923    1% /var/lock
none                  111925       1  111924    1% /lib/init/rw
/dev/sda3            4153344 4153344       0  100% /var
The line above means I have no spare inodes, although there is a considerable free space. I have to look for which directory is consuming the inodes, or in other words, crowded with small files. Since I know it is in /var, there is where my search starts:
$ sudo du -s /var/* | sort -n
That will show the "heaviest" directory. In my case, it is /var/lib. So let's start again:
$ sudo du -s /var/lib/* | sort -n
The directory that was released was /var/lib/sarg, with the following files:
$ ls -l /var/lib/sarg/
total 52
drwxr-xr-x   7 root root  4096 2010-04-12 13:40 2010Apr12-2010Apr12
drwxr-xr-x  48 root root  4096 2010-04-15 04:00 2010Apr14-2010Apr14
drwxr-xr-x  45 root root  4096 2010-04-16 04:00 2010Apr15-2010Apr15
drwxr-xr-x  45 root root  4096 2010-04-16 16:45 2010Apr16-2010Apr16
drwxr-xr-x  41 root root  4096 2010-04-19 12:55 2010Apr19-2010Apr19
drwxr-xr-x  98 root root  4096 2010-09-06 14:22 2010Sep01-2010Sep06
drwxr-xr-x 168 root root 12288 2010-09-30 20:01 Daily
drwxr-xr-x   2 root root  4096 2010-04-12 13:40 images
-rw-r--r--   1 root root   780 2010-09-30 20:00 index.html
drwxr-xr-x   8 root root  4096 2010-09-01 02:38 Montly
drwxr-xr-x  49 root root  4096 2010-09-27 01:03 Weekly
Precisely, these are files done in a previous (unsuccessful installation of sarg). I may also notice that it happened almost one year ago. It was my fault to forget removing old useless files. After removing this directory, the inodes were restaured:
$ df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda1             610800   70254  540546   12% /
none                  110874     692  110182    1% /dev
none                  111925       1  111924    1% /dev/shm
none                  111925      37  111888    1% /var/run
none                  111925       2  111923    1% /var/lock
none                  111925       1  111924    1% /lib/init/rw
/dev/sda3            4153344 1922631 2230713   47% /var
After that, squid could be started.

Tuesday, January 25, 2011

Installing a brand new Ubuntu box

I am using a Dell Optiplex 780 as my desktop at my job now, and so I do need my environment back, that means, I have to reinstall Ubuntu.

Got a usb memory prepared to install it, asked Windows 7 to release some space in HD (almost 80% of space, in fact), and started the procedure.

Ubuntu 10.10 up and ready, let's start to make it the best I can, and that's the reason why I wrote this post.

Cleaning old lists
First of all, I need to rebuild the apt lists:
sudo rm -v /var/lib/apt/lists/*
sudo apt-get update
This is only needed because for an unknown reason the original lists has some errors. I am really not aware about these mistakes.

Basic tools

Before starting, I need to prepare my surgery tools:
sudo apt-get install vim aptitude htop ssh k3b ssh ipcalc \
vlc gnome-mplayer compizconfig-settings-manager
\
compiz-fusion-plugins-extra
Compiz Configs
There are some adjustments I always do in Compiz interface. Of course, they are optional:
as_active_plugins = core;ccp;move;resize;place;decoration;gnomecompat;workarounds;neg;vpswitch;text;svg;ring;regex;commands;dbus;session;imgjpeg;mousepoll;shift;png;reflex;resizeinfo;animation;wobbly;fade;cube;rotate;3d;cubeaddon;scale;scaleaddon;expo;ezoom;
as_next_key = Tab
as_prev_key = Tab
as_initiate_key = Disabled
These configurations may be inserted through compizconfig-settings-manager, instead of dealing with configuration files.

Installing Java on Maverick Meercat

I don't know why, but Java is not available from Canonical repositories anymore. I just came over that because I needed to have my job's desktop reinstalled.

So, These are easy and single steps to provide Java-6 and Jetty application service in my Ubuntu server:

$ sudo aptitude install python-software-properties
$ add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo aptitude install sun-java6-jdk sun-java6-jre
$ sudo aptitude install libjetty-extra-java libjetty-java jetty

Working fine now!!!

This was edited after reading http://x4nd3m4c.blogspot.com/2011/02/instalando-o-jetty-no-ubuntu-1004.html. Thanks, Alexandre.

Thursday, October 21, 2010

Kernel vulnerabilities

Some serious vulnerabilities in kernel are forcing an update for Ubuntu Users, since version 6. Before the press start to shout out loads of hyperbolics tales stressing how vulnerable Linux really "is", everybody must know that solutions are ready to be downloaded and applied.

Knowing Ubuntu, desktop users have already been alerted about this update, that must be installed. But for Ubuntu Server administers, it must be manually performed.

What you need to do is:

1) Update your repositories:
$ sudo apt-get update
2) Verify the kernel installed version
$ uname -r
2.6.32-25-generic
My kernel version is generic.

Install the right kernel version and dependencies:
$ sudo apt-get install linux-generic
And reinstall the server.

Empathy does not access MSN

Since yesterday my empathy client does not show my contacts from MSN anymore. It is an empathy problem, and I found the solution (workaround) for this. You can find this in this page, but I will show it here quickly:

If you are in text interface, type the following line:

$ sudo vim /usr/share/pyshared/papyon/service/description/SingleSignOn/RequestMultipleSecurityTokens.py

In graphic interface, press ALT+F2 and type:
gksudo gedit /usr/share/pyshared/papyon/service/description/SingleSignOn/RequestMultipleSecurityTokens.py
Look for this line:

CONTACTS = ("contacts.msn.com", "?fs=1&id=24000&kv=7&rn=93S9SWWw&tw=0&ver=2.1.6000.1")

and change it to

CONTACTS = ("contacts.msn.com", "MBI")

Save the file and restart Empathy. It will now work!