You need to be Payday Loans UK Why would you

subsystem request for sftp

When I try to connect by FileZilla to server I get error:
Nov 28 08:25:51 server01 sshd[19577]: Accepted password for root from port 55070 ssh2
Nov 28 08:25:51 server01 sshd[19577]: subsystem request for sftp
Nov 28 08:25:51 server01 sshd[19577]: error: subsystem: cannot stat /usr/libexec/sftp-server: No such file or directory
Nov 28 08:25:51 server01 sshd[19577]: subsystem request for sftp failed, subsystem not found

But it is fine to connect via usual ssh connection.

This is easy to fix by creating symbolic link to correct place.
Please find this by locate command :

root@server01 ~]# locate sftp-server

and them make link:

ln -s /usr/libexec/openssh/sftp-server /usr/libexec/sftp-server

1030 – Got error -1 from storage engine

I am using on one project InnoDB type of tables. There is very important have actual data. So I am actively using foreign keys for tables linking. And once I came across problem when tried to delete from table (`group`) which linked by foreign key with another table (`subgroup`) which linked by foreign key with another table (`item`).
This is error shown by phpmyadmin:
SQL query:
DELETE FROM `fancypets`.`groups` WHERE `groups`.`group_id` =1
MySQL said: Documentation
#1030 - Got error -1 from storage engine

this error a got through mysql command line:

mysql> delete from groups where `group_id`=4;
ERROR 1030 (HY000): Got error -1 from storage engine

It is mysql’s error log:

Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 250
If you use 5.1.51- Just update your mysql-server version.
This is bug of mysql-server-5.1.51 – after:
#portupgrade mysql-server

problem disappeared.

Installation Redmine on FreeBSD

Perhaps you know redmine ported in FreeBSD and first of all I tried to install it:

#cd /usr/ports/www/redmine
===> redmine-1.2.1_1 is marked as broken: Does not work with RubyGems 1.8.
*** Error code 1

Stop in /usr/ports/www/redmine.

Sure. You wouldn’t read this post if process had been done successfully ;)
Maintainer of this port marked this port as broken because of bug in Gem 1.8.

As result we have to install it manually. Hopefully we have official installation guide.

I came across with some problems during installation. So, this post will be a guide adapted for FreeBSD with some errors and solutions.
Hope it will be useful. It seems as long process, but really easy. Let’s start.

1) Get Redmine (I used svn for it):

#svn co redmine-1.2

2) Create database:
mysql -uuser -ppasword
mysql> create database redmine character set utf8;
mysql> create user 'redmine'@'localhost' identified by 'passforuser';
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';

3) Database configuration (copy from config/database.yml.example). config/database.yml:

adapter: mysql
database: redmine
host: localhost
username: redmine
password: passforuser

4)Generate a session store secret.
#rake generate_session_store
Missing the i18n 0.4.2 gem. Please `gem install -v=0.4.2 i18n`

At this place started problems. Don’t worry. Just do thing redmine suggests.

#gem install -v=0.4.2 i18n
Fetching: i18n-0.4.2.gem (100%)
Successfully installed i18n-0.4.2
1 gem installed
Installing ri documentation for i18n-0.4.2...
Installing RDoc documentation for i18n-0.4.2...

trying again:

#rake generate_session_store
Missing the Rails 2.3.11 gem. Please `gem install -v=2.3.11 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

I tried update RAILS_GEM_VERSION (on 3.0.5) but Redmine doesn’t work with 3.0.5 yet, so:

# gem install -v=2.3.11 rails

then again:
# rake generate_session_store
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [args] => [deps]' instead.
at /vol1/www/www.slim/httdocs/redmine/redmine-1.2/lib/tasks/email.rake:170

Googled the problem and found out it connected with rake version (need to downgrade):

# gem install -v=0.8.7 rake
Fetching: rake-0.8.7.gem (100%)
Successfully installed rake-0.8.7
1 gem installed
Installing ri documentation for rake-0.8.7...
Installing RDoc documentation for rake-0.8.7...

# gem uninstall -v=0.9.2 rake
Successfully uninstalled rake-0.9.2

finally it done:
# rake generate_session_store
(in /vol1/www/www.slim/httdocs/redmine/redmine-1.2)

5) Database migration:
# rake db:migrate RAILS_ENV=production
(in /vol1/www/www.slim/httdocs/redmine/redmine-1.2)
rake aborted!
syntax error on line 8, col 2: ` encoding: utf8'

