Tuesday, April 17, 2012

Things you can do with packages based on time.

RPM keeps a history of installed things. In opensuse there is also a var log zypp history.  Here is an example of checking packages based on time.

    rpm -qa --qf '(%{INSTALLTIME:date})%{NAME}\n'

Will yield something like this:

 (Mon 20 Feb  2012  01:45:49  PM   UTC) libSDL-devel
 (Wed 30 Nov 2011  06:24:38  PM   UTC) kdebase4-workspace-liboxygenstyle
 (Sat   14 Apr  2012  07:27:40  AM   UTC) ffmpegthumbnailer
 (Wed 30 Nov 2011  06:19:28   PM  UTC) ptools
 (Thu  05 Jan   2012  07:41:54  AM   UTC) NetworkManager
 (Fri    11 Nov  2011  12:17:16  AM   UTC) xorg-x11-driver-video
 (Wed 01 Feb   2012  01:32:00  AM  UTC) libmysqlclient_r18
 (Wed 30 Nov  2011  09:22:45  PM   UTC) libwpg-0_2-2
 (Wed 30 Nov  2011  06:21:22  PM   UTC) gegl-0_1
 (Sun  01 Apr   2012  08:00:55  PM  UTC) glibc-locale-32bit

Ckecking /var/log/zypp/history

  while  IFS=\| read -ra line; do [[ $line = \#* ]] && continue; echo "${line[0]} -> ${line[2]}"; done < /var/log/zypp/history  

Or if you change your shell to something more advance :-), you can use awk.

 awk -F '|' '/^#/ {next} {printf("%s -> %s\n", $1, $3)}' /var/log/zypp/history 

Will yield something like this:

 2012-04-16 06:41:57 -> libquicktime0
 2012-04-16 06:42:23 -> avidemux
 2012-04-16 06:42:26 -> libswscale0
 2012-04-16 06:42:28 -> libpostproc50
 2012-04-16 06:42:41 -> libavcodec52
 2012-04-16 06:42:49 -> smplayer
 2012-04-16 06:42:54 -> gmplayer
 2012-04-16 06:43:02 -> mlt
 2012-04-16 06:43:40 -> kino
 2012-04-16 06:43:44 -> libavformat52
 2012-04-16 06:43:57 -> smplayer-themes
 2012-04-16 06:44:15 -> kdenlive
 2012-04-16 06:44:18 -> libavfilter1

If you want to know when a specific package was installed or updated you can just filter out the correct package name as shown on  below.

 rpm -qa --qf '(%{INSTALLTIME:date}) %{NAME}\n'  '*packagename*' 

Using awk to print out a certain field but in this example we just print out the whole line.

  awk '/packagename/{print $0}'  < <(rpm -qa --qf '(%{INSTALLTIME:date}) %{NAME}\n') 

Replace packagename with the correct one and you should be fine. That  looks good, now we want to take action about the packages that is based on a certain time/date. First we need to sanitize the packages names, meaning we only need to extract the names and not the date so we can take action (eg pass the output to zypper). Let us go back to the first example using rpm to query packages. IMHO a better tool for extracting only the names is awk. Here is an example.

 rpm -qa --qf '(%{INSTALLTIME:date}) %{NAME}\n' |  awk '/Sun 01 Apr 2012/{print $NF}'  

 will yield something like this:


The awk code above looks for lines with the date 'Sun 01 Apr 2012' on it and then prints the last field so the result is just the package names that we are after. You can test the output without printing the last field by removing the last part of the code, then the awk code will be like   awk '/Sun 01 Apr 2012/' . You can even add the specific time (hours minutes and seconds) so you can have more control on the search, just add the end of the date of your awk code before the last /. After that you need  to pass it to zypper, fortunately bash4 has a builtin feature called mapfile aka readarray. This is an example of using mapfile for that, run this code as a normal user like the rest of the previous code.

    mapfile -t < <(rpm -qa --qf '(%{INSTALLTIME:date}) %{NAME}\n' | awk '/Sun 01 Apr 2012/{print $NF}')

  echo zypper rm "${MAPFILE[@]}"

You will see the out put of what zypper will remove from your installed packages. If you are satisfied with zypper's proposal then you can run that above code; again as root without the 'echo'  so that zypper can remove the packages. Remember that mapfile is a bash4 feature if your bash is lower than bash4 you can use read and IFS.

  IFS=$'\n' read -rd '' -a files < <(rpm -qa --qf '(%{INSTALLTIME:date}) %{NAME}\n' | awk '/Sun 01 Apr 2012/{print $NF}')

  echo zypper rm "${files[@]}"

  For those of you who change the default shell to something more advance :-). Try
 creating a script with a shebang  #!/bin/bash  and put the out put of the code:

   rpm -qa --qf '(%{INSTALLTIME:date}) %{NAME}\n' | awk '/Sun 01 Apr 2012/{print$NF}' ORS=" " > myscript

