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

Thursday, September 26, 2019

Startup problems with php-fpm and ldap user backend on Debian

Startup problems with php-fpm and ldap user backend on Debian

Do you use php-fpm together with an ldap backend for user authentication, then you probably have seen this message in your boot logs:

[26-Sep-2019 14:58:34] ERROR: [pool XXXXXX] cannot get uid for user 'XXXXXXXX'

When using the php5.6-fpm / php7.x-fpm versions of the PHP fpm process can cause startup problems, when the users are provided via the nslcd service.

The reason is, that the ldap user backend is starting after the php fpm process(es)

Fortunately this is easy to solve, just edit your /etc/init.d/php7.3-fpm init script and add the user backend service(s) to the Required-Start section

It looks like this:
# Required-Start:    $remote_fs $network

So to add nslcd (and recommended nscd too) results in this line

# Required-Start:    $remote_fs $network nslcd nscd


To enable the new dependencies of your service starts, just disable the service and reenable it.

systemctl disable php7.3-fpm 
systemctl enable php7.3-fpm

After this, you can reboot your server and the fpm processes should startup just fine
 

Monday, June 19, 2017

Installing/running Debian stretsch inside kvm debian jessie

Installing or upgrading to a Debian stretch (Debian 9) edition should be a "no problem" case for most platforms.

Unfortunally running stretch in a KVM/QEMU environment based on Debian jessie isn't "just" working.

We did try to upgrade a existing Debian Jessie VM to stretch with the usual steps.
The upgrade itself works very fine and flawless as known from Debian systems.
But after rebooting the system, we did start getting errors in the guest, most of the time it did not even boot correctly.

In the host logfile we did see these messages in syslog:

kvm: zapping shadow pages for mmio generation wraparound
vcpu0 unhandled rdmsr: 0x34

In the log of the guest, we did see these stack traces:

Jun 19 15:40:18 sv54 kernel: [    0.000000] Linux version 4.9.0-3-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.30-2 (2017-06-12)
Jun 19 15:40:18 sv54 kernel: [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.9.0-3-amd64 root=UUID=fb8d9106-4421-4e85-af6f-8c0561bb2b25 ro quiet
Jun 19 15:40:18 sv54 kernel: [    0.000000] ------------[ cut here ]------------
Jun 19 15:40:18 sv54 kernel: [    0.000000] WARNING: CPU: 0 PID: 0 at /build/linux-FT3UnK/linux-4.9.30/arch/x86/kernel/fpu/xstate.c:593 fpu__init_system_xstate+0x53b/0x981
Jun 19 15:40:18 sv54 kernel: [    0.000000] XSAVE consistency problem, dumping leaves
Jun 19 15:40:18 sv54 kernel: [    0.000000] Modules linked in:
Jun 19 15:40:18 sv54 kernel: [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.9.0-3-amd64 #1 Debian 4.9.30-2
Jun 19 15:40:18 sv54 kernel: [    0.000000]  0000000000000000 ffffffff87f28634 ffffffff88803e08 0000000000000000
Jun 19 15:40:18 sv54 kernel: [    0.000000]  ffffffff87c76eae 000000000000000a ffffffff88803e60 0000000000000340
Jun 19 15:40:18 sv54 kernel: [    0.000000]  ffffffff88803e90 ffffffff88803e9c 0000000000000100 ffffffff87c76f2f
Jun 19 15:40:18 sv54 kernel: [    0.000000] Call Trace:
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff87f28634>] ? dump_stack+0x5c/0x78
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff87c76eae>] ? __warn+0xbe/0xe0
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff87c76f2f>] ? warn_slowpath_fmt+0x5f/0x80
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff87c72754>] ? xfeature_size+0x5a/0x78
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff88947243>] ? fpu__init_system_xstate+0x53b/0x981
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff87f586e6>] ? msr_clear_bit+0x36/0xa0
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff889468dc>] ? fpu__init_system+0x208/0x30b
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff88942fea>] ? setup_arch+0xb8/0xcc6
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff87d7a24e>] ? printk+0x57/0x73
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff88938120>] ? early_idt_handler_array+0x120/0x120
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff88938bbf>] ? start_kernel+0xab/0x463
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff88938120>] ? early_idt_handler_array+0x120/0x120
Jun 19 15:40:18 sv54 kernel: [    0.000000]  [<ffffffff88938408>] ? x86_64_start_kernel+0x14c/0x170
Jun 19 15:40:18 sv54 kernel: [    0.000000] ---[ end trace 44d08096f31f4f03 ]---


