May 2013

qnap .profile

  • Published in Qnap
  • May 16, 2013

/root/.profile

 

To make this setting permanent, you can add this to your .profile, before the 'reset' line

export PS1='[\w] # '
export TERMINFO='/usr/share/terminfo/'
reset

This assumes that you are using the default QNAP shell of /bin/sh. If you are using /bin/bash, put the export command in .bashrc.

 

Troubleshooting

  • If the .profile gets overwritten at reboot (which is the case with firmware 3.8.1) a workaround could be to create a .profile_backup in /share/HDA_DATA/ and overwrite the .profile in autorun.sh with:
cp /share/HDA_DATA/.profile_backup /root/.profile
Read more...

# screen /var/run/utmp: No such file or directory Cannot find termcap entry for '...'

  • Published in Qnap
  • May 16, 2013

QNAP screen command broken-ness

On the QNAP per default the screen command is not configured properly. When running screen the following errors are output.

# screen
/var/run/utmp: No such file or directory
Cannot find termcap entry for '...'

(Where ... is a placeholder for xterm-color, xterm-256color or any file which is not available on the QNAP.)

If you cd to /var/run/ you will notice that the file utmp is indeed missing. To solve the first error it suffices to create an empty file.

# touch /var/run/utmp

The second error appears because the termcap to which the environment variable TERM points, is missing. You can verify this with checking your TERM environment variable:

# export | grep xterm

You will notice the TERM variable is defined and as such pointing to a file, which is not there. If you browse to the following directory you can verify that:

# ls /usr/share/terminfo/x/

Per default there are only two entries: xterm and xterm-xfree86. xterm-xfree86 is the successor of the original xterm-color. Screen is searching for a specific xterm-file which is configured on the terminal from which you are controlling your QNAP. If you use a MAC for example, the default terminal preferences declare the terminal as xterm-256color. This means that when you connect with your MAC to the QNAP, it will inform the QNAP of the declared terminal and as such screen on the QNAP fails to work, if it cannot find the requested xterm-file.


Knowing this gives you a few options for solving this:

  • Changing the terminal preferences to use xterm.
  • Make sure the TERM environment variable on your QNAP is pointing to xterm-xfree86.
  • Create one or more symbolic links from the requested xterm file to xterm-xfree86.


The last solution with the symbolic links will be a general solution that will probably work in most of the cases. Changing a file name would be also an option but gives less flexibility. Create one or more symbolic links from the missing file (xterm-256color, xterm-color or ...) to its successor xterm-xfree86.

But...

Once you have modified your QNAP and restarted it, you may find all settings are lost. So how to make this persistent?

See Automatic startup ... when system boots for tips on keeping settings and software persistent.

Depending on your model, mount the ramblock (Note that this is device dependent, check the link above. For example for the TS-459 and TS-469 it is /dev/sdx6):

mount -t ext2 /dev/sdx6 /tmp/config
vi /tmp/config/autorun.sh

Add the following lines:

#!/bin/sh
# start a single script
/share/MD0_DATA/custom/autorunmaster.sh
# finish

Ensure that /tmp/config/autorun.sh is executable:

chmod +x /tmp/config/autorun.sh

Then unmount with:

umount /tmp/config

Now create a directory:

mkdir /share/MD0_DATA/custom/

Edit the file autorunmaster.sh

vi /share/MD0_DATA/custom/autorunmaster.sh

Add or enter the following:

#!/bin/sh
# This is the autorunmaster file which is executed from
# mounted device /dev/sdx6/ with file autorun.sh
# Enter below your scripts and comments
#
# Fix broken screen command which has missing file
# /var/run/utmp and may have missing environment
# variables for TERM, as such pointing to a non-existing
# xterm file like xterm-color.
touch /var/run/utmp
ln -s /usr/share/terminfo/x/xterm-xfree86 /usr/share/terminfo/x/xterm-256color
ln -s /usr/share/terminfo/x/xterm-xfree86 /usr/share/terminfo/x/xterm-color

And make sure that autorunmaster.sh is executable:

chmod +x /share/MD0_DATA/custom/autorunmaster.sh

Troubleshooting

  • Message 'Aborted because of window size change' appears. Disable remote-controlled terminal resizing, which is in Putty in Terminal -> Features
  • If /share/MD0_DATA does not exist you may need to use  /share/HDA_DATA instead depending on your disk configuration

Alternative solution

If for some reason the above mentioned does not work, the following might. Run the screen command with an exported variable:

