Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Sunday, August 12, 2018

problem with mplayer diacritics

Though not as popular as it used to be, mplayer is very versatile and I like it.
On a certain movie the .srt subtitle was displaying funny characters.
First I added all needed languages in Language Settings and then went into ~/.mplayer/config where I commented the iso8859-1 line and added utf-8. All worked well.

#subcp = iso8859-1 
subcp=utf-8
 
 

Saturday, January 14, 2017

unzip skipping: file.txt `PPMd' method not supported

It seems like unzip does not support 7z, so to decompress such file I had to install p7zip:

$ apt-get install p7zip-full
then
$ 7z x file.zip

Friday, June 03, 2016

transfer/copy database with SSH with only one command line

You can migrate a database using a single command line:

mysqldump –add-drop-table –extended-insert –force –log-error=error.log -uUSER -pPASS OLD_DB_NAME | ssh -C user@newhost "mysql -uUSER -pPASS NEW_DB_NAME"

man: can't set the locale; make sure $LC_* and $LANG are correct

I keep getting this error:
man: can't set the locale; make sure $LC_* and $LANG are correct

I tried locale-gen and many other things, without success.
The only thing that fixed it is: export LC_ALL=en_US.UTF-8 (which of course can be added in .profile to be permanent)

Friday, April 15, 2016

Add Russian charset in Linuxmint/Debian

I opened a console and tried to paste some Russian word but it looked very weird. Then I run: # locale-gen ru_RU.UTF-8 and all works well.

Saturday, March 26, 2016

SSH port forwarding: bind: Cannot assign requested address

While trying to do a simple port forwarding to access a remote mysql server via a secured channel I was getting an annoying bind: Cannot assign requested address.

$ ssh -v user@host.biz -L5555:localhost:3306
debug1: Local forwarding listening on ::1 port 5555.
bind: Cannot assign requested address

So it must be the buggy IPv6, after adding -4, all worked like a charm.

$ ssh -4 -v user@host.biz -L5555:localhost:3306
debug1: Local forwarding listening on 127.0.0.1 port 5555.
debug1: channel 0: new [port listener]

Diacritics in a linux console for pico/nano/etc

I wanted to quickly edit a text file with pico and when I pasted a word, I noticed that all diacritics were replaced with some funny characters. A quick fix was to edit /etc/locale.gen and add my language like pl_PL.UTF-8 UTF-8 for Polish. Then run # locale-gen as root and all was working good. A list with all supported languages can be found in /usr/share/i18n/SUPPORTED

Monday, November 30, 2015

Request exceeded the limit of 10 internal redirects due to probable configuration error.

I upgraded to Apache 2.4.10 and I am getting these errors for sites which used to work:

AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

One strange thing is these happen only with .htaccess files. So if I use exactly the same configuration but written in vhosts config file such as /etc/apache2/sites-enabled/000-default.conf all works well. So yes, one quick fix is to put it there. But after doing some tests, I found out apache 2.4 does not like when you redirect stuff to index.php but you don't have a rule for index.php itsels. So simply keeping all rules and adding something like RewriteRule ^index\.php$ - [L] fixed the problem.

[UPDATE] On many other cases it seems to work without any trouble or extra rule, but on that particular one not... strange.

Sunday, November 29, 2015

kernel: do_IRQ: No irq handler for vector (irq -1)

On a fresh Debian Jessie I kept getting every couple of minutes this error:
do_IRQ: No irq handler for vector (irq -1)
A suggested solution is to add "pci=nomsi,noaer" in /etc/default/grub at GRUB_CMDLINE_LINUX
However,  noaer refers to PCIE Advanced Error Reporting and I don't want only to hide the mess, I want to fix it (if possible).
Only adding pci=nomsi seems to do the trick so far.
Also don't forget to do a update-grub after you edit /etc/default/grub.

Saturday, November 28, 2015

Debian 8 does not execute /etc/rc.local

I have just installed a fresh Debian 8 Jessie and then I put something in /etc/rc.local.
To my suprise, after the reboot, the command did not execute.
Log investigation showed:
Failed to start /etc/rc.local Compatibility.
Failed at step EXEC spawning /etc/rc.local: Exec format error
So I simply added "#!/bin/sh -e" in the first line of rc.local and then it worked well.

Thursday, November 19, 2015

Wednesday, May 15, 2013

dpkg: warning: 'ldconfig' not found in PATH or not executable.

After messing up a little with apt-get, no matter what I did, I was getting this:

dpkg: warning: 'ldconfig' not found in PATH or not executable.

It was not a matter of PATH, because I tried to find ldconfig and it was missing indeed. Here is how I fixed it:

aptitude download libc-bin
dpkg-deb -x libc-bin* libc_unpacked
cp libc_unpacked/sbin/ldconfig* /sbin/


And then everything was back to normal.

Saturday, March 23, 2013

Can't connect to local MySQL server through socket

On Lunarpages I was getting this error while trying to use mysqldump from the shell account:

$ mysqldump -u user -p database > db.sql
Enter password:

mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect

A quick fix I found is to use the --protocol=TCP parameter.

Thursday, August 09, 2012

How to recover Rovio admin password with Linux

  1. Turn off the Rovio
  2. Connect a computer using USB cable with the Rovio
  3. Turn on the Rovio
  4. Look at all devices with something like fdisk -l(you must be root) and locate the Rovio, something like /dev/sdb
  5. Don't try to mount or format it, instead use dd if=/dev/sdb of=/home/user/rovio.dump
  6. Use a hex file editor or simply do strings /home/user/rovio.dump and look at the last 20-30 lines, you should see all the information you need in clear text

Tuesday, April 05, 2011

rtorrent: tracker group list is not a list

It seems like some torrents contain malformed announce-lists making clients which use libtorrent like rtorrent to reject torrent though it is downloadable.

To fix this, either upgrade libtorrent to the latest version or use a hex editor and replace "announce-list" with "xnnounce-list" in the .torrent file.

Monday, April 19, 2010

DOS/Windows End of Line vs Linux EOLN

Working with bash scripts on some text files can be really annoying. Everything seems perfect but you just can't get the desired results.
One common reason for this is the incompatibility of the end of line markers between different operating systems. On Windows there are two characters: '\r\n' and on Linux only one: '\n'. And that extra '\r' can really mess your terminal and your echo outputs. On the other hand, taking a Linux file on a Windows notepad, will display everything on the same line. But don't worry, this can be fixed. If you are on Windows, instead of Notepad try Wordpad or Word and this will eventually display your file correctly.

On Linux, first you should check your file to see what you deal with. You can use hexdump or mc(midnight commander - mcedit).


$ hexdump dos_test.txt -C
[...] 6f 77 73 20 73 74 79 6c |DOS/Windows styl|
[...] 20 4c 69 6e 65 0d 0a |e End Of Line..|

$ hexdump lin_test.txt -C
[...] 75 78 20 73 74 79 6c 65 |Unix/Linux style|
[...] 20 45 4f 4c 4e 0a | EOLN.|


On the first file we have 0d 0a sequence and on the second line only 0a.

To avoid headaches when you use a Windows file with some bash scripts or something similar you need to convert it.

You can use tr:

$ tr -d '\r' inputfile.txt > outputfile.txt

or

$ dos2unix dosfile.txt unixfile.txt

You can also use AWK, PHP, SED to convert files, even ftp.

Sunday, February 14, 2010

Paste into terminal End Of LiNe problem

Sometimes, when you SSH to a Linux box, pasting large amounts of text into a terminal can be problematic.

In pico/nano you will get some auto wrapping that could damage your code or outline your text.

To fix this you can use: nano -w yourfile.txt


-w (--nowrap)
Disable wrapping of long lines.


In vi/vim you can get a "staircase" effect.
To fix this, in command mode, type:

:set paste

to turn it back off:

:set nopaste

Wednesday, February 03, 2010

Include PHP files or code in phpBB HTML templates

Adding php code in your phpBB templates using the classical <?php ?> tags won't work.

To make things possible first go to your Administration Control Panel -> General -> Security Settings and enable Allow php in templates option.

Then you can use the following syntax to add php code:

<!-- PHP --> echo "PHP Code!"; <!-- ENDPHP -->

To include php files:

<!-- PHP --> include("/path/to/file.php"); <!-- ENDPHP -->


Saturday, March 14, 2009

SSH brute force attack

Recently I bought a dedicated server. One of the provider's admin, which installed the system added an account called "admin1". First I wanted to remove it, but I thought it may be used for some checks and I let it stay. One month later there was some activity on that account from an IP in a "strange" country let's say. I asked the provider about it and they had no idea.
Luckily the box was not compromised since the user didn't got any root access, I killed his processes and removed the account, but I still needed an answer for this mess.
And here it was, after some hundreds sshd[3157]: (pam_unix) authentication failure; there was one sshd[12358]: Accepted password for admin1 from X.X.X.X

A classical brute force attack on a weak password, so make sure you change every password when you buy a new dedicated server.
And to be even safer, put the SSHD on some other port and add some iptables rules to deny ssh access for other IPs than yours.