and

Jun 19 15:40:18 sv54 kernel: [    0.387100] WARNING: CPU: 2 PID: 1 at /build/linux-FT3UnK/linux-4.9.30/arch/x86/include/asm/fpu/internal.h:368 fpu__clear+0x179/0x1b0
Jun 19 15:40:18 sv54 kernel: [    0.387101] Modules linked in:
Jun 19 15:40:18 sv54 kernel: [    0.387103] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W       4.9.0-3-amd64 #1 Debian 4.9.30-2
Jun 19 15:40:18 sv54 kernel: [    0.387103] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
Jun 19 15:40:18 sv54 kernel: [    0.387104]  0000000000000000 ffffffff87f28634 0000000000000000 0000000000000000
Jun 19 15:40:18 sv54 kernel: [    0.387105]  ffffffff87c76eae ffff9ec076158040 ffff9ec076158b40 ffff9ec072329400
Jun 19 15:40:18 sv54 kernel: [    0.387106]  ffffffff88869da0 ffff9ec072354400 ffff9ec076158758 ffffffff87c30fc9
Jun 19 15:40:18 sv54 kernel: [    0.387107] Call Trace:
Jun 19 15:40:18 sv54 kernel: [    0.387110]  [<ffffffff87f28634>] ? dump_stack+0x5c/0x78
Jun 19 15:40:18 sv54 kernel: [    0.387112]  [<ffffffff87c76eae>] ? __warn+0xbe/0xe0
Jun 19 15:40:18 sv54 kernel: [    0.387113]  [<ffffffff87c30fc9>] ? fpu__clear+0x179/0x1b0
Jun 19 15:40:18 sv54 kernel: [    0.387114]  [<ffffffff87e0914c>] ? flush_old_exec+0x5bc/0x6b0
Jun 19 15:40:18 sv54 kernel: [    0.387116]  [<ffffffff87e5df52>] ? load_elf_binary+0x3c2/0x1600
Jun 19 15:40:18 sv54 kernel: [    0.387117]  [<ffffffff87e087f0>] ? search_binary_handler+0xa0/0x1c0
Jun 19 15:40:18 sv54 kernel: [    0.387118]  [<ffffffff87e5d734>] ? load_script+0x204/0x230
Jun 19 15:40:18 sv54 kernel: [    0.387118]  [<ffffffff87dfe0da>] ? __check_object_size+0xfa/0x1d8
Jun 19 15:40:18 sv54 kernel: [    0.387119]  [<ffffffff87e093c8>] ? copy_strings.isra.25+0x188/0x450
Jun 19 15:40:18 sv54 kernel: [    0.387120]  [<ffffffff87e087f0>] ? search_binary_handler+0xa0/0x1c0
Jun 19 15:40:18 sv54 kernel: [    0.387121]  [<ffffffff87e09f0a>] ? do_execveat_common.isra.37+0x5aa/0x790
Jun 19 15:40:18 sv54 kernel: [    0.387123]  [<ffffffff881f8d20>] ? rest_init+0x80/0x80
Jun 19 15:40:18 sv54 kernel: [    0.387124]  [<ffffffff87e0a118>] ? do_execve+0x28/0x30
Jun 19 15:40:18 sv54 kernel: [    0.387125]  [<ffffffff881f8d70>] ? kernel_init+0x50/0x100
Jun 19 15:40:18 sv54 kernel: [    0.387126]  [<ffffffff882064f5>] ? ret_from_fork+0x25/0x30
Jun 19 15:40:18 sv54 kernel: [    0.387127] ---[ end trace 44d08096f31f4f07 ]---
Jun 19 15:40:18 sv54 kernel: [    0.387363] ------------[ cut here ]------------
Jun 19 15:40:18 sv54 kernel: [    0.387365] WARNING: CPU: 2 PID: 1 at /build/linux-FT3UnK/linux-4.9.30/arch/x86/include/asm/fpu/internal.h:353 fpu__copy+0x140/0x190
Jun 19 15:40:18 sv54 kernel: [    0.387366] Modules linked in:
Jun 19 15:40:18 sv54 kernel: [    0.387367] CPU: 2 PID: 1 Comm: init Tainted: G        W       4.9.0-3-amd64 #1 Debian 4.9.30-2
Jun 19 15:40:18 sv54 kernel: [    0.387367] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
Jun 19 15:40:18 sv54 kernel: [    0.387368]  0000000000000000 ffffffff87f28634 0000000000000000 0000000000000000
Jun 19 15:40:18 sv54 kernel: [    0.387369]  ffffffff87c76eae ffff9ec0723e7ec0 ffff9ec076158b40 ffff9ec0723e7e80
Jun 19 15:40:18 sv54 kernel: [    0.387370]  0000000000000000 0000000000000000 00007f7cfecd79d0 ffffffff87c30a90
Jun 19 15:40:18 sv54 kernel: [    0.387371] Call Trace:
Jun 19 15:40:18 sv54 kernel: [    0.387373]  [<ffffffff87f28634>] ? dump_stack+0x5c/0x78
Jun 19 15:40:18 sv54 kernel: [    0.387374]  [<ffffffff87c76eae>] ? __warn+0xbe/0xe0
Jun 19 15:40:18 sv54 kernel: [    0.387375]  [<ffffffff87c30a90>] ? fpu__copy+0x140/0x190
Jun 19 15:40:18 sv54 kernel: [    0.387376]  [<ffffffff87c74490>] ? copy_process.part.33+0x1a0/0x1c00
Jun 19 15:40:18 sv54 kernel: [    0.387377]  [<ffffffff87dfe0da>] ? __check_object_size+0xfa/0x1d8
Jun 19 15:40:18 sv54 kernel: [    0.387379]  [<ffffffff87f56988>] ? strncpy_from_user+0x48/0x160
Jun 19 15:40:18 sv54 kernel: [    0.387379]  [<ffffffff87e0744d>] ? cp_new_stat+0x14d/0x180
Jun 19 15:40:18 sv54 kernel: [    0.387381]  [<ffffffff87c760d3>] ? _do_fork+0xe3/0x3f0
Jun 19 15:40:18 sv54 kernel: [    0.387381]  [<ffffffff87e074b9>] ? SYSC_newstat+0x39/0x60
Jun 19 15:40:18 sv54 kernel: [    0.387383]  [<ffffffff87c03b1c>] ? do_syscall_64+0x7c/0xf0
Jun 19 15:40:18 sv54 kernel: [    0.387384]  [<ffffffff8820632f>] ? entry_SYSCALL64_slow_path+0x25/0x25
Jun 19 15:40:18 sv54 kernel: [    0.387384] ---[ end trace 44d08096f31f4f08 ]---
Jun 19 15:40:18 sv54 kernel: [    0.387420] ------------[ cut here ]------------
Jun 19 15:40:18 sv54 kernel: [    0.387422] WARNING: CPU: 2 PID: 1 at /build/linux-FT3UnK/linux-4.9.30/arch/x86/include/asm/fpu/internal.h:353 __switch_to+0x66a/0x6c0
Jun 19 15:40:18 sv54 kernel: [    0.387422] ------------[ cut here ]------------
Jun 19 15:40:18 sv54 kernel: [    0.387423] Modules linked in:
Jun 19 15:40:18 sv54 kernel: [    0.387425] WARNING: CPU: 3 PID: 0 at /build/linux-FT3UnK/linux-4.9.30/arch/x86/include/asm/fpu/internal.h:368 __switch_to+0x415/0x6c0
Jun 19 15:40:18 sv54 kernel: [    0.387426] CPU: 2 PID: 1 Comm: init Tainted: G        W       4.9.0-3-amd64 #1 Debian 4.9.30-2
Jun 19 15:40:18 sv54 kernel: [    0.387427] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
Jun 19 15:40:18 sv54 kernel: [    0.387427] Modules linked in:
Jun 19 15:40:18 sv54 kernel: [    0.387428]  0000000000000000 ffffffff87f28634 0000000000000000 0000000000000000
Jun 19 15:40:18 sv54 kernel: [    0.387430]  ffffffff87c76eae ffff9ec0762401c0 ffff9ec076158040 ffff9ec076240cc0
Jun 19 15:40:18 sv54 kernel: [    0.387431]  ffff9ec0762401c0 0000000000000002 ffff9ec076158a80 ffffffff87c24aaa
Jun 19 15:40:18 sv54 kernel: [    0.387432] Call Trace:
Jun 19 15:40:18 sv54 kernel: [    0.387432] ---[ end trace 44d08096f31f4f09 ]---


