thewatertower.org.uk

Ubuntu Server


Topics here


Relevant topics elsewhere


NFS pre-reqs and apt cache

don't use - the cache gets housekept, which is pretty pointless in this context.

To speed up upgrades, all my ubuntu systems have a shared apt cache folder. NB - there are lock files etc. involved, so only one machine can update at a time.

~$ sudo bash
~# apt-get install portmap nfs-common
~# . /etc/lsb-release
~# cp -p /etc/fstab /etc/fstab.bkp
~# echo server:/srv/data/apt_cache/${DISTRIB_ID}/${DISTRIB_RELEASE}  /var/cache/apt  nfs  soft,bg 0 0  >> /etc/fstab

** if this isn't the first machine, simply over-mount

~# mount /var/cache/apt

** if this is the first machine at this release, populate the cache

~# cd /var/cache/apt
~# tar -cf /tmp/aptcache.tar *
~# cd .. ; mount apt
~# cd apt
~# tar -xf /tmp/aptcache.tar && rm /tmp/aptcache.tar

The server has to be set up to allow root access: options 'rw' and 'no_root_squash' applied to the export in /etc/exports.


Additional packages (6.06 32bit)


apt-get install openssh-server samba ntp cupsys cupsys-bsd
apt-get install gcc make binutils cpp build-essential

ntp is configured in /etc/default/ntpdate; edit in the ntp server name.


Static IP

Ubuntu 6.06 svr LTS builds by default with DHCP. To set it to a static address, /etc/network/interfaces needs to be edited. /etc/resolv.conf should also be amended.

ben@mekong:~$ diff -c2  /etc/network/interfaces  /etc/network/interfaces.orig_dhcp
*** /etc/network/interfaces     2008-08-28 22:17:10.000000000 +0100
--- /etc/network/interfaces.orig_dhcp   2008-08-23 18:21:42.000000000 +0100
***************
*** 8,13 ****
  # The primary network interface
  auto eth0
! iface eth0 inet static
!  address 192.168.1.107
!  netmask 255.255.255.0
!  gateway 192.168.1.1
--- 8,10 ----
  # The primary network interface
  auto eth0
! iface eth0 inet dhcp
ben@mekong:~$ grep my /etc/resolv.conf
search mydomain
domain mydomain

Don't remove 'auto eth0' - the system will then not configure the interface at boot.

/etc/iftab is used to assign persistent names to interfaces; via the MAC address.


Virtual IP

Add an entry to the interfaces file. Names can be given instead of numbers: not sure how many characters, but an interface called 'jumpstart' on a SuSE 10.2 machine got abbreviated to 'jump' so maybe 4 characters is a good guidline.

$ sudo vi /etc/network/interfaces
auto eth0:xtra
iface eth0:xtra inet static
address 192.168.1.60
netmask 255.255.255.0
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x
$ sudo /etc/init.d/networking restart

motd

To truncate the verbose MOTD on some (later?) releases, edit /etc/motd.tail

On 6.06, /etc/init.d/bootmisc uses the current motd as the basis for the one it updates with the latest uname -a


Console resolution (prior to 9.10)

Ubuntu will make relatively frequent updates to /boot/grub/menu.lst - when the Kernel gets updated. To support customisation, it appears that there are commented out entries in menu.lst that guide how it builds the new boot options for the new kernels.

To add the 'vga=0x???' entry, put it on the defoptions line and on the kernel arguments for the default boot configuration. Find out what argument to use with the following command:

hwinfo --framebuffer


Console resolution (9.10,+ - grub2)

Under Grub 2 and / or kernel 2.6.31 vga= is deprecated and it ignores it.

Its this sort of shit that frustrates me with Linux. All I wanted to do was get the console working at 1024 before installing ssh, and it turned into a three hour round trip.