Now open that myscript with your favorite text editor and add the shebang then prefend   zypper rm   and a literal white space before the first package name then make it executable and  finally execute it.

I have done this only in a vm just for a proof of concept and it works as expected. I have never been in a situation where i am forced to do such hacks in my production system. For those of you who are adventurous enough to try tumbleweed release then this might be the solution if you ever get into desperate situations that needs desperate measures to solve  it :-).

Take it easy!


Saturday, March 10, 2012


This is an interactive script that can handle most of the task regarding systemd services. It is just a front end for systemctl and not a replacement. What it does is it make's your life easier by avoiding to type extension '*.service' again and again  while dealing with services. Imagine if you want to stop at least 4 services at once, hence you will type 'systemctl stop one.service two.service three.service four.service' , you need to type additional eight  characters on each service names  which means 32 characters long! Systemd-qserv will allow you to enter just their names without an extension '*.service or even a mix of like 'apache2 sshd msyql xinetd.service nfs.service' would be just fine.

So why did it came up in OBS? while other scripts that are well written did not end up in OBS? first of all kudos to Boris Manojlovic for packaging this stuff. Now to answer the question, most of the script's that are out there is specific to just one application. Come openSUSE 12.1 systemd is the default whether you like it or not and it does not care what DE do you use or if you even use one at all. You can find the package in my home repo.  The source is there too.


This is an example of running qserv.sh directly as a normal user. and trying to stop some services.

 As you can see normal user can run the script since it is only a front-end to systemctl but stopping service or services will be done by systemctl itself and this script has no control over systemd's systemctl!

Now for those of you who shun systemd-qserv you can do some tricks to avoid repeating *.service again and again. Here's an example.

 systemctl start {apache2,sshd,mysql,nfs,cifs,cups,vboxdrv,postgresql}.service 

The above code is equivalent to:

 systemctl start apache2.service sshd.service mysql.service nfs.service vboxdrv.service postgresql.service 

This works on a bash shell which is the default for openSUSE, if you change your shell, then you probably know what you are doing so have fun doing the same with your current shell :-)

Just try it sometime folks.

Tuesday, March 6, 2012

halt or Halt?

Some folks missed the old halt command which seems to work the same as power off. OpenSuSE now uses /sbin/shutdown for that matter, how ever you can still have the same command with some few steps as explained below.

Create  the file    /etc/bash/bashrc.local    (assuming that you are using bash as your shell ) or any place that a shell is sourced when it is invoked and put the line below.

  Halt() { if (( $EUID == 0 )); then  shutdown -h -P now; else su root -c'shutdown -h -P now'; fi ; }  

Now as a normal user and root can invoke the command   Halt    and will point to /sbin/shutdown with the arguments -h -P. As a normal user you will be ask for the root's password. Notice the capital H and not h, halt is already in the root's path so we used the capital H but if you want to use halt to replace Halt from the beginning of the line which is still possible and without any issues, the only issue with this is that you get used to that command that is defined in your current system and then when your not in that system and run halt, you will end up scratching your head as to why it did not work as expected! Now how can you be so sure that this is the first to be called and not the one that is in your root's path? See man bash COMMAND EXECUTION for more detailed info. So how can you be so sure that bash is your default shell? you can check the config file  /etc/passwd   by running the command.  grep username /etc/passwd    where username is your username.

To explain about whats going on in that line above here are some explanations.

That line is called a function see man bash and look for functions. In short functions are the same as an alias but more powerful and has more advantages. It is using the if clause/statement that checks if the user's user id that is running that command is equal to 0 (which is root) or not. When it found that root is running the command it will run the first command which is  shutdown -h -P    if it is not root it will run the second  command which is   su root -c'shutdown -h -P now'  . As to why we choose to put  in   /etc/bash/bashrc.local   run   head -n 8 /etc/bash.bashrc   so you can read up about that local file. Come 12.1 systemd is in used by default so for those of you who are a systemd hardcore fan boys/girls you can just replace the  shutdown -h -P now  with   systemctl poweroff   and your systemd will be in full force :-). This setup is not specific to any DE, it will work even on a minimal install or the server install. KDE has its own settings which you can find in    /usr/share/kde4/config/kdm/kdmrc     other DE might have their own config file as well. When you want to check if a program or command  is already installed one would use the external command  which  but it does not know about functions or builtins of bash. One could use the built in   type   of bash as a normal user run  type Halt  and you should see something like this.

Halt is a function
Halt ()
    if (( $EUID == 0 )); then
        shutdown -h -P now;
        su root -c'shutdown -h -p now';