After some research we did find out, that there is a bug in the QEMU/KVM packages as provided by jessie stable repositories.

To solve the problem, you have to install more recent QEMU/KVM packages, and the best way to get them for stretch is to add the jessie backports to your sources.list

deb http://ftp.debian.org/debian jessie-backports main

After the usual apt-get update just install the qemu-kvm and related packages in the 2.8xxx version, instead of the 2.1xxxx releases.

After a reboot of your physical server, you can now enjoy debian stretch in your guests

Wednesday, May 24, 2017

Using letsencrypt certificates with Collabnet Subversion Edge

With the letsencrypt CA you can create ssl certificates to protect your http servers with a valid certificate.

These certificates are valid 90 days and the can be auto renewed, so your services won't interrupt.

For normal apache / nginx installations there are plenty of documentations on how to install and use such certificates.

Unfortunately with subversion edge, it does not just work out of the box, but it uses a apache http server for http/https communication.

So what's the problem?

Let's look at a standard subversion edge installation under debian:
  • The certificates are stored in /opt/csvn/data/conf in the files server.crt and server.key
  • The configuration for the ssl certificates are in the csvn_main_httpd.conf file, which is generated at each restart
  • In the csvn_main_httpd.conf file we only have the two server.crt and server.key files referenced, but not the required intermediate certificate chain

