Entries Tagged as 'Werkzeuge'

Replacing indicator-multiload with system-monitor in Ubuntu 18.04

Recently the 18.04.1 point release of Ubuntu came out and I finally started upgrading my desktops & laptops to it from my 16.04 LTS installations. As usual, the upgrade went smoothly, but as can be expected with the switch from Unity to Gnome, the UI has changed dramatically.

Unfortunately, while the indicator-multiload still is getting displayed, changing its settings doesn’t seem to work any more and it is so small that it becomes unreadable. I did find a replacement in the form of the system-monitor widget for the Gnome shell. To install it you need to install the following prerequisites:

  1. chrome-gnome-shell is the user space component to install Gnome shell extensions
  2. gir1.2-gtop-2.0, gir1.2-networkmanager-1.0 and gir1.2-clutter-1.0 are libraries required for this particular widget
  3. The Firefox extension GNOME Shell integration allows you to install the widget from the comfort of your browser. There is a similar extension for Chrome(ium).

To install all the components and uninstall indicator-multiload in a terminal session, use:

sudo apt install chrome-gnome-shell gir1.2-gtop-2.0 gir1.2-networkmanager-1.0 gir1.2-clutter-1.0
sudo apt purge indicator-multiload

Finally you can navigate in your browser to the GNOME Shell Extensions page and enable the widget (or disable it again, if you don’t like it after all).

Some other nitpicks I had with the upgrade to Ubuntu 18.04, while we are on the topic:

  • The window controls (minimize/maximize/close) are back to the right side. It took me a long time to adjust to the MacOS-style left hand window controls back in 2008 and now we move back to the right. I will suffer for a while, but hope to be happier long-term, if most of the GUIs I encounter follow the same standard. Of course in my day job as of 2016 I am now using a MacOS device… 😕
  • The boot-up time significantly increased: On one of my last HDD equipped desktops from under 30s to about 2 minutes and on my fastest SSD laptop from 5s to about 30s. 😥

Outgoing IPs & Ports for WordPress

I recently locked down all outgoing connections from my DMZ to the internet and now have to open things explicitly in my packet filter. For wordpress I did not find any documentation on that, so here are my findings to be able to update plugins and themes (I don’t care about the RSS feed on the dashboard):

IP Port(s) Description
198.143.164.250 80 (HTTP) & 443 (HTTPS) downloads.wordpress.org
198.143.164.251 80 (HTTP) & 443 (HTTPS) api.wordpress.org
192.0.96.247 80 (HTTP) & 443 (HTTPS) api.akismet.com
192.0.96.248 80 (HTTP) & 443 (HTTPS) api.akismet.com

How to make your Unix prompts more useful

Thanks Sandra!

A customized prompt can serve as a gentle reminder of what system you’re working on — especially helpful if you often find yourself logged into 3-4 systems at a time, window hopping to get several things done at the same time. or if you log in with different accounts. A customized prompt can help if you like to be reminded where you are sitting in the file system or prefer *not* to be reminded where you are in the file system (a full path can take up quite a bit of screen space when you’re seven levels deep into /home/username/apps/docs/…).

All you need to do to define your PS1 variable and save it in your .bashrc or .bash_profile file. As it turns out, however, you have a lot of flexibility on what you put into that prompt.

[…] Set your prompt to the current time. […]

$ PS1="\A> "
20:52>
PS1="\t> "
20:50:13>

NOTE: The > at the end of these prompts and the blank that follows are optional, but my preference. I like these characters separating my prompts from my commands.

Have trouble remembering what system you’re logged into?

$ PS1='\h> '
boson>

[…] If you can’t remember where you are, the w setting will show your path relative to your home directory. The ~, of course, is your home itself.

PS1='\w '
~

When you need some cheering up:

$ PS1=':-) '
:-)

When you have amnesia or just want to be reminded what account you’re logged into:

PS1="\u> "
lmoore>

You can expand this to show both the username and system name like this:

PS1=”\u@\h ”

$ PS1="\u@\h> "
lmoore@boson>

Any of the following can be use din your prompt, though I suspect that few of us will hear the bell even if we use that character string in our prompts.

\a     an ASCII bell character (07)
\d     the date  in  "Weekday  Month  Date"  format (e.g.,
       "Tue May 26")
