jeudi 24 septembre 2009

Commande service sous Ubuntu

la commande service ne fonctionne pas sous Ubuntu (8.04 dans mon cas).

J'ai trouvé dans ce post () une solution simple pour en disposer :

  • Editer le fichier .bashrc

    • $ vi ~/.bashrc

  • Ajouter les lignes suivantes

    • service () {
         sudo /etc/init.d/$1 $2
      }

Installing Netbeans 6.7.1 on Ubuntu 8.04 and configure Maven

C'est en fait assez simple:

  • Télécharger Netbeans 6.7.1 pour Linux : http://www.netbeans.org/downloads/
    • le fichier téléchargé est un .sh, sorte de programme d'installation
  • Télécharger Maven : http://maven.apache.org/download.html
    • j'ai pris le fichier tar.gz
Installation de Netbeans :
  •  rendre le script téléchargé exécutable :
    • $ chmod +x netbeans-6.7.1-ml-java-linux.sh
  • lancer l'installation et suivre les instructions à l'écran
    • $ ./netbeans-6.7.1-ml-java-linux.sh
Installation de Maven (selon les instructions de http://www.sonatype.com/books/maven-book/reference/installation-sect-maven-linux.html)
  • décompresser l'archive
    • $ tar xvf apache-maven-2.2.1-bin.tar.bz2
  • créer un lien logique vers le répertoire d'installation
    • $ cd /usr/local
    • $ ln -s  [path]/apache-maven-2.2.1 maven
  • ajouter maven dans le path (optionnel pour l'installation dans Netbeans)
    • $ vim ~/.bashrc
      • ajouter les lignes suivantes à la fin
      • export M2_HOME=/usr/local/maven
        export PATH=${M2_HOME}/bin:${PATH}
Configuration de Maven dans Netbeans
  • Lancer Netbeans
    • l'installation crée un raccourci sur le bureau et dans le menu d'Ubuntu
  • Ouvrir les options
    • Tools > Options
  • Dans l'onglet Maven, ajouter la valeur de $M2_HOME dans le champs "External Maven Home"

mardi 12 février 2008

Wireless with Linksys WMP54GS card on Ubuntu Feisty Fawn (7.04)

Since I got a new PC running a dual boot XP/Ubuntu Gutsy Gibbon (7.10) I moved the old one to my room for my girl friend to use. Therfor, I need to get it a wireless connection by installing her soon-to-go-to-trash old pc's current card: a linksys WMP64GS.

Out-of-the-box support

I first took a shot with the very naive approch: I installed the card in the box and booted the existing install of ubuntu without touching anything.

Clearly, the card has been detected. I now have a 'wireless' connection displayed in the applet network manager.
I tried several times to connect to my wireles network. I don't get any error but it doesn't look like there is any signal.

So I did what any good Internet user would do in such circonstances: I googled.

I found out (in various places, forums and wikis) that WMP54GS wasn't supported out-of-the-box (what a surprise !) and that there were two ways to get it to work:

  • use NDISWRAPPER package to use Windows drivers
  • use the native drivers in the kernel

NDISWRAPPER

I first tried the first approach following precisly the instructions in this post (what a thread title!).
At the end of the process, it didn't seem it had any effect at all. I just found out that the GUI NDISGTK for NDISWRAPPER was buggy (I added the driver but it didn't show up in the list).
Now that I think about it, I should probably have rebooted the network interface but I didn't know how to do it at the time.

Therefore, I used the command line to remove the installed driver from NDISWRAPPER (since I couldn't select it in the GUI, I couldn't remove it).
To list the installed drivers:

sudo ndiswrapper -l
To remove a driver (the driver name I had from the previous command was "bcmwl5"):
sudo ndiswrapper -r bcmwl5

I then removed the NDISGTK package via synaptic and went on trying the other approach.

Native drivers

Installation of the native drivers for Ubuntu Feisty Fawn (7.04) can be found on this wiki page (wiki pages for other versions of Ubuntu are linked at the bottom of the page)

I had good hopes this would be it because I had noticed the error messages at startup they describe in the introduction.

I followed the instructions they provide for installation. I will put them here though in case the page disappeares and because I have a few comments.

step 1: Obtaining the Firmware

install the bcm43xx-fwcutter package.

sudo apt-get install bcm43xx-fwcutter
It will ask if you want it to download and extract the firmware, but because the link is currently broken, choose no.
Then enter the following to download the recommended driver manually.
wget http://downloads.openwrt.org/sources/wl_apsta-3.130.20.0.o
Now extract the firmware.
sudo bcm43xx-fwcutter -w /lib/firmware  wl_apsta-3.130.20.0.o

step 2: Loading module and checking card

Load the module:

sudo modprobe bcm43xx
The device gets loaded as either eth1/eth2. Find out which one it is by doing a
iwconfig
This should return the name of the interface as ethX. Check if you can scan for networks using
sudo iwlist ethX scan
This command returned that scanning was disabled or not possible on my card. So I decided to unmount and remount the card
sudo idown eth1
sudo ifup eth1
I then tried the scan command once again and then I got a big listing. I checked my wireless network was actualy in the list and then moved on the step 3.

step 3: Connecting to wireless network

The wiki page give instruction on how to setup a WPA connection with some config file. I decided I would try he GUI before getting to that.

So I clicked on the network manager applet and selected "connect to a wireless network" and entered my network details: ESSID, cypher type (I'm using WPA2 personnal) and passphrase. It just worked !

Note: before trying either approach I got the latest Linux kernel version installed (2.6.20) through package update.

samedi 9 février 2008

Ubuntu set the label of a partition or a disk

I created a new partition with linux and wanted to give it a name, but not the one the partition get from it's mount point, the "label of the partition.

After a little googling, I found out that the "label" of a partition is part of what's called the UUID and this post (in french) explains all about it.
That's where I found the command to set the label of a partition:

sudo e2label /dev/sda5 data
and how to check the UUID:
sudo vol_id /dev/sda5

How to resize /home partition in Ubuntu Gutsy Gibbon (7.10)

My new system has a partition dedicated to /home (which quite a common practice, I think) but unfortunatly I made it too big during the installation so that now I need to resize it.

Can't use GParted

I installed the Gparted package via Synaptic but Gparted can not resize a mounted partition. I don't know if it is possible to unmount the partiton of /home and still be running a shell as anything but root.

Since Ubuntu doesn't allow logging in as root (I think) and that I didn't want to risk anything, I found another way: the installation CD.
That will be the alternate CD in my case because I've got a 8800GT not supported by the liveCD.

Using the alternate installation CD

Insert the CD in the CD drive and reboot. When prompted, choose "repare broken installation" (or something like that).

The text installation starts as would a fresh installation start. It detects the network, asks for a machine name.
When you get at the point where the installation asks which device to mount on "/", stop and clic the "cancel" or "back" button.
You should be getting to the screen where you can choose to got to a specific step of the installation process (it's a long list). Select the one for the partition tool.
Once the tool has detected the drives, select the one partition mounted to "/home".
On the new screen, you see details of the selected partition and several possible actions at the bottom (among which there is the quit this screen option), select the "resize this partition" option.
On the new screen, indicate the new size of the partition. And "click" the "ok" button and let the tool resize your partition !
Once you get back to the partition detail screen, select the "quit this screen" action.
If you don't want to create a partition for the now available disk space, click the "cancel/back" button and do it using Gparted after the reboot.
You should be back on the screen where you can choose a specific step of the installation, select the "quit/cancel installation" (at the bottom) option. You can now reboot, that's it.

How to use 1680x1050 (SWXGA+) with 2232BW monitor on Ubuntu

Ubuntu does not support the 2232BW's 1680x1050 resolution

At the time of this post, and to my knowledge, Ubuntu has no support for Samsung's 2232BW monitor.
Still, one can use the generic driver with the 2232BW, such as the 'Plug'n'Play monitor' driver or the 'LCD Panel 1680x1050' driver.

Unfortunately, these drivers work for most resolution but the native and maximum resolution of the 2232BW: 1680x1050. This is indeed the resolution that anyone would want to use with such a screen.

After spending several evenings trying to make the 1680x1050 resolution work googling a lot and posting on the Ubuntu forum, I managed to fix the situation which could be described as follow: I could switch to 1680x1050 with Gnome's menu for selected screen resolution (and also monitor and graphic card drivers) but if I reboot the X server (say I log out or reboot the computer) I always get back to 1600x1024.

I actually had to fix to problems

  • No specific driver for the 2232BW means that the modeline for 1680x1050 is not the right one. So when rebooting the X server, it rejected the modeline for 1680x1050 and switched back to the resolution just below (1600x1024)
  • Gnome memorizes the screen resolution and refresh rate to use during the session which means that even if you fix the modeline, you get back to 1600x1024 when getting on you desktop.

X setup for the Samsung 2232BW

First of all, I must say that I'm running a fresh new install of Ubuntu Gutsy Gibbon (7.10) and that my graphic card is an NVidia 8800GT. This graphic card is not supported from scratch so I installed the latest NVidia driver (see this post for instructions).
This means that the information below might not work with a different setup.

I believe the X config file I modified is the one created by the NVidia driver when I installed it. I changed only what is listed below.

I use the following Section "Monitor" for the 2232BW in my X server configuration file (/etc/X11/xorg.conf):

Section "Monitor"
 Identifier "SyncMaster"
 Vendorname "Samsung"
 Modelname "2232BW"
 Horizsync 31-81
 Vertrefresh 56.0 - 75.0
  modeline "1680x1050@56" 140.76 1680 1712 2240 2272 1050 1071 1081 1103 -hsync +vsync
 Gamma 1.0
EndSection

The Identifier, Vendorname and Modelname fields values are my own. I believe that what you use in this fields does not matter as long as use correctly refer to the Identifier in the Section "Screen".
I found the values for the Horizsync and the Vertrefresh in the PDF user manual on the driver CD provided with the monitor.
See below for details on the modeline.
The Gamma value is the one from the Section "Monitor" I copied, I didn't change it.

I use the following Section "Screen":

Section "Screen"
 Identifier "Default Screen"
 Device  "nVidia Corporation NVIDIA Default Card"
 Monitor  "SyncMaster"
 Defaultdepth 24
 SubSection "Display"
  Depth 24
  Virtual 1680 1050
  Modes  "1680x1050@56"
 EndSubSection
EndSection
I only changed the Monitor field to match the Identifier of the Section "Monitor" and the Modes field to list only the working mode.

One could want to have more than one modeline in the Section "Monitor" for all the lower resolutions available. I would suggest using the one from the "LCD Panel 1680x1050" except the one for 1680x1050. Here they are:

  modeline  "800x600@56" 36.0 800 824 896 1024 600 601 603 625 +hsync +vsync
  modeline  "800x600@60" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync
  modeline  "1280x768@60" 80.14 1280 1344 1480 1680 768 769 772 795 -hsync +vsync
  modeline  "1280x720@60" 74.48 1280 1336 1472 1664 720 721 724 746 -hsync +vsync
  modeline  "1280x800@60" 83.46 1280 1344 1480 1680 800 801 804 828 -hsync +vsync
  modeline  "1440x900@60" 106.47 1440 1520 1672 1904 900 901 904 932 -hsync +vsync
  modeline  "1600x1024@60" 136.36 1600 1704 1872 2144 1024 1025 1028 1060 -hsync +vsync
When I used the "LCD Panel 1680x1050" driver, I saw that they are actually valid modelines but I didn't try them with the 2232BW driver.
If you want to check if the modeline are valid, check the log file /var/log/Xorg.0.log after you've rebooted the X server (log out or use CTRL+SHIFT+BACKSPACE). There is a section in it where the validated and rejected modelines are listed.

The XFree86 Modeline Generator

I used The XFree86 Modeline Generator to create the modeline I use. I didn't get it right right away, I had to try various refresh rates first.

For each modeline, I used the following values (and left the other fields but "Refresh rate" empty):

  • Horizontal Sync Rate: 31kHz min 81kHz max
  • Refresh Rate: 56Hz min 75Hz max
  • Visible Resolution: 1680x1050 pixels
  • Constrain Aspect Ratio: 16/10

Gnome's resolution config file

To solve my second problem, I found this post just when I was about to post my own message on the Ubuntu Display manager forum.
It just says there is a config file where gnome stores the screen resolution to use during the session (just what I was looking for !).
The path to the config file is not correct but It showed me the way. Here is the correct path:

~/.gconf/desktop/gnome/screen/default/0/%gconf.xml
I edited it and changed the information to the right resolution and refresh rate, saved, restarted X and logged in. WSXGA+ baby !
Here is the content of the new %gconf.xml:
<?xml version="1.0"?>
<gconf>
        <entry name="rate" mtime="1202330703" type="int" value="56">
        </entry>
        <entry name="resolution" mtime="1202330703" type="string">
                <stringvalue>1680x1050</stringvalue>

        </entry>
</gconf>

mardi 5 février 2008

Install Ubuntu 7.10 (Gutsy Gibbon) on a Asus P5B + 8800GT + Samsung 2232BW

I've decided to make my new PC a dual-boot system with Windows XP and the lastest version of Ubuntu: Gutsy Gibbon (aka. Ubuntu 7.10).

Using the live CD of Ubuntu 7.10

I downloaded the installation CD of Ubuntu 7.10, the one with the live cd installation. No matter what installation mode I used (normal, normal with a specific resolution, safe-mode graphics), I can get through to the Ubuntu desk in order to start the installation.

In normal mode, I get the message that my monitor and my graphic card are not detected. I tried selecting the generic monitor for the 2232BW and either the VESA or the NVidia driver for the 8800GT, I always get stuck to the 4 lines in text mode, the last one saying "executing local script" or something like that.

Support for the 8800GT

I googled a little a found out in that post and several others confirmed it, that:

  • 8800GT card are not supported in Ubuntu 7.10
  • One need to install the latest NVidia drivers to get support for 8800Gt (currently 169.09, http://www.nvidia.com/object/unix.html)
  • NVidia driver 169.07 as a bug which makes the graphic card's fan run 100% all the time
  • The best way to install Ubuntu is to use the alternate cd and install the drivers after install is done

Using the alternate CD

So, I downloaded the alternate CD and I encountered no problem setting up the partitions, install ubuntu and the dual boot (ie. Grub). The interface is very well done and all of this is prettry straight forward.

Once installation done, I let the system boot on ubuntu and get the same message I got on the liveCD: my graphic card and monitor are not detected. I don't bother trying to configure anything, I will install the NVidia driver first.

I click "shut it down" to get to a console using CTRL+SHIT+F1 and follow precisle the instructions in this post and manage to install the driver.

After a reboot (could have only startX, though), I see the login screen and can log into a Gnome session without a problem.

One of the step in the post is to let the driver compile a new kernel and configure X but it is not very well detailed how. Here are the details.
When running the NVidia installer, you're asked to download a kernel, don't do it, it will fail anyway. The say 'yes' when asked whether to create a kernel or not. Then you're asked whether you want to let the driver installation configure X or not. Answer 'yes'. That's it.

Running in 1680x1050 (WSXGA+) with the Samsung 2232BW

Now, I get picky and check the screen resolution. It's only 1600x1024. It's neither 16/10 ratio nor the native resolution of the screen nor the maximum resolution for the 2232BW, it's 1680x1050. I found a way to make it work and will detail how in an upcoming post.

Support for the P5B

Because I had some issue setting up my PC, I already know that the JMicron (which is THE specific piece of hardware of the P5B motherboard people had problem with) is supported in linux kernel 2.6.19. Since Ubuntu 7.10 is based on version 2.6.23 that won't be a problem.