The first thing to do is generate a ssl certificate for your server.
The http server root points to /var/www/html, so you can use that folder to generate your certificates

certbot certonly --webroot -w /var/www/html -d svn.example.com
This generates the certificates in /etc/letsencrypt/live/svn.example.com

To use them, you can now delete the two server.crt and server.key files in /opt/csvn/data/conf and create symbolic links to these files

server.crt -> /etc/letsencrypt/live/svn.example.com/cert.pem

server.key -> /etc/letsencrypt/live/svn.example.com/privkey.pem

But what about the SSLCertificateChainFile /etc/letsencrypt/live/svn.example.com/fullchain.pem file?
You can't add it to csvn_main_httpd.conf since this file is regenegated on each restart.
But fortunally you can add it into the https special config, where the chiper config is stored.
So just add it into the ssl_httpd.conf file

Now we have everything together and could start the https svn server.
Unfortunately this will fail with a error message like:

ERROR errors.GrailsExceptionResolver  -
 FileNotFoundException occurred when processing request: 
[POST] /csvn/
/opt/csvn/data/conf/server.crt (Permission denied). Stacktrace follows:
java.io.FileNotFoundException: /opt/csvn/data/conf/server.crt (Permission denied)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileWriter.<init>(FileWriter.java:107)


Ok, so you are running subversion as non-root as recommended. (If not, then rethink what you are doing and reinstall subversion as a standard user)

To allow the subversion user to access the ssl certificates of letsencrypt, the simplest way is to add the subversion user to the ssl-cert group, and give the group rx access to the certificates in /etc/letsencrypt/live and /etc/letsencrypt/archive

Once this is done, you should be able to start the svn server with active letsenrcypt ssl certificates.
What remains to be done is the periodic renewal of the certificates, which is widely described in the Internet.
What you have to do, is to restart the https service when a new certificate is generated. Usually you can do this in the renew script.

Monday, December 29, 2014

Using ftdi_sio with linux kernel 3.12 and up

A few years ago I did post some informations on how to use a Bixolon BCD-1100 or a Epson DM-D110 displays attached via USB to a linux system.

This works fine, unless you upgrade your Linux system to a kernel with version 3.12 or greater.

Since Kernel 3.12 you will see this in the logs:
# dmesg
ftdi_sio: unknown parameter 'vendor' ignored
ftdi_sio: unknown parameter 'product' ignored 