(See full trace by running task with --trace)

Problem was – I missed space in config/database.yml before the password.

# rake db:migrate RAILS_ENV=production
(in /vol1/www/www.slim/httdocs/redmine/redmine-1.2)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql

installing gem mysql:
howtobsd# gem install mysql

and then:
howtobsd# rake db:migrate RAILS_ENV=production

db migration done!

6) Load default data (recommended):
# rake redmine:load_default_data RAILS_ENV=production
(in /vol1/www/www.slim/httdocs/redmine/redmine-1.2)

Select language: bg, bs, ca, cs, da, de, el, en, en-GB, es, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en]

Choose language and moving ahead.

7)According to manual set permissions (create required folders if it doesn’t exist):

chown -R username:username files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets

8) Test installation:
#ruby script/server webrick -e production
=> Booting WEBrick
=> Rails 2.3.11 application starting on

now you can enter in your browser http://localhost:3000

* login: admin
* password: admin

Great! It is works!

9) We only need to configure Apache for redmine.
It is described in my article “Installing Ruby on Rails on FreeBSD” with differences in httpd.conf for new versions.
Now for me it:
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.5/ext/apache2/
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.5
PassengerRuby /usr/local/bin/ruby18

10)My example of virtual host for redmine:
<VirtualHost *:80>
DocumentRoot /vol1/www/www.slim/httdocs/redmine/redmine-1.2/public/
RailsEnv production
ErrorLog /vol1/www/www.slim/httdocs/redmine/redmine-1.2/log/httpd.log

That’s all!

HTC Wildfire freebsd

This post describes how to mount htc wildfire flash disk on FreeBSD.
Actually it is not especially trick for HTC Wildfire and solution will be the same for mounting another flash disks which are not mounting automatically.
Take a look at dmesg:
howtobsd# dmesg -a | tail
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: Removable Direct Access SCSI-2 device
da0: 40.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present

make next command to find out name of partition of our device (I hope you will try to mount in exist directory ;) ):
howtobsd#mount /dev/da0 /mnt/flash
mount: /dev/da0 : Invalid argument

Ignore this message and looking at /dev directory – there should appear new device:
howtobsd#ls -l /dev/da*
crw-r----- 1 root operator 0, 143 16 окт 17:57 /dev/da0
crw-r----- 1 root operator 0, 144 16 окт 18:29 /dev/da0s1

And now we are ready to mount it:

mount_msdosfs /dev/da0s1 /mnt/flash/


How to mount iso image in FreeBSD

It is very actual question “mount iso in freebsd“. However mounting of iso is very easy. Let’s make sure it:

Firstly we need to make virtual device for our iso image (use mdconfig for it):
howtobsd# mdconfig -a -f /path_to_iso/Mac_OS_X.iso

md0 (command return) – it is name of virtual device (should appear in /dev/md0).
you can check if it appeared in /dev:
howtobsd# ls /dev/ | grep md0

And now we just need to mount virtual device:

howtobsd# mount_cd9660 /dev/md0 /cdrom

That’s all, your iso image available in /cdrom directory.

If you need to unmount and delete virtual device, do following commands:
howtobsd# umount /cdrom
mdconfig -d -u md0

E575: viminfo: Illegal starting char in line: ^E14

This error appearing when you start vim (or try to open\save file using vim editor):
E575: viminfo: Illegal starting char in line: ^E14

Solution is: delete ifrom the home directory file ~/.viminfo:

rm ~/.viminfo

