LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Help newbie use Linux to make a Digital Picture Frame (https://www.linuxquestions.org/questions/linux-general-1/help-newbie-use-linux-to-make-a-digital-picture-frame-666941/)

Daravon 09-01-2008 05:01 PM

Help newbie use Linux to make a Digital Picture Frame
 
I have an old laptop, that I installed in a picture frame. It needs to boot, login, and run a slideshow of pictures from a flash drive, with no user intervention. The program 'feh' works perfect for this because of it's excellent command line options.

It has only a 1GB CF card for a flash drive. I gave up on using DSL and installed a command-line Hardy Heron system. I didn't do any stripping down after installing a command line system, then I basically just apt-get'd xorg and feh. Feh runs fine without a window manager.

The problems I have now are that I need it to auto-log me in, start x, and then run the slideshow, because I won't have a keyboard or mouse.

1. So I need to auto-login. I did a bit of searching but didn't find much.

2. I also need to place my 'startx' command somewhere, I'm not sure where.

3. And then, I need a permanent path for my 'start feh and play pictures' script, but I also need it to be on a flashdrive. So I think I might have to like add a 'mount flashdrive on boot' script in there somewhere, or put it in the fstab or something. I'm not sure if I'll be able to remove and reinstall the flashdrive (with updated pictures) with the system up and running, but I would like to.

Apparently a commandline Hardy install and X fit on a 1GB flashdrive, but how can I check my free space? I'm used to like, using konqueror or system monitor or something.

klearview 09-01-2008 06:37 PM

Okay, let's tackle your issues one by one (btw, the whole setup can be achieved in different ways - no guarantee this is the best)

How to autologin on console (NOTE: THIS IS MY WAY - THERE ARE OTHER WAYS (BETTER?) AND IT'S LOCALLY INSECURE)

Create an empty file in /bin (or somewhere else):

sudo touch /bin/autologin

Open it with an editor i.e.:

sudo vim /bin/autologin

and put this in:

#! /bin/bash
exec login -f <your_username_here>

Save it and make it executable:

chmod a+x /bin/autologin


Open /etc/event.d/tty<whatever_tty_you_want_to_use>:

sudo vim /etc/event.d/tty2

Change the line:

respawn
exec /sbin/getty 38400 tty2

to:

respawn
exec /sbin/getty -l /bin/autologin -n 38400 tty2

Once you rebooted you should be automatically logged in on tty2.

Report success and we'll try to achieve the rest.

Daravon 09-01-2008 09:20 PM

Ok I will. The process is tedious because I have to transfer this keyboard and mouse to the picture frame and then back. I'll try it soon.

Daravon 09-01-2008 09:39 PM

It failed.

when I rebooted it says

Ubuntu 8.04 frame tty1

frame login: _

Is this because it says frame tty1, when I used tty2 in the /bin/autologin?

/bin/autologin has full permissions.

EDIT:
I realized that I can switch to tty2 by hitting ctrl+alt+f2. So I did. It does NOT display the frame login: _ prompt, but I also can't do anything. I can type whatever I want but nothing happens, it's not really a command prompt. Hitting ctrl+alt+Fn where n=1-6 takes me to a frame login: prompt except for tty2, which is kinda blank.

I'm confused. This might mean it worked, but I expected it to log me in and return to a command prompt.

klearview 09-01-2008 09:59 PM

Make sure you understand the instructions before you use them. "when I used tty2 in the /bin/autologin" - how did you use tty2 in that file? It does not specify tty at all - only in /etc/event.d you choose what tty you want to be logged in automatically so if you choose tty2 you obviously are not going to be auto logged in on tty1!

Daravon 09-01-2008 10:11 PM

Quote:

Originally Posted by klearview (Post 3266735)
Make sure you understand the instructions before you use them. "when I used tty2 in the /bin/autologin" - how did you use tty2 in that file? It does not specify tty at all - only in /etc/event.d you choose what tty you want to be logged in automatically so if you choose tty2 you obviously are not going to be auto logged in on tty1!

Yes I do understand that. Sorry if I wasn't clear. What I meant was, I chose to be auto-logged into tty2 just like the instructions. I carried out the instructions exactly and tty2 no longer displays the login prompt, and all the rest of the tty's do. But I can't do anything with tty2, it's just like a blank screen I can type things into to no effect. This might mean it worked or it might not.

klearview 09-01-2008 10:23 PM

It didn't work - when everything is done correctly you will be logged in and seeing command prompt as normal. Check for mistakes.

You've modified 2 files: /bin/autologin should look like this:

Code:

#! /bin/bash
exec login -f daravon

(where daravon is the user name)
AND be executable;


And /etc/event.d/tty2 should look like this:

Code:

# tty2 - getty
#
# This service maintains a getty on tty2 from the point the system is
# started until it is shut down again.

start on runlevel 2
start on runlevel 3

stop on runlevel 0
stop on runlevel 1
stop on runlevel 4
stop on runlevel 5
stop on runlevel 6

respawn
exec /sbin/getty -l /bin/autologin -n 38400 tty2


Daravon 09-01-2008 11:12 PM

ok I checked them and see no mistakes. /bin/autologin is -rwxrwxrwx.

the username on the system is chaz. I used chaz in the autologin file. I don't need a password anywhere?

klearview 09-01-2008 11:49 PM

No you don't need password anywhere. The user 'chaz' must already exist on the system - i.e. before you all the above the user 'chaz' must have already existed on the system. If not you need to add him.

Having said that could you post the output from your /var/log/auth.log file. The best way to do it is to run:
cat /var/log/auth.log | grep 'tty2'

and post it here.

I'm slightly worried if you followed everything correctly. For example, I don't understand how your /bin/autologin ended up chmoded to 777 (not that it matters - it still should work but ...)

Daravon 09-02-2008 12:06 AM

Like every ten seconds it says "can't exec /bin/autologin, Exec format error"

the /bin/autologin file seriously says
Code:

exec login -f chaz
chaz exists, that's what I log in with normally.

I chmodd'd it to 777 myself, to make sure it wasn't a permissions thing at all.

klearview 09-02-2008 12:20 AM

Where is '#! /bin/bash' in the first line ?????!!!!!

Daravon 09-02-2008 12:25 AM

Of course the #! /bin/bash line is there, sorry. It doesn't say exec login -f chaz in its entirety. I only posted the exec line because the /var/log/auth.log was complaining about exec format error.


to be explicit

Code:

#! /bin/bash

exec login -f chaz

I don't want to waste your time here. This is what I've done:

Created file /bin/autologin, containing
Code:

#! /bin/bash

exec login -f chaz

exactly as in post7.

I chmod 777'd it.

essentially, added the text

Code:

-l /bin/autologin -n
to /etc/event.d/tty2 so that it is now exactly like in post 7.

upon reboot this results in the blinking cursor screen on tty2 instead of the login prompt.

So i grepped from /var as per your instructions and got "can't exec /bin/autologin, Exec format error".

klearview 09-02-2008 12:51 AM

Well, at least we pinpointed a problem - albeit a strange one.

See if you can reproduce the problem. Log in as a normal user and create a file named, say, 'try'. Type in the contents of /bin/autologin (don't copy/paste just in case), make it executable and then (AS ROOT) try to execute it: ./try

If it works the output will look as if you just logged in. If the same error comes up then something in the environment of your system isn't right.

(By the way - these instructions are exactly how my Ubuntu Hardy is set up for autologin. Everything works as expected so I'm not advising you on something I haven't done myself.)

Daravon 09-02-2008 01:02 AM

It worked. I created 'try' in home and ran ./try

Ubuntu comes with ABSOLUTELY NO WARRANTY, etc. came up.

I just less'd try and /bin/autologin back to back; they are identical.


EDIT: as a matter of fact they are not identical. /bin/autologin has a superfluous carriage return before #! /bin/bash. I have a feeling this is a problem; I did not see this before running less and noting the extra space.

EDIT: it works now, tty2 was logged in upon reboot. It was a sneaky extra blank line at the beginning of /bin/autologin. I'm sorry for wasting your time.

klearview 09-02-2008 01:09 AM

In this case everything should work. Now do this. Delete the first file:

(as root)

rm /bin/autologin

Move /path/to/try to /bin:

(as root)

mv /path/to/try /bin/autologin


All times are GMT -5. The time now is 03:32 AM.