Add an -a flag so you can see if there are more than one match. A Reboot function is easily created using the same syntax by the way :-).

Enjoy folks!

keeping packages locally

This might be useful if you have a limited internet band width. Just in case you need to reinstall or install from another machine, you do not need to download the packages again.

After the installation immediately before you run the update in your fresh installed suse run the command below, It will ask you the root's password and will tell you that rpm caching is enabled on the remote repositories.

Activate packages caching on your enabled repositories. Create a function like this and put it in /etc/bash.bashrc.local

keepackages () {
    if (( EUID !=0 )); then
        echo 'Root privileges are required for modifying system repositories.' 1>&2
        return 1
    while IFS="|" read -ra line; do
        [[ ${line[3]} = *Yes* ]] && zypper mr -k "${line[0]// /}"
    done < <(zypper lr)

Now you can just run   keepackages 

Backup the file  /etc/zypp/zypp.conf run the command:

  su root -c'cp /etc/zypp/zypp.conf  /etc/zypp/zypp.conf.orig'  

Edit that zypp.conf file run the command:

  printf '%s\n' 'g/^#[[:space:]]*download.use_deltarpm/s/^#[[:space:]]*/' w | ed -s /etc/zypp/zypp.conf   

 printf '%s\n' 'g/^\(download\.use_deltarpm[[:space:]]*=\)[[:space:]]*true$/s//\1 false/' w | ed  -s /etc/zypp/zypp.conf  

This section of that config file explains what it's doing. Of course you can just uncomment out that entry :-).

## Whether to consider using a .delta.rpm when downloading a package
## Valid values: boolean
## Default value: true
## Using a delta rpm will decrease the download size for package updates
## since it does not contain all files of the package but only the binary
## diff of changed ones. Recreating the rpm package on the local machine
## is an expensive operation (memory,CPU). If your network connection is
## not too slow, you benefit from disabling .delta.rpm.
# download.use_deltarpm = true

## Whether to consider using a deltarpm even when rpm is local
## Valid values: boolean
## Default value: false
## This option has no effect unless download.use_deltarpm is set true.
#  download.use_deltarpm.always = false


If you want to check which is option it is using you can run grep on it.

 grep -E -v '^($|#|;|\[)' /etc/zypp/zypp.conf 

You are now ready to update your system use the command below and accept the package key's.

 su root -c'zypper ref && zypper up' 

When it's done reboot just to be sure that update will take effect on your system and you can   find those rpm packages inside the directory  /var/cache/zypp/packages/   and it has it's own sub directories. Create a directory somewhere and copy those packages in there. While you are inside your home directory you can do the following commands.

Create a new directory.
   mkdir public_html/packages/  

Copy the rpm' from source to destination.
This rely on GNU/find and since suse use it by default it is not an issue and it should be used.
   find /var/cache/zypp* -name '*.rpm' -exec  cp -vu  {} public_html/packages/  \;

 New to bash 4.
 shopt -s globstar; rpm=(/var/cache/zypp*/**/*.rpm);  cp -vu "${rpm[@]}" public_html/packages 

This is a portable solution according to the demi god's with in the bash world! :-)
 find /var/cache/zypp* -name '*.rpm' -exec sh -c 'cp -vu -- "$@" public_html/packages/' _ {} + 

When you installed a package using zypper but it is a local install that rpm will be inside   /var/cache/zypper/  so using the   *   glob pattern matching will match zypper and zypp. So  you dont need to replace    /zypp   with  /zypper  to copy packages from those directory. Also it makes no sense to look for packages under   /var/cache   and as a normal user you don't have enough permission to poke into some directories under it.  That find command will search recursively for the file extension ending in rpm using also the (   glob ) and cp copies all of those files into your newly created directory, while the -vu flag means verbose and update so it only copies the new rpm from the source to it's destination and not copy everything again from the beggining.  You can change the path of the destination at your own heart's content but this place is important for the next step that will be describe about creating your local repository. You can run that command every time you install a new package. Just remember if you add a new repository before you install anything run the very first command in this guide so that package caching will take effect on that repo as well. When the time comes that rpm's are filling up your   /var/cache    directory you might need to delete them all, well you can just delete them at once using zypper. If you want to clear the   /zypper   directory you can use the find command as shown below. You can modify the path so you can delete other rpm's. We need to be root since that directories are restricted for read rights for normal users. Just remember to be careful when deleting files from the shell because it might not be recoverable.

Using zypper and it should be your first option.
  su root -c'zypper clean --all' 

 Search and Destroy rpm packages if zypper did not do it's job well!
   su root -c'find /var/cache/zypp*  -name '*.rpm' -delete' 

New to bash 4
 shopt -s globstar; rpm=(/var/cache/zypp*/**/*.rpm);  rm  "${rpm[@]}" 

Now what if you forgot to do rpm caching and did the update, is it still be possible to download the rpm and it's dependencies? The answer is yes, but only if those rpm packages are in your list of repositories. Fortunately zypper will just tell you if the packages that you are trying to re download is not found at any or your repos. Zypper will ask you to resolve some dependency issue and will give you some options, just don't choose the "break your system and be happy" option :-).  Thus we can run the command as root:

   readarray -t packages < <(rpm -qa --qf '%{NAME}\n'); zypper in -f -d "${packages[@]}"  

                                                         The other version :-)
  mapfile -t < <(rpm -qa --qf '%{NAME}\n'); zypper in -f -d "${MAPFILE[@]}"  

                              If you dont have bas4 which is highly unlikely but hey....
  IFS=$'\n' read -rd '' -a packages < <(rpm -qa --qf '%{NAME}\n'); zypper in -f -d "${packages[@]}"  

