su+screen: “Cannot open your terminal ‘/dev/pts/0’ - please check.”

Quick tip this time.

Often enough, one is logged in as root and decides to su - to an underprivileged user. Due to the tty for the root shell being owned by the user root, the su’d environment is unable to run screen:

root@whitegirl:~# su - joe joe@whitegirl:~$ screen Cannot open your terminal '/dev/pts/0' - please check. joe@whitegirl:~$

This is resolved by setting the owner of the terminal device to the target user before running su, so the user then has write privileges on the pseudo teletype device:

[Read More]

Diskless Debian Linux booting via dhcp/pxe/nfs/tftp/aufs

Want to boot a (possibly minimal) installation of Debian off the network using a read-only NFS share as the root filesystem, such that each netbooted machine has / mounted read-only over NFS and all writes are done to memory? Read on!

This assumes you are using a Linux computer as your router, which will be running Debian and hosting the local version of Debian we will be serving to clients which are PXE booting. This could be seen as a second part of my tutorial on making a Debian box a router , as it assumes your local network is still 10.0.0.0/24 and the dhcp/nfs/tftp server’s IP is 10.0.0.1

[Read More]

Linux as a router with iptables, bind9, and dhcpd

There are some benefits to using a Linux box as a router. You get full access to the power of iptables, can host stuff directly on the box itself rather than having forwarding ports to other machines on your network, can torrent with way more peers as the box will support more connections than a usual home router, use the router itself as a fileserver/seedbox, etc.

The network setup this entails is as follows: [Modem] - [Linux box/router] - [switch] - [other machines on your network]

[Read More]

Installing php-gtk on Debian

So you want to install PHP’s gtk extension. Compared to GTK’s bindings for Perl and Python, PHP’s apparently is under-maintained and is a pain to install as the developers have not accommodated changes in libtool. We will need to install various development packages, temporarily tweak libtool, and then attempt compiling PHP-GTK and enabling it, provided that didn’t fail.

This tutorial was performed on vanilla 64-bit Debian Squeeze 6.0.2 successfully. Something similar will hopefully work for Ubuntu and other Debian derivatives.

[Read More]

Fixing a dpkg io error

I encountered a dpkg related error a little while ago while upgrading packages on my Ubuntu Lucid server. I couldn’t find a fix on the internet and spent a little while investigating the cause. You can see from the command output that dpkg failed to properly install the Linux kernel package:

root@aeroplane:~# apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: linux-image-2.6.32-33-generic 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 3 not fully installed or removed. Need to get 0B/31.6MB of archives. After this operation, 0B of additional disk space will be used. Do you want to continue [Y/n]? y (Reading database ... 178303 files and directories currently installed.) Preparing to replace linux-image-2.6.32-33-generic 2.6.32-33.70 (using .../linux-image-2.6.32-33-generic_2.6.32-33.71_i386.deb) ... Done. Unpacking replacement linux-image-2.6.32-33-generic ... dpkg-deb: subprocess paste killed by signal (Broken pipe) dpkg: error processing /var/cache/apt/archives/linux-image-2.6.32-33-generic_2.6.32-33.71_i386.deb (--unpack): short read in buffer_copy (backend dpkg-deb during `./lib/modules/2.6.32-33-generic/kernel/drivers/ata/sata_mv.ko') No apport report written because the error message indicates a dpkg I/O error Running postrm hook script /usr/sbin/update-grub. Generating grub.cfg ... Found initrd image: /boot/initrd.img-2.6.32-33-generic Found linux image: /boot/vmlinuz-2.6.32-32-generic Found initrd image: /boot/initrd.img-2.6.32-32-generic Found linux image: /boot/vmlinuz-2.6.32-31-generic Found initrd image: /boot/initrd.img-2.6.32-31-generic Found linux image: /boot/vmlinuz-2.6.32-30-generic Found initrd image: /boot/initrd.img-2.6.32-30-generic Found linux image: /boot/vmlinuz-2.6.32-29-generic Found initrd image: /boot/initrd.img-2.6.32-29-generic Found linux image: /boot/vmlinuz-2.6.32-28-generic Found initrd image: /boot/initrd.img-2.6.32-28-generic Found linux image: /boot/vmlinuz-2.6.32-27-generic Found initrd image: /boot/initrd.img-2.6.32-27-generic Found linux image: /boot/vmlinuz-2.6.32-26-generic Found initrd image: /boot/initrd.img-2.6.32-26-generic Found linux image: /boot/vmlinuz-2.6.32-25-generic Found initrd image: /boot/initrd.img-2.6.32-25-generic Found linux image: /boot/vmlinuz-2.6.32-24-generic Found initrd image: /boot/initrd.img-2.6.32-24-generic Found linux image: /boot/vmlinuz-2.6.32-21-generic Found initrd image: /boot/initrd.img-2.6.32-21-generic Found memtest86+ image: /boot/memtest86+.bin done Errors were encountered while processing: /var/cache/apt/archives/linux-image-2.6.32-33-generic_2.6.32-33.71_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1) root@aeroplane:~#

[Read More]

Usually ignored features of suPHP

This is not a generic suPHP tutorial as there are many, many of them already; it is merely an attempt to debunk commonly preached misinformation regarding suPHP with cold, hard facts.

suPHP Also works with Lighttpd

suPHP does not just consist of the Apache module mod_suphp; it also consists of a setuid root binary (located at /usr/local/sbin/suphp on FreeBSD; /usr/lib/suphp/suphp on recent Ubuntu releases) which does the actual work. mod_suphp is just an interface to this binary. The binary also works with lighttpd provided you use a configuration file in lighttpd such as the following:

[Read More]