# TERMINFO='/usr/share/terminfo/' screen

or

# export TERMINFO='/usr/share/terminfo/'
# screen

To make this setting permanent, you can add this to your .profile, before the 'reset' line

export PS1='[\w] # '
export TERMINFO='/usr/share/terminfo/'
reset

This assumes that you are using the default QNAP shell of /bin/sh. If you are using /bin/bash, put the export command in .bashrc.

Troubleshooting

  • If the .profile gets overwritten at reboot (which is the case with firmware 3.8.1) a workaround could be to create a .profile_backup in /share/HDA_DATA/ and overwrite the .profile in autorun.sh with:
cp /share/HDA_DATA/.profile_backup /root/.profile

 

Read more...

nohup command in qnap

  • Published in Qnap
  • May 16, 2013

after installing ipkg thru QPKG, you can retreive nohup in coreutils package

 

do
ipkg update
ipkg list | grep coreutils
ipkg install coreutils

 

 

http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/coreutils_8.4-1_arm.ipk

Read more...

qnap rsync Segmentation fault daemon

  • Published in Qnap
  • May 16, 2013

This is problem version rsync de qnap

 

change original version of rsync to version optware--ipkg

wget 

http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/rsync_3.0.9-1_arm.ipk

unzip all

login ssh to qnap

find  /bin/rsync

copy and overwrite to qnap  /usr/bin/rsync

 

your rsync is newest 3.09

 

next is  creqt a password file in qnap /root/rsyncpassword

 

use command 

 

rsync -avzP --bwlimit=200 --password-file=/root/rsyncpass rsync://This email address is being protected from spambots. You need JavaScript enabled to view it./daemon_name  /share/rsync

 

Read more...

ESXi 5.0 DELL PERC H200 RAID Health status

Use the VIB File of MegaRAID SAS 9240-4i since this also uses LSISAS2008. Download:

http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/00.03.V0.03_SMIS_VMware_Installer.zip

 

client set sleep all VMs

client set host to maintenance mode 

SSH connect to esxi host

cd /tmp

unzip zip file and up load only vib

command 

esxcli software vib install -v /tmp/vmware-esx-provider-lsiprovider.vib -force

Read more...

Auto update an debian Server with Aptitude

  • Published in Debian
  • May 13, 2013

How to keep software up-to-date automatically on Ubuntu Server using Aptitude

Usual disclaimer

This article is provided as it and no responsibility will be taken for things going wrong. Tested on Ubuntu 8.10 server.

Using Aptitude

If you've ever tried out Ubuntu you'll probably know what aptitude is and how to manage packages. Updating your system is as simple as sudo aptitude udpate && sudo aptitude upgrade

This updates the package lists and presents any upgrades.

Automating the process

Wouldn't it be easier if you could automate this and forget about it? That way your server can stay up to date without you ever having to worry about it. Create a file called autoupdate.sh and put the following into it:

#!/bin/bash

# A script to run Aptitude and install any upgrades automatically. 
# Add this to /etc/cron.daily to run the script every 24 hours. 

# This prevents "TERM is not set, so the dialog frontend is not usable." error
PATH="$PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"

aptitude update
aptitude safe-upgrade -y
aptitude autoclean

To run this script daily move it to /etc/cron.daily (making sure it is executable).

chmod +x autoupdate.sh
sudo chown root:root autoupdate.sh
sudo mv autoupdate.sh /etc/cron.daily 



test
cd /etc/cron.daily ./autoupdate.sh

The update will run automatically once a day ensuring you stay up-to-date.

Checking logs

You can keep a check on packages that have been installed and removed via the log file that Aptitude generates.

sudo tail -n 30 /var/log/aptitude

If you want to check that an upgrade has been applied you can search for it like this

sudo cat /var/log/aptitude | grep -A 20 -B 20 php5

Or you can check the currently installed version using (this example is php5)

aptitude show php5
Read more...

升级 Debian

  • Published in Debian
  • May 11, 2013

由 5.0 (lenny) 升级至测试版本 (squeeze)

变身成系统使用者 (root) 的身份:

$ su
passwd:
#

将 /etc/apt/sources.list 中的 stable 或 lenny 转成 squeeze:

cd /etc/apt
cp sources.list sources.list.bak
sed -e 's/\<\(stable\|lenny\)\>/squeeze/g' sources.list.bak >sources.list

更新最新的套件资讯:

apt-get update

更新整个系统:

apt-get dist-upgrade
Read more...
Subscribe to this RSS feed