The problem is, that these two parameters where only intended to be used by developers for testing purposes. So they have now been removed from the 3.12 kernel.
But fortunaly, the linux guys did provide a official way to specify the vendor and product ID's.

We can find it in the file: /sys/bus/usb-serial/drivers/ftdi_sio/new_id.
This file contains a pair of vendor and product id, so all we need is to put those values into this file, doing something like this:

/sbin/modprobe ftdi_sio
echo "1208 0780" > /sys/bus/usb-serial/drivers/ftdi_sio/new_id


If you wish to have it automatically configured, just update your /etc/udev/rules.d/50-dmd110.rules file as follows:

ATTR{idProduct}=="0780", ATTR{idVendor}=="1208", RUN+="/sbin/modprobe -q ftdi_sio" RUN+="/bin/sh -c 'echo 1208 0780 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'",  OWNER="root", MODE="0666"

or for the /etc/udev/rules.d/51-bixolonBCD1100.rules

ATTR{idVendor}=="1504", ATTR{idProduct}=="0011", RUN+="/sbin/modprobe -q ftdi_sio"  RUN+="/bin/sh -c 'echo 1504 0011 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'",  OWNER="root", MODE="0666"

or for the  /etc/udev/rules.d/52-star-bcd122u.rules
ATTR{idVendor}=="0519", ATTR{idProduct}=="0007", RUN+="/sbin/modprobe -q ftdi_sio"  RUN+="/bin/sh -c 'echo 0519 0007 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'",  OWNER="root", MODE="0666"

Please note that you still need to use the correct serial port settings.
The bcd122u for example runs at 19200 baud as where most others are using 9600 baud.

Thursday, January 23, 2014

Run linux commands via job queue

Often we have build long running jobs under linux which then call other shell scripts when they are finished.
Sometimes it would be possible to run such tasks partially concurrently, but for this we need some sort of job queue for the linux shell.
Unfortunally the cron/crontab does not allow such dependencies.

The simplest solution is to install the task spooler from this site.
You should however first look if your distribution has a binary package for it.

In debian you can install it via:
apt-get install task-spooler

After this, you can just put new jobs in the queue via the ts command.
Please note that in debian the command is named tsp to prevent name conflicts with the moreutils package.

When you just type ts(p) the system shows you all running/pending/completed tasks.

To put a new job in the queue you just type this:
ts(p) /home/user/mytask.sh

The job is then startet as soon as possible.
Per default the task spooler does start one task and waits until it is finished.
When the first task is finished it executes the next one from the queue and so on, until the queue is empty.

You can tell the task spooler to run multiple tasks concurrently,
you just set the maximum number of allowed concurrent executions with this command:
ts(p) -S 2
This would allow the task spooler to run up to two tasks concurrently.

You can also set priority on tasks, remove them  from the queue an so on.
Look at the man page for more details.

As of 0.7.3 the man page does not list all options, to see all available options, use the -h option.

The output of the jost is per default stored in files in the /tmp folder.
You can view them, or use ts(p) to send them via email to some destination.

Tuesday, December 3, 2013

Install teamviewer 8 under linux for unattended access

Teamviewer is a great software for remote support.
 When your partner has internet access and a GUI available, you can use it to do maintenance work from anywhere in the world and via most of the devices available today. (SMartphones, tables, etc.)

With version 8 they did introduce the unattended access for linux systems too.
Unfortunally the installation routine does not always register the services correctly, so you can't access the remote system.

Fortunally there is a simple fix which works under ubuntu (and most debian based systems)

Just create a service entry yourself and set it to autostart, just as mentioned below:

cd /opt/teamviewer8/tv_bin/script
sudo cp teamviewerd.sysv /etc/init.d/
sudo chmod 755 /etc/init.d/teamviewerd.sysv
sudo update-rc.d teamviewerd.sysv defaults
  
With this in place you can now access the teamviewer instance on the linux system too.

Tuesday, June 18, 2013

You wish to know which files/folders on your linux server are using up most space?

Sometimes when operating a server you recieve a warning that your disk space is almost used up. (Of course you need a monitoring system for this)
As usual, you don't know what your users are storing where and how much.

To identify the largest folders or files you can use this small command line:

du -a /var | sort -n -r | head -n 20

This shows you the 20 top files/folders under /var.

Of course you can also run it agains your root folder, it will then take somewhat longer to complete.
For more details look at this post.

Wednesday, December 12, 2012

Starting SQL Anywhere 10.x on Ubuntu 12.04

Yes i know,

SQL Anyhwere 10 is out of the normal support cycle, so we won't get any new EBF for it.

Neverless we still have customers running SQL Anywhere on linux systems.
When you upgrade your Ubuntu 10.04 LTS to the 12.04 LTS version, then the database will no longer run.
On startup you will see a message telling you that there is not enough free memory available.

The cause is the switch from kernel 2.6.x to 3.x, which has some other memory handling.

You can find the original thread here in the sql aynwhere forum.

The simplest solution (beside upgrading to a new license of sql anywhere) is to start the database server with the architecture specified as kernel version 2.6.

Fortunally there is a tool which allows us to do this: setarch

So the command to start dbsrv10 looks like this:

setarch $(arch) --uname-2.6 /opt/sqlanywhere10/bin32/dbsrv10 @/opt/sqlanywhere10/databases.list

Tuesday, December 11, 2012

Linux and Bixolon BCD-1100

 A few years ago I posted a howto to enable a epson client display to be used with linux.


Now we wished to use bixolon client displays with out pos solution.
And as usually, they also don't know what anything beside windows is, so they don't offer drivers for linux.

The corresponding lsusb did show up this:

Bus 002 Device 004: ID 1504:0011

So the simple way to go is just use the same command as a few years back and enable the ftdi_sio module for the Bixolon displays too.
modprobe ftdi_sio vendor=0x1504 product=0x0011

Enables the bixolon display as the tty device in linux.

This did create a /dev/ttyUSB0 which we then could use to communicate with the device.
To automate the module loading on plug events, just create a new file in /etc/udev/rules.d

File: 50-udev-default.rules
ATTR{idVendor}=="1504", ATTR{idProduct}=="0011", RUN+="/sbin/modprobe -q ftdi_sio vendor=0x1504 product=0x0011"

For a solutions also working with 3.12 and newer kernels, please read on here.

Monday, April 30, 2012

XEN 32-Bit DomU running on a 64-Bit Dom0

Running 32bit guests in a 64bit Dom= XEN system is not a problem.
Just copy over the lib/modules from the Dom0 server and it works.

There are a few things however you should be aware of:
- 32bit utilities (userland tools) can't modify kernel parameters

In real world this involves problems with these components:
- Iptables won't work
- IPSEC tunnels (openswan) won't work
- (x)ntp will also have problems

When you need to have these functionality in a DOmU guest you are out of chance.
Your only options are:

- Use 64bit DomU as well
- Install these tools in the Dom0 environment
- Use the hardware virtualization

Monday, January 30, 2012

Upgrading EOL Ubuntu versions

Upgrading older ubuntu versions is straight forward.

Just upgrade all packages

sudo aptitude update && sudo aptitude safe-upgrade

and the (after a reboot) do a 

sudo do-release-upgrade
 

This works fine, as long as the origin version is not EOL.
When your server is having a EOL version installed, then you must dig somewhat deeper:

You have to change the source repositories to old-releases (instead of achives as mentioned in many posts/sites)

So you do change sources.list to:

deb http://old-releases.ubuntu.com/ubuntu/ dapper main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ dapper-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ dapper-security main restricted universe multiverse 
  
Then you can do the normal steps as mentioned above.
If the do-release-upgrade command is unknown, then you have to install it:

install update-manager-core

If by change you had the profile "ubuntu-desktop" installed, then first remove that one from your installation.

Modified /usr/lib/
python2.4/site-packages/UpdateManagerCore/DistUpgradeFetcherCore.py

#near line 28, add:
import time
# near the line 101-102, just after "tar.close()", add
    print "----- IT IS TIME NOW !-----"
 time.sleep(60)
# Note that you can adjust the time (60) by the value in seconds of your choice...
Theses lines should be like :
          tar.close()
          # Wait about 1 minute (time to modify update script)
          print "----- IT IS TIME NOW !-----"
          time.sleep(60)
          return True
