Boot directly into Freevo
If you use your Freevo PC as a standalone system dedicated to Freevo, you probably want to boot automatically into the freevo interface, without the need to enter user name and password. There are several possible ways to do that, this page describes several solutions. Which one you choose is a matter of taste and of the details of your setup.
Warning: You should consider, that this kind of standalone operation implies that the system will be somewhat 'insecure'. The extent of this insecurity depends on the approach you choose.
Contents
- Boot directly into Freevo
- Using the startup scripts bundled with Freevo
- Using inittab to autologin and .bash_profile or .xinitrc for starting freevo
- Using GDM (no Window manager, auto-login, any display on a multi-seat system)
- Using GDM (AutomaticaLogin method, only for first display/single display system)
- Using GDM Alternative
- Using KDM 1
- Using KDM 2
- Alternative Config that allows VNC to be used to connect to the freevo box
Using the startup scripts bundled with Freevo
This may only be valid if you compiled Freevo from source, or otherwise have access to the source code. In the root of the source tree is a directory named boot. Inside that you will find a collection of init scripts for Freevo:
- Freevo - Start/Stop the main program and it's auxillary applications, such as the Recordserver and Webserver
- Freevo_dep - Start/Stop programs that Freevo depends on, such as LIRC
- Recordserver - Start/Stop the Freevo Recordserver
- Webserver - Start/Stop the Freevo remote webserver
There is a version of the Freevo script for Gentoo, plus a version each for Recordserver and Webserver that can be run and monitored by init. There is also a boot_config file that should go in the same directory as local_conf.py (/etc/freevo in Debian). This configuration file tells the main script what to start and stop, where to find the Freevo program and a few other little tidbits.
It should be as easy as copying the config file to it's proper place and setting it up correctly, then copying the script to your init.d directory. Set up links to start the script at startup and stop the script at shutdown and you should be good to go.
Using inittab to autologin and .bash_profile or .xinitrc for starting freevo
This approach can be used, when your distribution uses an inittab file to decide which is the default runlevel and what to do for each runlevel. Usually in each runlevel several virtual terminals are started. You can use one of this virtual terminals to autologin your freevo USER and then start freevo either from .bash_profile or .xinitrc. Depending on your distribution the file /etc/inittab might be called different in your system. These things are tested with a debian system.
1. Edit /etc/inittab. The exact way how you do that depends somewhat on the terminal program that you use. In most cases this is getty. But there are several replacements for getty available. Check which one your distribution are using and have a look at its man page to see what features are available. Here are two approaches described to get autologin to work. The first one is for getty programs that support autologin, whereas the second one is a workaround for getty programs that lack that capability. Unfortunately the standard getty program does not support autologin. A good replacement is for example mingetty. The only reason to prefer getty over mingetty is, if you want to you use console over a modem connection or something similar.
a. If your getty program supports autologin, put the following into your /etc/inittab:
id:3:initdefault:
this makes runlevel three the default runlevel.
1:3:respawn:/sbin/mingetty --autologin USER tty1
this spawns only one virtual terminal in runlevel 3, which is used for autologin. This are only the relevant pieces of /etc/inittab, you can keep the rest as it is.
Note: In Ubuntu and variances (Kubuntu/Xubuntu) that uses upstart daemon, you need to edit the file /etc/init/tty1.conf instead. Replace the line
exec /sbin/getty -8 38400 tty1
by this line
exec /sbin/mingetty --autologin USER tty1
b. If you do not want to install mingetty or another getty program which supports autologin, you can also use this workaround. The main disadvantage of this is, that your USER needs an empty password for this to work.
c1:12345:respawn:/sbin/getty -n -l /sbin/autologin 38400 tty1 linux
and create the /sbin/autologin file
exec login USER
and remove the user's password
passwd -d USER
2. After the next boot (in runlevel 3) your USER will be automatically logged in on the first console tty1. Now we have to start freevo automatically after that. Here are again two approaches described. The first one is more generally and works with and without X11, whereas the second one only works with X11, but has the advantage that you can easily run several other programs before starting Freevo.
a. This is the more general approach. Put the following in your USER's .bash_profile:
case "`tty`" in /dev/tty1) clear && freevo &>/dev/null;; esac
If you start Freevo with the option -fs, Freevo will start as windowmanager, and X11 is started automatically. Otherwise it will try to use the framebuffer device. Thus you should make sure that the appropriate output device (X11 or framebuffer) is working correctly before you try this.
b. This approach is probably more suited when you use X11. Put the the following into your USER's .bash_profile:
case "`tty`" in /dev/tty1) startx;; esac
startx will read your USER's .xinitrc, which could contain:
nvidia-settings -l # used to adjust overscan/color ect on nVidia cards. xset s noblank xset s off xset -dpms exec freevo
Using GDM (no Window manager, auto-login, any display on a multi-seat system)
GDM allows the administrator to provide a script that is run as root before the login box is displayed.
On a typical system, the script /etc/gdm/Init/Default is executed.
If the display :2 is intended to be a TV screen connected to a video card with multiple outputs, you can create a file /etc/gdm/Init/:2 and it will be executed by gdm instead of /etc/gdm/Init/Default. As a bonus, users on :0 and :1 will still get /etc/gdm/Init/Default, and log in to a normal desktop.
#!/bin/sh FREEVO_USER=freevo HOME=/home/freevo export HOME PATH=/usr/bin:$PATH OLD_XAUTHORITY=$XAUTHORITY XAUTHORITY=/tmp/.Xauthority.freevo export XAUTHORITY cp -p "${OLD_XAUTHORITY}" ${XAUTHORITY} chown ${FREEVO_USER} ${XAUTHORITY} chmod 0600 ${XAUTHORITY} # disable screensaver xset s noblank xset s off xset -dpms while true ; do su - ${FREEVO_USER} -m -c freevo 2>&1 > /tmp/freevo.out sleep 5 done # if we ever exit, a gdm login box will appear on the TV exit 1
Multi-seat configuration
Let's say that you have a video card with one or two monitors attached, and also a TV output (this doesn't have to be a real TV output, it could just be another monitor that is only used as a TV). You want the TV output to operate independently of the monitors. By `independent', we mean the TV output should always be running freevo, even if no user is logged in on the main console. If a user activates the screen saver/lock, or logs out, the freevo output should still remain on the TV screen.
The solution: gdm is used to start a native X server on the hardware (display :0), and then each screen on the :0 display is managed by a separate Xephyr process (:1 is the normal PC desktop, :2 is the TV output). freevo is executed on :2 using the gdm Init script given above. This type of setup is referred to as a `multi-seat' environment, it can also be used to have multiple keyboards, mice and screens attached to a single PC shared by several users, but in this case, the freevo screen doesn't need a keyboard or mouse as it is controlled by a remote.
The setup is surprisingly simple, and works on Debian lenny. Modify /etc/gdm/gdm.conf:
[servers] 0=hw 1=screen0 2=screen1 [server-hw] name=hw command=/usr/bin/X -audit 0 -kb handled=false flexible=false [server-screen0] name=screen0 command=/usr/local/bin/launch-xephyr -display :0.0 -xauthority /var/lib/gdm/:0.Xauth -audit 0 -screen 1920x1200 -dpi 96 +kb r handled=true flexible=false [server-screen1] name=screen1 command=/usr/local/bin/launch-xephyr -display :0.1 -xauthority /var/lib/gdm/:0.Xauth -audit 0 -screen 720x576 -kb handled=true flexible=false
Create the script /usr/local/bin/launch-xephyr:
#!/bin/bash trap "" usr1 XEPHYR=/usr/bin/Xephyr args=() while [ ! -z "$1" ]; do if [[ "$1" == "-xauthority" ]]; then shift if [ ! -z "$1" ]; then export XAUTHORITY="$1" fi elif [[ "$1" == "-display" ]]; then shift if [ ! -z "$1" ]; then export DISPLAY="$1" fi else if ! expr match $1 'vt[0-9][0-9]*' >/dev/null; then args=("${args[@]}" "$1") fi fi shift done /usr/bin/xset s noblank /usr/bin/xset s off /usr/bin/xset -dpms exec $XEPHYR "${args[@]}"
Now create /etc/gdm/Init/:2 (as given above), restart gdm, and a login box will appear on :0.0 (the PC screen) while the freevo main menu appears on :0.1 (the TV screen, or second monitor)
Using GDM (AutomaticaLogin method, only for first display/single display system)
I had a few problems with the first method, so I decided to use gdm's abilities to autologin a user at boot time. I should mention that this method is somewhat safer (for the system) than the first one, since you don't have to modify the inittab, which could make the system unbootable if a mistake is made. First you need to tell gdm to automatically login your freevo user, so edit /etc/X11/gdm/gdm.conf, to add or modify the following lines:
AutomaticLoginEnable=true AutomaticLogin=USER
Then you need a proper session descriptor, ie the files in /etc/X11/dm/Sessions/. I decided to copy gnome's file (02GNOME.desktop) as 19FREEVO.desktop (why 19? because I couldn't remember which numbers were reserved), and then you have to modify the contents of this file, and it should look like this:
[Desktop Entry] Encoding=UTF-8 Name=Freevo Comment=Freevo TryExec=/usr/bin/freevo Exec=/usr/bin/freevo Icon= Type=Application
Note: If you need to execute some commands before running freevo, like loading a keymap, create a script (/usr/bin/startfreevo for example), type all the commands you want in there, end it with freevo and don't forget to chmod +x it.
The last step is to setup the freevo session for your user, which is done by editing ~USER/.dmrc :
[Desktop] Session=19FREEVO
Using GDM Alternative
The above descibed method using gdm is nice but for me it has some disadvantages. I want to use gnome functionality like remote desktop and toggling fullscreen.
To make this possible configure automatic login as described above. On Ubuntu Hardy the file is found at '/etc/gdm/gdm.conf'.
You have to leave the file ~/.dmrc unchanged. Usually it should look like that.
[Desktop] Session=gnome
If you want to start freevo automatically for a certain user, you have to create the following file 'freevo.desktop' at '~/.config/autostart/'.
[Desktop Entry] Encoding=UTF-8 Name=Freevo Comment=Freevo Icon= Exec=freevo Terminal=false Type=Application Categories= OnlyShowIn=GNOME;XFCE
If you would like to start freevo automatically for all users use the directory '/etc/xdg/autostart/' to store this file. You have to be root.
When you configure freevo to start in fullscreen mode (local_conf.py: START_FULLSCREEN_X = 1) everything is perfect. freevo will start up after booting and automatic login. Advantages of this solution:
- you have a full featured gnome session
- you can toggle fullscreen mode
- remote desktop is supported
- using the sleep button (keyboard) works perfectly (gnome-power-manager)
- many more
Using KDM 1
This is working on Debian sid/unstable (July 2007).
In principle it is the same approach like the one above. The files are just somewhere else and called differently.
The session descriptors reside in /usr/share/xsessions/. There you create a file called freevo.desktop which looks like this:
[Desktop Entry] Encoding=UTF-8 Name=Freevo Session Exec=/usr/bin/freevo Icon= Type=Application
(basically the same like in the GDM case)
The rest of configuration can be done in a graphical way: After KDM restarted (manually by /etc/init.d/kdm restart or just a reboot) there is a new entry in the sessions menu on the login screen for freevo. You select it and login with the user freevo shall run with. When freevo is up and running, quit it again and you get back to the login screen. This serves the purpose to let KDM remember the previously ran session of this user for future (automated) logins.
In the next step you log in using another user on this system (not the freevo-user from above) and select the usual window-manager (probably KDE). There you open the KDE Control Center. Via the category 'system administration' you can configure kdm (the login screen) to automatically log on a specific user (this setting requires the root password).
After this is done, you reboot normally. The next boot up should drop you directly into freevo
Using KDM 2
Login to KDE as the user to run freevo.
Go to KDE Control Center > System Administration > Login Manager. Set Administrator Mode and give the root password. Go to the Convenience Tab and choose Enable Auto-Login for the user you want freevo to run as. Close the Control Center.
On the Desktop, right click and make a Freevo desktop icon Right_Click > Create New > Link to Application. On the General Tab change Link to Application to Freevo. Click on the gear cog, choose other icons, browse. You should find the freevo icon at /usr/share/pixmaps/freevo.xpm. On the application tab, choose command and put /usr/bin/freevo. Click OK to save.
Now in konqueror go to /home/user/.kde/Autostart. Drag your desktop icon into this folder and copy it there. When you restart the Xserver you will be logged in automatically and freevo start.
Alternative Config that allows VNC to be used to connect to the freevo box
This is working on Fedora Core 4.
I have choosen to configure and adjust configuration as user root. The user freevo would only be a user who can use "freevo". With VNC, you could take over the desktop for user root. http://www.realvnc.com/faq.html#x0
This makes this a usefull way of configuration. Typicaly, you would connect a freevo box to a TV set instead of a monitor, without keyboard or mouse attached or in a placement where configuring the freevo box is uncomfortable. You get also the advantage of using another pc of controlling freevo as a alternative to a remote control.
In the "Login Screen" configuration, you could add a automatic login user with a timeout. I created such a user called freevo. To start up freevo I first created a batch file, called startfreevo, which should startup freevo in my proper language.
LANG=nl;/usr/bin/freevo
I'm Dutch speaking so this why I use LANG=nl in the batch file. The root user would work under the default English language screen, when starting freevo. I prefer using defaults screens for configuration jobs. Sometimes you've get the bugs pop up in translated version. Also a handy way for seeing the difference.
Now I had created a .Xclients file in the home directory of user freevo. Permissions and rights are important!
[root@localhost freevo]# pwd /home/freevo [root@localhost freevo]# ls -l .Xclients -rwxr-xr-x 1 freevo freevo 19 Jun 29 20:35 .Xclients [root@localhost freevo]#
In the .Xclients file, I just refer to the location of the batch file.
If I don't login as root in a predefined time, freevo starts up automaticly.