root@thunderchild:/etc/default# diff grub grub.20091206  
9,10c9
< #GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
< GRUB_CMDLINE_LINUX_DEFAULT=""
---
> GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
19c18
< GRUB_GFXMODE=1024x768
---
> #GRUB_GFXMODE=640x480
root@thunderchild:/etc/default# cd ../grub.d 
root@thunderchild:/etc/grub.d# cp -p 00_header 00_header.20091206 
root@thunderchild:/etc/grub.d# chmod a-x 00_header.20091206 

The grub config builder will work its way through anything that is executable, regardless of filename.

root@thunderchild:/etc/grub.d# diff 00_header 00_header.20091206
90d89
<   set gfxpayload=keep
root@thunderchild:/etc/grub.d# diff -C1 00_header 00_header.20091206
*** 00_header   2009-12-06 20:22:11.000000000 +0000
--- 00_header.20091206  2009-12-06 19:51:33.000000000 +0000
***************
*** 89,91 ****
    set gfxmode=${GRUB_GFXMODE}
-   set gfxpayload=keep
    insmod gfxterm
--- 89,90 ----
root@thunderchild:/etc/grub.d# cp -p /boot/grub/grub.cfg  /boot/grub/grub.cfg_20091206
root@thunderchild:/etc/grub.d# grub-mkconfig > /boot/grub/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-14-generic-pae
Found initrd image: /boot/initrd.img-2.6.31-14-generic-pae
Found memtest86+ image: /memtest86+.bin
done

Didn't work. Blank screen.

Need to revise initramfs to include two modules, add vesafb to the modules loaded by the kernel, and un-blacklist the same.

root@thunderchild:/etc/initramfs-tools# diff modules modules.20091206
11,12d10
< vesafb
< fbcon
root@thunderchild:/etc/initramfs-tools# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-2.6.31-14-generic-pae
root@thunderchild:/etc# diff modules modules.20091206
8d7
< vesafb
root@thunderchild:/etc/modprobe.d# diff blacklist-framebuffer.conf blacklist-framebuffer.conf_20091206
27c27
< #blacklist vesafb
---
> blacklist vesafb

It takes its time turning the console on. But it works - finally.


PCMCIA ethernet (9.10)

Trying to get a second ethernet connection into a Compaq Armada M300 laptop that's running Server 9.10.

Kernel doesn't seem to have seen it - dmesg output supports hardware query output:

ben@thunderchild:/etc/init.d$ lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled) (rev 03)
00:04.0 CardBus bridge: Texas Instruments PCI1211
00:05.0 VGA compatible controller: ATI Technologies Inc 3D Rage LT Pro (rev dc)
00:07.0 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 02)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.2 USB Controller: Intel Corporation 82371AB/EB/MB PIIX4 USB (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:08.0 Multimedia audio controller: ESS Technology ES1978 Maestro 2E (rev 10)
00:09.0 Ethernet controller: Intel Corporation 82557/8/9/0/1 Ethernet Pro 100 (rev 09)
00:09.1 Serial controller: Agere Systems LT WinModem
ben@thunderchild:/etc/init.d$ sudo apt-get install pcmciautils
ben@thunderchild:/etc/init.d$ sudo lspcmcia
Socket 0 Bridge:        [yenta_cardbus]         (bus ID: 0000:00:04.0)

ben@thunderchild:/etc/init.d$ pccardctl status
Socket 0:
  5.0V 16-bit PC Card
ben@thunderchild:/etc/init.d$ pccardctl ident
Socket 0:
  no product info available
ben@thunderchild:/etc/init.d$ pccardctl info
PRODID_1=""
PRODID_2=""
PRODID_3=""
PRODID_4=""
MANFID=0000,0000
FUNCID=255

However, I note now that 'pcmciautils' has turned up in /etc/init.d, so a reboot becomes worth a shot.

ben@thunderchild:~$ pccardctl status
Socket 0:
  5.0V 16-bit PC Card
  Subdevice 0 (function 0) bound to driver "3c574_cs"
ben@thunderchild:~$ pccardctl ident
Socket 0:
  product info: "3Com", "Megahertz 574B", "B", "001"
  manfid: 0x0101, 0x0574
  function: 6 (network)
ben@thunderchild:~$ pccardctl info
PRODID_1="3Com"
PRODID_2="Megahertz 574B"
PRODID_3="B"
PRODID_4="001"
MANFID=0101,0574
FUNCID=6

Phew!


Power saving

old links:


CUPS - remote printing (6.06)

My Ubuntu 6.06 printer needed to be serving out its printer queues to Linux machines as well as Windows, via Samba. I made the following changes so I can print to it from other machines on the network (192.168.1.???) and also manage it via the web page, as it runs console-mode only.

# unremark these

Listen localhost:631
Listen /var/run/cups/cups.sock
Browsing On

# Add the second option:

DefaultAuthType Basic 
DefaultEncryption IfRequested

# Changed an entry in this section:

<Location />
  Order allow,deny
  Allow localhost
  Allow 192.168.1.*    # was: "Allow @LOCAL"
</Location>

# Added entry here

<Location /admin>
  Order allow,deny
  Allow localhost
  Allow 192.168.1.*  # added
</Location>

# added entry here

<Location /admin/conf>
  AuthType Basic
  Require user @SYSTEM
  Order allow,deny
  Allow localhost
  Allow 192.168.1.*   # added
</Location>

On Ubuntu 8.04 "clients", the printers can be found and installed via

  • system|administration|printing

  • add a printer

  • selecting 'Internet Printing Protocol (ipp), and then specify the host or dns name

  • press 'find queue' and pick the CUPS queue from the list

  • specify the driver

  • configure

  • do a test print


VNC server

I want to get VNC server working on a 8.04.1 server; and will also attempt to get a gnome desktop working. Its currently little more than a basic installation.

Step one is the server itself. Headline items include fonts, libraries and programs for X11 and graphics.

root@malinche:~# apt-get install vnc4server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  defoma fontconfig-config libdrm2 libfontconfig1 libfontenc1 libfreetype6 libfs6 libgl1-mesa-glx
  libice6 libpng12-0 libsm6 libx11-6 libx11-data libxau6 libxaw7 libxcb-xlib0 libxcb1 libxcursor1
  libxdamage1 libxdmcp6 libxext6 libxfixes3 libxfont1 libxft2 libxi6 libxinerama1 libxkbfile1
  libxmu6 libxmuu1 libxpm4 libxrandr2 libxrender1 libxt6 libxtrap6 libxtst6 libxv1 libxxf86dga1
  libxxf86misc1 libxxf86vm1 ttf-dejavu ttf-dejavu-core ttf-dejavu-extra vnc4-common x11-apps
  x11-common x11-session-utils x11-utils x11-xfs-utils x11-xkb-utils x11-xserver-utils xauth
  xbase-clients xfonts-base xfonts-encodings xfonts-utils xinit
Suggested packages:
  defoma-doc dfontmgr psfontmgr x-ttcidfont-conf libfreetype6-dev xvnc4viewer vncviewer vnc-java
  mesa-utils pdksh xfs xserver
Recommended packages:
  libft-perl
The following NEW packages will be installed
  defoma fontconfig-config libdrm2 libfontconfig1 libfontenc1 libfreetype6 libfs6 libgl1-mesa-glx
  libice6 libpng12-0 libsm6 libx11-6 libx11-data libxau6 libxaw7 libxcb-xlib0 libxcb1 libxcursor1
  libxdamage1 libxdmcp6 libxext6 libxfixes3 libxfont1 libxft2 libxi6 libxinerama1 libxkbfile1
  libxmu6 libxmuu1 libxpm4 libxrandr2 libxrender1 libxt6 libxtrap6 libxtst6 libxv1 libxxf86dga1
  libxxf86misc1 libxxf86vm1 ttf-dejavu ttf-dejavu-core ttf-dejavu-extra vnc4-common vnc4server
  x11-apps x11-common x11-session-utils x11-utils x11-xfs-utils x11-xkb-utils x11-xserver-utils
  xauth xbase-clients xfonts-base xfonts-encodings xfonts-utils xinit
0 upgraded, 57 newly installed, 0 to remove and 58 not upgraded.
Need to get 16.8MB of archives.
After this operation, 35.2MB of additional disk space will be used.

Step two: check it works.

ben@malinche:~$ vncpasswd
Password:
Verify:
ben@malinche:~$ vncserver -geometry 1024x768 -depth 16
xauth:  creating new authority file /home/ben/.Xauthority

New 'malinche:1 (ben)' desktop is malinche:1

Creating default startup script /home/ben/.vnc/xstartup
Starting applications specified in /home/ben/.vnc/xstartup
Log file is /home/ben/.vnc/malinche:1.log

And I can connect to that from another machine. twm isn't installed, so there's no window manager. One or more 'x' programs are just smeared onto the wall of the xserver!

Step three: add metacity, and replace twm in xstartup.

ben@malinche:~/.vnc$ sudo apt-get install metacity
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  fontconfig gconf2 gconf2-common libatk1.0-0 libcairo2 libcupsys2 libdatrie0 libgconf2-4
  libglib2.0-0 libgtk2.0-0 libgtk2.0-common libidl0 libjpeg62 libmetacity0 liborbit2 libpango1.0-0
  libpango1.0-common libpcre3 libpixman-1-0 libstartup-notification0 libthai-data libthai0
  libtiff4 libxcomposite1 libxml2 metacity-common sgml-base
Suggested packages:
  cupsys-common librsvg2-common ttf-arphic-bkai00mp ttf-arphic-bsmi00lp ttf-arphic-gbsn00lp
  ttf-arphic-gkai00mp ttf-baekmuk ttf-kochi-gothic ttf-kochi-mincho ttf-thryomanes
  gnome-control-center sgml-base-doc
Recommended packages:
  libatk1.0-data libglib2.0-data hicolor-icon-theme libgtk2.0-bin x-ttcidfont-conf xml-core
  gnome-session x-session-manager
The following NEW packages will be installed
  fontconfig gconf2 gconf2-common libatk1.0-0 libcairo2 libcupsys2 libdatrie0 libgconf2-4
  libglib2.0-0 libgtk2.0-0 libgtk2.0-common libidl0 libjpeg62 libmetacity0 liborbit2 libpango1.0-0
  libpango1.0-common libpcre3 libpixman-1-0 libstartup-notification0 libthai-data libthai0
  libtiff4 libxcomposite1 libxml2 metacity metacity-common sgml-base
0 upgraded, 28 newly installed, 0 to remove and 58 not upgraded.
Need to get 6948kB of archives.
After this operation, 51.2MB of additional disk space will be used.



ben@malinche:~/.vnc$ cp -p xstartup xstartup.orig
ben@malinche:~/.vnc$ cat xstartup.orig | sed 's#twm#metacity#g' > xstartup
ben@malinche:~/.vnc$ vncserver -kill :1
Killing Xvnc process ID 5296
ben@malinche:~/.vnc$ vncserver -geometry 1024x768 -depth 16

New 'malinche:1 (ben)' desktop is malinche:1

Starting applications specified in /home/ben/.vnc/xstartup
Log file is /home/ben/.vnc/malinche:1.log

Now its clear what was running before (nothing, apart from VNC clipboard control, which has vanished) we need to add xterm

ben@malinche:/usr/X11R6/bin$ sudo apt-get install xterm
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  xbitmaps
Suggested packages:
  xfonts-cyrillic
Recommended packages:
  xutils
The following NEW packages will be installed
  xbitmaps xterm
0 upgraded, 2 newly installed, 0 to remove and 58 not upgraded.
Need to get 480kB of archives.
After this operation, 1585kB of additional disk space will be used.

Now we have a usable, minimal, session.

All the documentation says to run gnome-session to start a full gnome desktop.

ben@malinche:~$ pstree
init─┬─Xvnc
     ├─atd
     ├─cron
     ├─dd
     ├─gconfd-2
     ├─5*[getty]
     ├─klogd
     ├─login───bash
     ├─metacity
     ├─ntpd
     ├─sshd───sshd───sshd───bash───pstree
     ├─syslogd
     ├─udevd
     ├─vmware-guestd
     ├─vncconfig
     └─xterm───bash───bash
ben@malinche:~$ sudo apt-get install gnome-session
[sudo] password for ben: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  acl consolekit dbus esound-common gamin gnome-mime-data gnome-power-manager
  gnome-settings-daemon hal hal-info libart-2.0-2 libasound2 libaspell15 libaudiofile0
  libavahi-client3 libavahi-common-data libavahi-common3 libavahi-glib1 libbonobo2-0
  libbonobo2-common libbonoboui2-0 libbonoboui2-common libdbus-glib-1-2 libenchant1c2a
  libesd-alsa0 libgail-common libgail18 libgamin0 libglade2-0 libgnome-desktop-2 libgnome-keyring0
  libgnome2-0 libgnome2-common libgnomecanvas2-0 libgnomecanvas2-common libgnomekbd-common
  libgnomekbd2 libgnomeui-0 libgnomeui-common libgnomevfs2-0 libgnomevfs2-common
  libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 libhal-storage1 libhal1 libhunspell-1.1-0
  libnotify1 libpanel-applet2-0 libpolkit-dbus2 libpolkit-grant2 libpolkit2 libsexy2 libsmbios1
  libwnck-common libwnck22 libxklavier12 libxres1 notification-daemon pm-utils policykit
  powermgmt-base shared-mime-info
Suggested packages:
  desktop-base gnome-user-guide gnome2-user-guide gnome-device-manager libasound2-plugins aspell
  libbonobo2-bin esound gnome-icon-theme libgnomevfs2-bin gnome-app-install libvisual-0.4-plugins
  gstreamer0.10-plugins gstreamer0.10-tools libsmbios-doc
Recommended packages:
  libpam-ck-connector dbus-x11 gnome-panel nautilus libsmbios-bin aspell-en aspell-dictionary
  aspell6a-dictionary esound-clients gnome-keyring gnome-mount libgnomevfs2-extra radeontool
  uswsusp vbetool policykit-gnome
The following NEW packages will be installed
  acl consolekit dbus esound-common gamin gnome-mime-data gnome-power-manager gnome-session
  gnome-settings-daemon hal hal-info libart-2.0-2 libasound2 libaspell15 libaudiofile0
  libavahi-client3 libavahi-common-data libavahi-common3 libavahi-glib1 libbonobo2-0
  libbonobo2-common libbonoboui2-0 libbonoboui2-common libdbus-glib-1-2 libenchant1c2a
  libesd-alsa0 libgail-common libgail18 libgamin0 libglade2-0 libgnome-desktop-2 libgnome-keyring0
  libgnome2-0 libgnome2-common libgnomecanvas2-0 libgnomecanvas2-common libgnomekbd-common
  libgnomekbd2 libgnomeui-0 libgnomeui-common libgnomevfs2-0 libgnomevfs2-common
  libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 libhal-storage1 libhal1 libhunspell-1.1-0
  libnotify1 libpanel-applet2-0 libpolkit-dbus2 libpolkit-grant2 libpolkit2 libsexy2 libsmbios1
  libwnck-common libwnck22 libxklavier12 libxres1 notification-daemon pm-utils policykit
  powermgmt-base shared-mime-info
0 upgraded, 63 newly installed, 0 to remove and 58 not upgraded.
Need to get 9834kB of archives.
After this operation, 68.7MB of additional disk space will be used.
Do you want to continue [Y/n]? 

 * Starting system message bus dbus                                                          [ OK ] 
 * Reloading system message bus config...                                                    [ OK ] 
 * Starting Hardware abstraction layer hald                                                  [ OK ] 

Printed and hosted by Prater Raines Ltd, 98 Sandgate High Street, Folkestone CT20 3BY.
Published and promoted by Ben Prescott, 14, St James's Square, Bournemouth, BH5 2BX. All rights reserved.
The views expressed are solely those of the author, not of the service provider.