# Note that you must keep the text idented


Run sudo do-release-upgrade

When the script sleeps, you have just 60 seconds to do the next step:
-- Modified /tmp/tmpXXXXXX/prerequists-sources.list and prerequists-sources.dapper.list and changed them to "old-releases" as well.

Then  wait until the script continues running and asks:
"Do you want to modify the sources list?"

Make sure you don't press enter along the way or it skips that question by assuming a "no".) It will say: "WARNING: Failed to read mirror file."

Go fix /etc/apt/sources.list back to the way it used to be now. With "us.archive" instead of "old-releases" (except for the security lines, that should just be "security.ubuntu.com".

Return to the update and say Yes.
The updater will modify /etc/apt/sources.list and replace all the dapper entries with hardy entries and continue updating using the servers.

Thursday, January 26, 2012

Boot Linux Mint via PXE and NFS

Linux Mint is a linux distribution based on Ubuntu, which in turn is based on Debian.

Linux Mint does not use Unity as desktop manager, but instead uses a extended Gnome3 desktop manager with many additions, so it can be used by most peoples.

Naked Unity and Gnome3 desktops are somewhat confusing for normal and experienced users (At least this is how we did see reactions of users)

When you wish to netboot Linux Mint via PXE and NFS you need the following components:

1. A DHCP server which assigns the correct boot options
2. A TFTP server for loading the pxe environment and loading kernel and initrd
3. A NFS server to deliver the normal Mint squashfs

The setup is identical as for net booting ubuntu, you only have to make sure you specify the correct paths.
A typical pxelinux.cfg entry for mint looks like this:

LABEL Linux Mint 12 64-Bit
    kernel mint12-amd64/vmlinuz
    APPEND boot=casper netboot=nfs nfsroot=192.168.1.200:/srv/nfs/mint/12-amd64 initrd=mint12-amd64/initrd.lz --

In this case we have:
- On the tftp server we make a subdirectory called linux12-amd64
- In that directory we put the vmlinux and initrd.lz from the ISO image /casper/ directory
- On the NFS server we just expand the content of the mint iso file into /srv/nfs/mint/12-amd64

It should then work just fine

Wednesday, January 5, 2011

Your computer has no CD/DVD drive ?

A simple way to install most older and current linux systems is by creating a bootable USB stick.

Some distributions have a option to do this from the live CD, but you still have to first boot from that downloaded iso file.....

Here is a simple flexible solution:

http://unetbootin.sourceforge.net/

Just follow then instructions.

Beside this:

UNetbootin can also be used to load various system utilities, including:

Wednesday, November 10, 2010

ipv6 in the wild

In the last year we did many steps toward ipv6 enabling our networks and servers.
Many things are simple, but there are also many pitfalls.

Here some infos about ipv6 in Ubuntu/Debian

- The Ubuntu distribution 9.04 and newer have good IPv6 support, most applications work with ipv4 and ipv6. Some applications however have problems with ipv6 addresses in some places. Here a upgrade to the most recent 10.10 release solves many issues.

- Debian, yeah, most things work fine in lenny, you can do most things you need, but there are still a few places where you may stumble. The real "full" ipv6 support is coming up in squeeze.

Here a two places where you might struggle:

- Assigning a static IPv6 address in debian lenny just does not work....
Nothing to worry about on workstations/desktops, but on firewalls and servers... it would be nice to always have the same ipv6 address assigned.
The reason for the problem is, that when the eth0 interface (or any other) is activated, the kernel module ipv6 is not yet loaded. So it's not possible to assign the ipv6 settings specified in the /etc/network/interfaces file.
The simplest solution is to just add ipv6 to the file /etc/modules (and rebuild the initramfs), that way ipv6 is directly loaded on boot and everything works as intended.

- RSYNC has only partial ipv6 support.
What does this mean ?
Rsync is able to resolve host names into ipv6 addresses and then connect to them via ipv6.
But if you with to specify the ipv6 address of the host directly on the commandline, then it fails parsing the address.
The simplest way to solve the problem is to install the rsync from the debian backports.

Don't forget, ipv4 addresses are running out in the next year, so prepare slowly to add ipv6 support to your network.
You don't have to do it in a big-bang way, rather just implement it step-by-step.

Monday, October 25, 2010

Collect linux statistics with collectd

Collectd is a great tool to collect various parameters of a running linux installation.

It can monitor disk space, cpu load, temperatures and much more.

One thing to note, is that collectd can cause system load by itself.
To prevent this, enable caching in the rddtools.

For more details read on in this post:

https://jeremy.visser.name/2010/02/23/enable-caching-in-collectd/

Tuesday, March 9, 2010

Linux and epson DM-D110 Display

In a project we had to switch over from a Windows XP based environment to a Linux based Pos system.

All components did work just fine (almost out of the box).
The main problem was the LineDisplay used to display the information to the clients.

It is a Epson DM-D110 with USB interface.
There is no linux driver available for that device from epson :(

So the lsusb command did show this:

Bus 003 Device 003: ID 1208:0780

Ok, no driver loaded for that usb device. I did google arround, but did only find a reference in the openbravo project, about using the usbserial module for that device.
We did some tests, but where not able to get it working.

After some more googling and looking at the windows drivers we did find out, that the chipset was in fact a ftdi with customized vendor and device id.

So after some trial and error we got it working by loading the ftdi kernel module for that device.

modprobe ftdi_sio vendor=0x1208 product=0x0780

This did create a /dev/ttyUSB0 which we then could use to communicate with the device.
To automate the module loading on plug events, just create a new file in /etc/udev/rules.d

File: 50-udev-default.rules
SYSFS{idProduct}=="0780", SYSFS{idVendor}=="1208", RUN+="/sbin/modprobe -q ftdi_sio product=0x0780 vendor=0x1208"


This website has some more info on this:

http://www-user.tu-chemnitz.de/~sontag/sprog.html

For a solutions also working with 3.12 and newer kernels, please read on here.

Thursday, February 18, 2010

Windows 7 and Samba

Yet another post on the Windows 7 & SAMBA subject:

To be able to join Windows 7 stations into a Samba controlled domain you must do the following steps:

- Make sure you have samba version 3.3.4
We also did try with 3.3.9 and 3.4.3 but have not been able to get it working in our environment....

- In the registry of the windows 7 system change these settings

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanManWorkstation\Parameters]
"DomainCompatibilityMode"=dword:00000001
"DNSNameResolutionRequired"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters]
"requiresignorseal"=dword:00000000
"requirestrongkey"=dword:00000000