Just choose one but it is specific to bash 4 only. What it does is readarray aka mapfile load lines from a file or stream. The rpm command put it's output in that file or mapfile and then zypper read's those output one at a time. The -f switch is to do a force reinstall and the -d switch is download only,  just to download only and not install. To understand what's going on in that rpm command you can try to run it in a shell just remove it inside the open and close ( ) parenthesis.That odd looking "${packages[@]}" is indeed very useful since it quote all the element before zypper can read it and from experience if you have an rpm which name has a white space in between, it will save you the head ache :-). After it's done you can repeat  that find command so it will copy the newly downloaded rpm to your  public_html/packages    directory.

Now you have yourself a local copy of rpm in you and ready for future use. You can create a local repository using yast. Just point it to that directory (packages/) and your good to go. If you want to make a remote repository of those rpm files you can create a plain rpm repo using the package createrepo. You will need a running http server for that since it is the most easy to setup. The following steps will guide you to setup a local repository using the http protocol.

Install the pattern lamp_server and createrepo.

  su root -c'zypper in patterns-openSUSE-lamp_server createrepo' 

Go inside that packages/ directory and run createrepo.

 cd public_html/packages && createrepo .     #note the trailing white space and a dot.

 It will create a repodata/ directory, go inside that directory and

  cd repodata/ 

generate your key it will ask you some simple but important questions.

  gpg --gen-key 

Check your generated key.

  gpg --list-key    

Create a  detached signature repomd.xml.asc to repo.xml.

  gpg -a --detach-sign repomd.xml 

Create a repomd.xml.key file and export the public key to it.

  gpg -a --export YOUR_PUBLICKEY > repomd.xml.key   #note the direction

Start your http serve.

  su root -c'rcapache2 start' 

Systemd from starting from 12.1
 systemctl restart apache2.service 

Now in your browser type the url below where username is the user in your system.


If that is successful  you can add that repo via zypper or yast. Use the command below to add that repo via zypper.

 su root -c'zypper ar http://localhost/~username/packages/ local' 

Where username is the name of the user and local will be the name of that repository, you can change that to whatever you want it to be called.

Refresh that newly added local repository.

   su root -c'zypper ref local' 

Accept the public key and your repo is good to go.


If you are accessing it remotely meaning from another machine or from a virtual machine replace the localhost with it's correct ip which you can get from the out put of  ip r   Now you have your own remote repository in your  lan! If you added some new rpm packages on your repo you will need to run createrepo again so createrepo will know that there are some changes.


The following links below should help you set up if not get an idea about setting up your repositories locally.

Verbose or Silent

When booting up OpenSuSE normally you will see the clean and green splash screen and if you want to see what is going on behind it you need to press the escape button. Now if you want to change it permanently and not having press the button every time you boot you need to do the following.

1. Legacy GRUB
If you are using the old legacy grub you can edit menu.lst directly or by using
   yast2 bootloader. 

When you are log in as a normal user open up a terminal and run.
  •  su root -c'grep -i silent  --colour=auto /boot/grub/menu.lst' 

Enter the root's password and you should see the red text that matches the string silent. This is the option the controls what to display during boot up. silent means to show nothing during the boot process you can do a quick edit to it by using perl. As always we need to back up everything we are editing as a good practice.

First backup menu.lst
  •   su root -c'cp /boot/grub/menu.lst /boot/grub/menu.lst.orig' 

To edit that menu.lst file
  •  su root -c"perl -pi -e 's/silent/verbose/g' /boot/grub/menu.lst" 

Since perl is not a file editor a lot of folks will raise some eyebrows about the code above. Ex is an editor so it is prefered over perl. As root run.
  •    ex -sc "%s/silent/verbose/g|x" /boot/grub/menu.lst  