\e     an ASCII escape character (033)
\h     the hostname up to the first `.'
\H     the hostname
\j     the  number of jobs currently managed by the shell
\l     the basename of the shell's terminal  device name
\n     newline
\r     carriage return
\s     the  name  of  the shell, the basename of $0 (the
       portion following the final slash)
\t     the current time in 24-hour HH:MM:SS format
\T     the current time in 12-hour HH:MM:SS format
\@     the current time in 12-hour am/pm format
\u     the username of the current user
\v     the version of bash (e.g., 2.00)
\V     the release of bash,  version  +  patch level (e.g.,
       2.00.0)
\w     the current working directory
\W     the  basename  of the current working directory
\!     the history number of this command
\#     the command number of this command
\$     if the effective UID is 0, a #, otherwise a $
\nnn   the  character  corresponding  to  the octal number nnn
\\     a backslash
\[     begin a sequence of non-printing characters, which could
       be used to embed a terminal control
       sequence into the prompt
\]     end a sequence of non-printing characters

Missing locales on remote system

Since this is now the third time I ran into this issue and it always mislead me in a completely wrong direction, I’ll finally document it.

So, you are SSH-ing into a remote system (typically Debian or a derivative), then you you install a package or do something else that triggers some access to the locales (UNIX style localization for shell commands etc.) and you see messages similar like this:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "de_CH.UTF-8",
LC_MONETARY = "de_CH.UTF-8",
LC_ADDRESS = "de_CH.UTF-8",
LC_TELEPHONE = "de_CH.UTF-8",
LC_NAME = "de_CH.UTF-8",
LC_MEASUREMENT = "de_CH.UTF-8",
LC_IDENTIFICATION = "de_CH.UTF-8",
LC_NUMERIC = "de_CH.UTF-8",
LC_PAPER = "de_CH.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory

You might assume that you did not install all the required locales. In the example above I saw these settings of de_CH.UTF-8 on an english only system. So you could generate/install the missing languages i.e. with “dpkg-reconfigure locales“. But note the mentions of “(unset)” above. Even with all the required locales you still will see these messages.

So, what is the cause of this mess? Nothing is wrong with your server. The actual culprit is a misconfiguration on the host you are running the SSH session from. It has these settings and newer SSH clients provide the comfort functions of exposing your local locale settings to the remote system.

In an ideal scenario this allows you to talk to your server in your native language. Unfortunately some newer linux distributions like Ubuntu starting from 12.04 (it has also been reported on MacOS X) don’t set all of these variables leading to these warnings on system that want these to be set.

TL;DR: The quick solution is to comment the setting in your /etc/ssh/ssh_config file that causes the exposure of these environment variables to your server:

# SendEnv LANG LC_*

Pakete verwalten mit aptitude auf Debian-basierten Systemen

Ein Freund hat mich vor Kurzem um Rat gefragt, da er eine Installation eines Ubuntu-Ablegers für ein Resourcen-armes System zurechtstutzen wollte und ihm dabei die Abhängigkeiten der Pakete in den Weg kamen. Ich arbeite meist mit aptitude auf Debian-basierten Systemen, komme daher mit diesem Werkzeug am besten zurecht um solche Abhängigkeits-Probleme zu lösen und habe ihm einige Tips dazu gesendet: [Read more →]

Debian on the SGI O2

Yet another post on the net about installing Debian on the SGI O2. Mine is a bit on the lower end, it runs with only 64 MiB RAM on an R5000 CPU. I’m still pretty amazed by the EFI-like BIOS with mouse support. That is pretty advanced for a machine from 1996!

But back to topic: Most tutorials and tips about installing Debian on an O2 that you find online are a bit dated by now. Also, most of those sites link to a tutorial by Jiann-Ming Su, which is offline by now. Thanks to the Internet Archives WayBackMachine I was still able to retrieve it:

Installing Debian on SGI O2 by Jiann-Ming Su

Thank you, Su, Martin, Jon and all those other friendly folks for your documentations!

Convert a UNIX timestamp into a date

Was just googling for a fast way to convert a timestamp into a date without having to leave the shell (yes, I’m lazy 😉 ) and thanks to Anton found some solutions:
clipped from anton.lr2.com

BASH: Convert Unix Timestamp to a Date

Awk has a wrapper for the standard C strftime function:
echo $EPOCH|awk ‘{print strftime(”%c”,$1)}’
[UPDATE]
# date -d @1000000042
Sun Sep  9 01:47:22 GMT 2001
But this only works on newer versions of date.  It fails on my FC2 server and my Debian Sarge machine, but works fine on Ubuntu Feisty and Debian Etch.

Printing dd status

clipped from prefetch.net
The dd utility doesn’t report status information by default, but when fed a SIGUSR1 signal it will dump the status of the current operation:
$ dd if=/dev/zero of=/dev/hda1 bs=512 &
$ kill -SIGUSR1 1749
1038465+0 records in
1038465+0 records out
531694080 bytes (532 MB) copied, 11.6338 seconds, 45.7 MB/s

RRDs are architecture dependent

When migrating our old monitoring server (x86), running munin and smokeping, to our new virtualized platform (x86_64), I ran into a problem. After copying the RRD-files to the new system I did not get nice graphs, but instead the error message “This RRD was created on another architecture” in the logs. After searching around in the ‘net I found the solution in a forum post which worked for me:
clipped from rrd-mailinglists.937164.n2.nabble.com

How do I move my rrds to my new MRTG system.

I dont know if rrdtool has a option for doing it recursivly,

but something like this should do it if the filenames stay the same:
for i in *.rrd; do rrdtool dump $i > `basename $i .rrd`.xml; done
for i in *.xml; do rrdtool restore $i `basename $i .xml`.rrd; done
HTH
Matthias.Merk

Less is more: the hidden treasure of less command

Wow, I just stumbled over less’ PDF display capability and found this blog post with even more awsome features of less:
clipped from www.cyberciti.biz

Less is more: the hidden treasure of less command
# less +53 /etc/httpd/httpd.conf
Ok let us display an error at line number 53 (no need to scroll down all 52 lines)
Search and highlight particular text:
# less "+/*VirtualHost" /etc/httpd/httpd.conf
lessfile and lesspipe are programs that can be used to modify the way the contents of a file are displayed in less. What this means is that less can automatically open up tar files, uncompress gzipped files, and even display something reasonable for graphics files.
less command supports following extensions:

  • *.arj

  • *.tar.bz2

  • *.bz

  • *.deb, *.udeb

  • *.bz2

  • *.doc

  • *.gif, *.jpeg, *.jpg, *.pcd, *.png, *.tga, *.tiff, *.tif

  • *.lha, *.lzh

  • *.iso, *.raw, *.bin

  • *.pdf

  • *.rar, *.r[0-9][0-9]

  • *.rpm

  • *.tar.gz, *.tgz, *.tar.z, *.tar.dz

  • *.gz, *.z, *.dz

  • *.tar

  • *.jar, *.war, *.xpi, *.zip

  • *.zoo
Watch a log file
Watch maillog in real time, useful to troubleshoot mail server problem
less +F /var/log/maillog
less +F /var/log/message
You can also use tail command:
tail -f /var/log/maillog