Do not worry – it is just file of history and can be deleted.

Batch convert files using iconv

Converting file from KOI8-R to utf-8:
#iconv -f KOI8-R -t utf-8 originalfile > newfile
You can change KOIR-8 and utf-8 to yours.

Batch converting files from folder:

#mkdir new; for a in $(find . -name "*.php"); do iconv -f KOI8-R -t utf-8 <"$a" >new/"$a" ; done

It will make “new” directory with converted files.

mysqldump on FreeBSD

Just a few notes about mysqldump.

Create dump of mysql base:

# mysqldump -uDBUSER -pPASSWORD DBNAME > filename.sql

# mysqldump --user=username --password=password DBNAME > filename.sql

if you need to make dump of a few databases you can use parametr -B (or –databases):

mysqldump -uDBUSER -pPASSWORD -B DBNAME1 DBNAME2 > filename.sql

Make dump of the all Databases on host:
mysqldump -uDBUSER -pPASSWORD -A > filename.sql

If you need only dump structure of database (without data):

mysqldump -uDBUSER -pPASSWORD --no-data DBNAME > filename.sql

If you want to make limited by records mysqldump, next command especially for you (It was really cool command when I need dump and then move test copy of project with enormous mysql database):

mysqldump -uDBUSER -pPASSWORD --where="true limit 100" DBNAME > filename.sql

this command will dump your database with defined amount records in each table.

Perl: Premature end of script headers

Internal Server Error 500
This error appeared when I tried run IPN script for paypal.
httpd-error logs:

Perl: Premature end of script headers

A long time I have tried to fix it by sending headers like:

print "Content-type: text/plain\n\n"; но безуспешно.

The problem was just in DOS newline format. Just need change format from DOS/WIN (CR/LF) to Unix (LF).

I hope it will help somebody else.

Update to php 5.3.6 problem (autoconf: required version 2.68 not found)

Was updating php on FreeBSD to php 5.3.6
lang/php5 updated correctly but when I tried update php5-extensions – it cause problems. I also tried article
portupgrade for certain module also didn’t work (php5-mcrypt, for example):
howtobsd# portupgrade php5-mcrypt
[Updating the pkgdb
in /var/db/pkg ... - 951 packages found (-1 +0) (...) done]
---> Upgrading 'php5-mcrypt-5.3.3_2' to 'php5-mcrypt-5.3.6' (security/php5-mcrypt)
---> Building '/usr/ports/security/php5-mcrypt'
===> Cleaning for php5-mcrypt-5.3.6
===> Vulnerability check disabled, database not found
===> License check disabled, port has not defined LICENSE
===> Extracting for php5-mcrypt-5.3.6
=> SHA256 Checksum OK for php-5.3.6.tar.bz2.
===> Patching for php5-mcrypt-5.3.6
===> php5-mcrypt-5.3.6 depends on file: /usr/local/bin/phpize - found
===> php5-mcrypt-5.3.6 depends on file: /usr/local/bin/autoconf-2.68 - found
===> php5-mcrypt-5.3.6 depends on shared library: mcrypt.8 - found
===> php5-mcrypt-5.3.6 depends on shared library: ltdl.7 - found
===> PHPizing for php5-mcrypt-5.3.6
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
autoconf: required version 2.68 not found
*** Error code 1
Stop in /usr/ports/security/php5-mcrypt.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade20110417-89058-19avmgv-0 env UPGRADE_TOOL=portupgrade UPGRADE_PORT=php5-mcrypt-5.3.3_2 UPGRADE_PORT_VER=5.3.3_2 make
** Fix the problem and try again.
** Listing the failed packages (-:ignored / *:skipped / !:failed)
! security/php5-mcrypt (php5-mcrypt-5.3.3_2) (unknown build error)

As you can see autoconf 2.68 required:

howtobsd# portupgrade autoconf

But also you need update autoconf-wrapper:

howtobsd# portupgrade autoconf-wrapper

after that it updated.