Check if that did the trick run grep again but with the verbose string.
  •   su root -c'grep -i verbose --colour=auto /boot/grub/menu.lst' 

If that will show the verbose string in it then you are successful. You can now reboot and check if it works,  well it should  but just to be  sure.

2. GRUB 2
Menu.lst is replaced by /etc/default/grub if your using grub2. To be able to edit that file you need to be root.

Again backup the files you are editing.
  •  cp -v /etc/default/grub /etc/default/grub.orig 

Edit that file using ex.
  •    ex -sc "%s/silent/verbose/g|x" /etc/default/grub  
Check if it made the changes. As a normal user you have read access to that file so you dont need to be root to check it unlike menu.lst. As a normal user you can run.
  •   grep -o verbose /etc/default/grub || { echo "It is not verbose." >&2; }  
      You should see a red colored  verbose  ouput in your screen. If you see permission denied then that means you dont have read permission on that file so you need to run the latter command with root rights :-)

      Now backup first /boot/grub2/grub.cfg
      •  cp -v /boot/grub2/grub2.cfg /boot/grub2/grub2.cfg.orig 

      To make the changes recognize by grub2 as root run.
      •   grub2-mkconfig -o /boot/grub2/grub.cfg  

      For some reason you cannot boot because of some grub error's most probably you did something un intended :-) you need to boot from the live media and mount the partition where your /boot directory resides normally if you did not make a separate boot partition that menu.lst file is in the root partition so it will depend on your partition set up. first moun that partition and then copy that menu.lst back to its original name.

      Mount the partition where your menu.lst is located.
      •   su root -c'mount /dev/sXX /mnt' 

      Replace XX with the correct value.

      Legacy grub.
      To restore the original menu.lst file
      •   su root -c'cp /mnt/boot/grub/menu.lst.orig /mnt/boot/grub/menu.lst' 

      •  cp -v /mnt/etc/default/grub.orig /mnt/etc/default/grub    
      •  cp -v /mnt/boot/grub2/grub2.cfg.orig /mnt/boot/grub2/grub.cfg 

      Where /mnt is the mount point where your disk is mounted it could be in  /media as well but here we choose that directory. umount that root partition and reboot, all should be fine now and start from the beginning.

      Happy booting!

      Last Edited: Sat Aug 31 07:47:45 PHT 2013

      Java on OpenSuSE 12.1

      Oracle Java license has changed so the normal rpm package that you will normally find in the repos like packman and such  does not exist anymore. icedtea-web is the plug-in for web browsers which works most of the time and openjdk as the alternative jre. You can find the binaries from java.com and install it. Here is a quick guide about installing the binary version. This is for 64 bit version only DO NOT use this guide if your using a 32 bit system.

      First remove icedtea plug in for your browser and put  a lock on it since it is dependent on openjdk which you can leave in your system. Use zypper to remove and lock packages

      •      zypper rm  icedtea-web  &&  zypper al icedtea-web 

      Create a directory where you will put the package, we choose /opt since it is the normal place where third party packages is installed. As root run the command.

      •    mkdir -p /opt/java/64    

      Now download the package from java.com and put it in the directory you have just created.

      •    wget -O /opt/java/64/jre-6u30-linux-64.bin http://javadl.sun.com/webapps/download/AutoDL?BundleId=58119  
      Make it executable

      •   chmod +x /opt/java/64/jre-6u30-linux-x64.bin 

      go to the directory where the bin file is and execute that file.

      •  cd /opt/java/64/  &&  ./jre-6u30-linux-x64.bin 

      use update alternative  to configure your system.

      •   update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/jre1.6.0_30/bin/java"  1   

      to switch from openjdk to use the jre from Oracle.

      •   update-alternatives --set java /opt/java/64/jre1.6.0_30/bin/java  

      Now to fix the browser plugin issue. This will be usable for every user and every browser in your system.

      •  ln -s /opt/java/64/jre1.6.0_30/lib/amd64/libnpjp2.so /usr/lib64/browser-plugins/ 

      Restart your browser and check the plugin. type    about:plugins    in the url and scroll down until you see something like this.

      One more test if you have it installed on your browser go to java.com and check if you have it installed.

      External links and source.  

      phpVirtualBox on OpenSuSE 12.x

      phpVirtualBox home page is in http://code.google.com/p/phpvirtualbox/. It is just a web interface which is written in php that controls, access and monitor your vms. In short a browser that controls your vms. You will need to install VirtualBox since it is  just a front end. Refer to my guide on how you can install vbox. One more thing to note is that the package from the distro does not have vboxwebsrv  this works only for the binary from Oracle. After you have installed vbox you will install a web server. We will use apache2 as an example. You can either use yast2 software management to install the lamp_server pattern and some php packages or use our friend zypper.

      • To install the packages using zypper
           .     zypper in patterns-openSUSE-lamp_server php5-soap      
        • Download the package using the wget utility while your are a normal user in your home directory
         .     wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.1-5.zip 
        •  Unpack that zip file using unzip into your public_html directory.
              unzip phpvirtualbox-4.1-5.zip -d ~/public_html/ && cd ~/public_html 
        • Rename that file to just phpvirtualbox
            . mv phpvirtualbox-4.1-5 phpvirtualbox && cd phpvirtualbox 

        • Now rename the php file
            mv config.php-example config.php 

        • Edit that config.php file and put the name of the user which uses virtualbox and the corresponding line and do it like this.
          var $username = 'jetchisel';                                  
          var $password = 'mypassword';

          var $ location = '';  

         var $consoleHost = 'IP ADDRESS OF YOUR COMPUTER'; 

        • Start apache2, as root
        r         rcapache2 start 
        • 12.1 and up use: 
                  systemctl start apache2.service 

        This should open port 80 for http, a simple   nmap localhost   before and after you run that command will tell you if the port is open or not. If if does not open it, you can use   yast2 firewall   to open the port manually as shown below.

        • Start vboxwebsrv as a normal user.
                          vboxwebsrv -b  

        • Check if vboxweb is indeed running.

         grep vboxwebsrv < <(ps aux)
        1000 3284 0.1  0.2 562672 6056 ?  Sl 17:04 0:01 /usr/lib/virtualbox/vboxwebsrv -b

        • Use pgrep to check the pid of vboxwebsrv.

         pgrep -x vboxwebsrv -u "$EUID" 
        • On your browser put the following address, just don't put my nick in there :-) replace it with your own.

        username = admin
        password = admin

        You can run this command   rdesktop-vrdp -xl -z localhost:3389  to access your vm once it is running since all the vms that will start from this web interface is headless.The port 3389 is the default settings in vbox once you have done it on the settings, but you can always change it to whatever port you want.
        The good thing is that there is a built in  console button at the right end corner of the web interface which you can use to connect also :-) .

        You can try to access phpvbox from within your lan provided that you have open http port on the firewall. You can stop the firewall completely as root run

        • 12.1 and up use:
               systemctl stop SuSEfirewall2_init.service 

        • Other versions use  
              /sbin/SuSEfirewall2 stop 

                                                                 Change the port as well

        If you get an error that say's cannot connect to vboxwebsrv then you can run VBoxManage as a normal user.  DO NOT run VBoxManage as root!!!

            VBoxManage setproperty websrvauthlibrary default
            VBoxManage setproperty websrvauthlibrary null

        Check if vboxweb is running and if you have more than one vboxweb running you can kill that process as a normal user run   pkill vboxwebsrv  and restart apache2 as root run  rcapache2 restart    then start again from the beginning. 

        The end :-)

        This guide only uses the user's home public_html directory for phpvbox and not in    /srv/www/htdocs   which is the default location of the document root files from apache2 in openSUSE. Messing with it means you have to be root, which means you should know what you are doing. If your just trying it out for the first time then this set up should be enough. This software is developing so expect some good changes, also keep in mind that future release may not work as expected from this guide and last but not least it may have some rpm packages in the future provided someone will package this for OpenSuSE.

        Enjoy folks!

        Kudos to Mr. Ian Moore the author of phpvirtualbox.

        My reloaded phpvirtualbox howto.


        The documentation for linux configuration of phpvirtualbox you can find in this site.

        DWM-152 on Opensuse 12.1

        Details of this D-Link modem you can  find here. Once plug in
         lsusb    will show   07d1:a804 D-Link System  

        and  dmesg 

         ls -l /dev/sr* 

        Check which is your cd roam drive

        the above shows only 2 /dev/sr* devices which sr0 is my internal cd/dvd drive. If you have more than one drive then try to find which is the correct device you will need to eject.

        In this case we need to eject sr1 so we run the command:
         eject /dev/sr1 

        run  lsusb   again will yield something like this   07d1:7e11 D-Link System  
        run  dmesg     

        Now run as root   /sbin/modprobe usbserial vendor=0x07d1 product=0x7e11  
        wait a few seconds and your device should be recognized as a modem, you can configure your modem either with NetworkManager or yast. Thats all!

        Enjoy folks

        Look Mah, I got a new DVD drive

        Replacing a dvd drive in any OS is due to happen and it's inevitable. either because its broken, busted or you just want to replace it with  a new shiny full featured dvd drive. In SuSE  It will work-out-of-the-box as i assume it would  be in any other distro  but sooner or later you will encounter some annoying message, you will get an error while using the "eject" command.

        If you want to play a disc entry using VLC.


        Checking the device entry:

         ls -l /dev/cdrom* 
         ls -l /dev/dvd* 

        Then checking out   /etc/udev/rules.d/70-persistent-cd.rules   will yield something like this.

        There's your culprit. A quick solution would be adding the 1 at the end of the device. Although the first entry is a VBOX_CD-ROM since this system came from a vbox install The same is true if you have replaced your drive or clone your system and booted from another machine.

        Quick fix:
         eject /dev/cdrom1 

        vlc /dev/dvdrom1

        That should fix that issue but that's not what we want. Unfortunately   yast   has no module entry for DVD/CD drives so the permanent fix would be removing that file from the udev directory as shown below.
          mv /etc/udev/rules.d/70-persistent-cd.rules /tmp   

        here we choose the /tmp directory but you can put it somewhere else. A simple reboot would fix the issue, and udev will reconfigure your drive by creating a new entry in the udev directory with only your new drive in it, but you can force udev to reconfigure your hardware without a reboot by executing the following command as root.

        Using force:
         /etc/init.d/boot.udev force-reload 

        The more gentle approach:
          /etc/init.d/boot.udev stop && /etc/init.d/boot.udev start  

        Systemd starting from 12.1
          systemctl restart udev.service  

        That will create entry for that file we just removed from it's directory. Doing again those check's we did before should make you a happy camper.

        Have fun playing dvd's!!!

        OpenSUSE on USB (Reloaded)

        There are many guides on how to install suse on an external media such as  usb drive including my previous posts. This guide will try to make it as easy as possible so people  that do not have any experience in installing suse on an external drive can cope up with this guide.

        Please read the whole tutorial first before you proceed!!!

        Things you will need:

        External drive or a pendrive  ( at least 5 GB )
        Installation media DVD/CD, net-install CD and so on.

        Lets get started, insert the installer to its drive or boot from the installer while your usb-drive is inserted to its port and make sure that your machine is set to boot with a usb device!

        Start the installation.

        Should you choose to update an existing install and use auto configuration this is the best place. For most folks auto config is enough however should you choose to do it manually you can remove the check in the box.

        This is where you choose which time and place you reside.

        Here you can choose which D.E (Desktop Environment) you need to install. There a lot of options including the two major linux D.E. such as KDE and Gnome.

        Click the "other" button and you will find more to choose from, like LXDE etc. You can also install the text mode version which is mostly for servers.


        This is where the fun starts the installer wants to mount 2 internal disk, the other has an ntfs file system. Choose create partition setup and ignore those disk that you will not use. Go directly to your disk and create your Linux partition and file system and optionally some ntfs file system and partition as well so you can use your disk to store and transfer data across platforms like for example your favorite Windows os.

        Click Create Partition Setup.

        Choose the Custom Partitioning for Experts. You should see the disk that are available.

        Ignore the other disk and go directly to the disk that you want to install openSUSE.

        Create your own partitions file systems according to your hearts contents. when your done click the edit button.

        Click the Edit button

        Choose mount by Device ID

        Click the Fstab Option button and make sure that all the disk is mounted by it's ID and as a good practice give it a volume label name. Here since it is the  / partition then we give it the  name  root . You can use the Volume Label  as the mount entry  but if you have the same label on the internal disk this will cause some trouble when you least expected it. since the ID of the disk is unique you are safe from boot error's.

        The above setup has an ntfs partition as /dev/sda and most probably has your favorite Windows os installed on it. How ever if you have a Linux os installed on your primary hard drive (sda) the installer will try to add the swap of the existing install to your setup. You can go to that disk and edit it to be able to unmount that swap.

        Select Do not mount partition.

         Click finish and that should remove the existing swap to your setup.

        Creating new user will be the next.

        If you did what i have done then you have an option to set the roots password.

        Next will be the final review of the setup you have just did before you can start the installation. If you have not added a boot partition then booting from root is the alternative.

        Disable the boot from mbr and enable the boot from / root partition.

        Change from this

        To this

        Click the Booting section.
        You will see the bootloader settings section management. Make sure that only the disk you want to install opensuse is in that entry. It will look like the picture below.

        Don't worry about deleting other entries in this section because they will not literally deleted but will just be remove from grub.

        Now click the bootloader installation section. Make sure that the boot from root partition is checked.

        Click the Boot Loader Options button. Then tick the 2 options under Boot Menu.If you want to know what it does there is a help button at the bottom left corner. It may or may not affect your set up at all, but it does not hurt to use it specially if your using a pendrive/ thumbdrive.

        Then click Boot Loader Installation Details. Make sure that the only disk  in that entry is the disk you are installing, in this case /dev/sdb2.

        Change from this

        To this

        Go back to section management click the Other button at the bottom right corner  and select Edit Configuration Files

                                  There are three dropdown menu's in there namely

        1. grub.conf
        2. menu.lst 
        3. device.map


        Here you can edit or add additional  boot parameters such as  nomodeset   and so on. This is the last chance to review your boot settings before you proceed on the installation.


        This is the script that grub uses when it boots your system. Make sure that the entry  (hdX,X)  is the same as with menu.lst.


        This is the very important part if you want to make sure that your usb install will boot without any issues. There will be other entries here as well, just make sure you have the relevant hard disk as the only entry. Again deleting other entries will not delete them physically but will just be remove from grub's memory and It should be always  (hd0) . So i can say that this is the "cream of the crop" or the climax of our tutorial.

        When you have done those things you will be brought back to the final review of your setup before you can proceed with the installation. Make no mistake here because once you have click the install button there will be no turning back!

                                                                 Now you can start the installation.

        The first thing you need to do after the installation and manage to log-in either via cli or with X server running is to check you if have the correct bootable flag set. you need to run   fdisk -l  as root so as to confirm that you have it. In this case    /dev/sda2   is the root partition. The   *   should be in the / partition.

        If its not in the right place then you can use the command  fdisk  as root to set it. Run   fdisk /dev/sdX   where  sdX  is the correct disk and follow the prompt its not that hard to set it imo. Some explanation in this  link.

        Final thoughts:

        As i have mentioned from the beginning there are a lot tutorial's out there that will tell you howto install opensuse on an external drive such as usb and flash.

        There is susestudio.com which requires  an account and you must have a decent internet bandwith because everything will be done online from building to testing and downloading your appliance.

        There is kiwi  which mostly be done via cli or command line interface. You should have a basic knowledge of how to edit xml files and some dependencies of your appliance that you are trying to build.

        There is unetbootin which does not support OpenSuSE officially

        Some folks might tell you to remove your internal disk so you can install directly in an external drive. You can do that in VBox so no need to remove your drive! :-) check this one out if your seriously planning to remove your internal disk.

        And last but not least this tutorial which does not require anything out of the ordinary installation. All you have to do is read understand and be able to adopt your set up to this tutorial.

        The only setback about the above alternatives  namely susestudio and kiwi will have you build your own appliance and then copy or install it on your usb drive. My procedure is just installing directly like usual.

        Trouble shooting! :-)

        Most of the folks who tried using different tools to make a persistent usb install and failed would probably ended up having their usb disk borked, since some part of the iso images were copied to the disk. Then they will come and  try out this method as the last resort out of desperation :-), it is doom to fail. So dont blame my guide if you got some errors about not being able to write to the disk during the installation! Enough said so  what is the solution?

        If you are a Windows user the safest option would be using a virtualization client like VirtualBox which support usb devices. Plug in your usb disk then boot from any live media ie cd, dvd and such inside VirtualBox without any (virtual) internal hard disk attached, When you log in open up a console or a command prompt like in Windows and type as a root user.
              dd if=/dev/zero of=/dev/sda bs=4M & pid=$! 

              while (( pid )); do kill -SIGUSR1 "${pid}" || break; sleep 10; done  

        This will give you an idea about how much time will it finish.Now this may take much time since you are using a virtual client but it is 100% safe compared to the other option below. If you know what you are doing then you can use your pc and boot from the live media then plug in your usb disk. first check your disk as normal user run

              ls -l /dev/disk/by-id/usb* | sed 's|.*\(/usb\)|\1|' 

              ls -l /dev/disk/by-id/ata* | sed 's|.*\(/ata\)|\1|' 
        This should tell you which disk is your target, another trick is to use hwinfo (thanks to the liveusb page of opensuse wiki) as a normal user run:

             su root -c'grep -Ff <(hwinfo --disk --short) <(hwinfo --usb --short)' 

              su root -c 'blkid -o list -c /dev/null'  

         And make sure you only have one usb disk inserted just to clear things out. Be very careful when running dd  command since it literally means "Destroy Data" if you pointed it to the wrong disk then all of the files in that disk or partition is history. If you are really sure which disk is your target then run the command:

             su root -c 'dd if=/dev/zero of=/dev/sdX bs=4M & pid=$!' 

                 while (( pid )); do kill -SIGUSR1 "${pid}" || break; sleep 10; done  

        Just replace the    X     with the correct value which you got from fdisk and hwinfo.I will not be responsible for the damage and lost of your files if you made a mistake about the above procedure, use it at your own risk! If you have a running linux system (does not need to be opensuse) you can install the package dd_rescue or ddrescue the name vary from distro to distro. When you have it installed run:

              dd_rescue /dev/zero /dev/sdX 

        Where  /dev/sdbX  is your target disk. Again at your own risk!!! When your done with clearing your usb disk then you can proceed with the installation.

        That's all folks.