You should now be able to join the domain and login as well.

Open Word, Excel und PDF documents with wine

Normally you don't install (ms|open)-office under wine.
You rather have the full openoffice directly installed under linux.

To allow windows apps to open the files with the native openoffice applications you can do the following:

- Create a registry file containing your associations per application

For example

REGEDIT4
[HKEY_CLASSES_ROOT\.doc]
@="docfile"

[HKEY_CLASSES_ROOT\docfile\shell\open\command]
@="c:\\ooffice.exe %1"


[HKEY_CLASSES_ROOT\.xls]
@="xlsfile"

[HKEY_CLASSES_ROOT\xlsfile\shell\open\command]
@="c:\\ooffice.exe %1"

[HKEY_CLASSES_ROOT\.pdf]
@="pdffile"

[HKEY_CLASSES_ROOT\pdffile\shell\open\command]
@="c:\\pdfreader.exe %1"


Then import this with regedit.exe
Now create the helper applications under C:\ of your wine installation.

For example: ooffice.exe (Make sure it is executable chmod a+x ooffice.exe)

!/bin/sh
ooffice "`winepath -u "$*"`"


or for pdf:

#!/bin/sh
acroread "`winepath -u "$*"`"


What happens:

1. In the registry you tell windows what app to start for the corresponding file type
2. In the helper file ooffice.exe you start the native linux application
The helper application winpath converts a windows path into the corresponding linux path

Thursday, February 11, 2010

Printing with FreeNX

In current Ubuntu environments with FreeNX installed, then printing does not work out of the box.
To get it working, we had to change two things:

* Create a symlink for /usr/lib/nx/nxsmb -> /usr/lib/cups/backend
* chmod a+x for /usr/lib/libnxredir.so.0

After this, it's possible to print to the remote printer.
What now is left, is telling gnome/kde to use that local cups server instead of the localhost one.