The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    Quick Kernel Screensaver Help Needed

    Discussion in 'Linux Compatibility and Software' started by inspirations365, Mar 18, 2009.

  1. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    I'm trying to get this working: http://micrux.net/?p=66, essentially a screensaver of the kernel. I'm fine up to the last part, where it asks me to input.

    Code:
    cat `find /usr/src/linux-source/ -name ‘*.c’ | argshuf`
    This wouldn't be a problem if I knew where to input this. I do not know how to access screensaver settings through the terminal.

    If you really want to help me, could you also tell me where/how to tweak speed, scale, and fade settings.

    Thanks!
     
  2. proxima_centauri

    proxima_centauri Notebook Consultant

    Reputations:
    59
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    30
    Without speaking towards what you are actually doing;
    The command you posted would be used in Terminal. Just copy and paste that code into the terminal and hit enter.
     
  3. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    Hm...the context of the page doesn't make me think that, although that is the obvious answer, isn't it?

    Here's what it says:
    Then it lists the command. Thank you for the reply!
     
  4. proxima_centauri

    proxima_centauri Notebook Consultant

    Reputations:
    59
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    30
    In the future, most cases, just think command = terminal
     
  5. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    Sorry for the multiple posts, but I input the command into the terminal for kicks and it made all the prompts turn into symbols instead of text. I closed it and reopened it and everything seems fine. But when I go to the screensaver menu, it's still listing the same few lines (it's supposed to be random).

    That, and I don't know how to edit ANY of the screensavers settings like speed, etc. If I can solve this problem, I think everything else will fall into place.
     
  6. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    Okay, I think I half solved the problem: I needed xscreensaver to edit the settings. I still don't know where to enter that command, but that's the last thing I need to solve. If anyone can help me answer that, I think I'm golden.
     
  7. proxima_centauri

    proxima_centauri Notebook Consultant

    Reputations:
    59
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    30
    Yes you are right, I should have taken a look at the link in the first place.

    "Now we’re ready to put it all together. Go into your screensaver preferences, and go into the phosphor setup. You can set up the speed, scale and fade settings however you like. The important part is the “text program” box. Here’s the command:"

    So in screensaver preferences, there should be something called "phosphor setup" with somesort of input interface, aka "text program" box.
    Do you see anything like that?
     
  8. proxima_centauri

    proxima_centauri Notebook Consultant

    Reputations:
    59
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    30
  9. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    If I go into Xscreensaver and select Phosphor and settings, it lists options for Frame rate, Font scale, and Fade. If I select the button for "Documentation" towards the bottom of this window, it will open a terminal. If I do not do this and instead select "Advanced" at the bottom if this window, it has a "Command Line:" option where it lists "phosphor -root" in the box. I actually have already placed that wandering piece of code into both of these places.

    If I go into the "Documentation" box, and cd to /usr/src/linux-source and input the code, the terminal will be busy, but I don't think it will finish anything.

    If I place that bit of code into the "Command Line:" box, nothing will show up in the preview box. I don't the proper screensaver will be called if I change this line. This is also where options are modified (scale, etc.).
     
  10. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    Wow, i'm not getting anything like that link at all.
     
  11. proxima_centauri

    proxima_centauri Notebook Consultant

    Reputations:
    59
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    30
  12. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    I've been asking this same question on Ubuntu Forums. Someone realized that the picture you posted is for KDE, not Gnome like I'm using. I found where I'm supposed to input the command, "You need to go tho the Advanced-tab of the screensaver dialog, and under "Text Manipulation" enable "Program" and type that command into the command field."

    The relatively small problem now is, the command doesn't work as it should. Instead, it gives "no such file or directory".

    There must be something I we should append to the command to make it direct to the /usr/src/linux-source directory... if we can solve this problem, the issue is resolved!
     
  13. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    I'm so close I can taste it. Okay, so in that program box listed above, you go to browse, and navigate to the proper directory. Then paste in the command in my original post AFTER the directory in the box.

    NOW the only issue I see standing between me and awesome is that permission is denied. putting "sudo" in front of the command won't work since I can't enter my password. Can anyone think of a workaround for this?
     
  14. proxima_centauri

    proxima_centauri Notebook Consultant

    Reputations:
    59
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    30
    can you open the program itself with "sudo"?
     
  15. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    I'm not sure what you mean by program. Please elaborate. I'm sure this thing will work if I can give the command permissions to open the files.
     
  16. jas

    jas Notebook Evangelist

    Reputations:
    697
    Messages:
    622
    Likes Received:
    5
    Trophy Points:
    31
    inspirations365, this is a long response to your thread because after checking it out, I think this screensaver is perfect for the uber geek. So I thought I would explain it in a thorough way so that others can try it out if they want, and then towards the end of the post, when we go step by step, you can look at which steps aren't working, and then examine from there forward.

    First a level set. The phosphor xscreensaver is a cool screensaver that imitates the early computer CRT screens by "printing" text across the screen using green "CRT" characters on a black background. The coolest thing about the phosphor screensaver is that you can pipe lots of different kinds of text for displaying, when in screensaver mode. The trickiest bit about doing this is configuring the screensaver correctly. Some installations install a phosphor configuration where you can't enter in any command for text input for the screensaver, or at least you can't do it from the GUI screensaver settings. (I tried to set it on my KDE 4.2.1 environment and the advanced settings configuration wasn't enabled) This is controlled by a configuration file that comes with the phosphor screensaver and is stored here;
    Code:
    /usr/share/xscreensaver/config/phosphor.xml
    If you don't have the right options available when you open up the settings for phosphor, specifically an option called "Text Program", with a box to enter in a command, then one of the ways to fix this is to modify your config file. Once that option is enabled, there's plenty of fun commands to pipe to phosphor, including;

    1) Displaying text from the Linux fortune program. Of course the fortune program must be installed;
    Code:
    fortune
    2) Displaying text from random Wikipedia articles. (Must have the text browser lynx installed)
    Code:
    lynx -dump -nolist http://en.wikipedia.org/wiki/Special:Random | sed '/Retrieved from/,$ d' | sed '/Jump to/d' | sed '/Links/,$ d' | sed 's/"[edit]|"/ ""/g'
    3) Displaying BBC Ticker news headlines. (Must have the wget and perl programs installed)
    Code:
    wget -q -O - http://tickers.bbc.co.uk/tickerdata/story2.dat | grep '^[HB]' | perl -p -i -e 's/HEADLINE/BBC>/g'
    You get the picture. You just need to make sure you get the text output you desire using the appropriate program(s), and then make sure you pipe it correctly to phosphor. It's easy to test too because each of these commands should output the correct text when run from the command line in a terminal window, (as your regular user account), too. If it doesn't output the correct text from the command line, then something is wrong with the system, installed programs, or command, and not with the phosphor configuration.

    Another uber-geeky cool phosphor mod, which is the subject of this thread, is to pipe random linux source code files, to phosphor. In addition to installing the linux source code files, you need a method for randomly selecting a file, and then piping it to phosphor. So I took a look at the two howto pages referenced in this thread for accomplishing this. The first page describes a method that uses the linux find command to locate all of the installed linux source files, and then pipe the entire list of filenames to a program called argshuf, (argument shuffle), which picks one of the filenames, which can then be piped to the cat command. It's a usable method for piping the source file contents to phosphor, but (as the second howto page below points out), it does need to do a 'find' for every linux source file, each time phosphor needs new text. You also need to compile and install the additional argshuf program. Kudos to the developer for developing this program, but I think that the second solution is an easier, lower overhead, solution.

    This second page shows a method for creating a script that when run, will scan your system for all installed linux source code files, and then build a simple perl script that includes a list of all of the installed linux source code files. Then whenever the perl script is run, it randomly chooses one of the source files, and then simply prints out the complete filename. Then all you need to do is pipe that output to cat, and it achieves the same thing as the first method, only with less overhead. If it matters, the only thing you need to do is rerun the script when you install a newer version of the source code to get an up to date file listing in the perl script. (I liked this method so much that I just did it on my own system.)

    So now lets trace the steps necessary on how to make this work for either method, (specifically tailored for an Ubuntu user). Regardless of which method is chosen, the first step necessary is to install the linux source code files. So first change to your system's source code directory;
    Code:
    cd /usr/src
    then use the Ubuntu command to install the linux source code archive, which is;
    Code:
    sudo apt-get install linux-source
    If you didn't catch the exact source code archive filename, first list the directory contents with a;
    Code:
    ls -al
    This should display the source code archive filename which will look something like;
    Code:
    linux-source-2.6.28.tar.bz2
    You then need to unarchive this file using the following command;
    Code:
    sudo tar -xvjf linux-source-2.6.28.tar.bz2
    This will unarchive all of the linux source code files and create the directory hierarchy for them. The next step is to create a symbolic link to the actual linux source code directory, that was just created. However the first page howto suggested calling this symbolic link directory, linux-source. I don't why that was recommended, but I would recommend using the standard linux source code symbolic link naming of linux. This is done with this command;
    Code:
    sudo ln -s linux-source-2.6.28 linux
    Again, you need to enter in the exact name of the source code directory hierarchy installed. (If unsure just list the directory's contents again with a ls -al command again.) If everything is ok, at this point you have all of the linux source code files correctly installed, and you've created the proper system source code symbolic link, so that scanning the directory;
    Code:
    /usr/src/linux
    will show you the entire linux source code hierarchy installed. At this point the two methods mentioned diverge. So here's the steps for the first method which began this thread. You next need to follow the steps on this page to download, compile and then install the argshuf program. On an Ubuntu system, in order to compile this, (or any other source code), you will need the tools for compiling programs installed on your system, and if you don't have them, you can install them with this Ubuntu command;
    Code:
    sudo apt-get install build-essentials
    At the end of the argshuf webpage there's a command to test if you've got argshuf compiled and installed correctly. It's;
    Code:
    cat `find . -type f | argshuf`
    Which will dump the contents of a random file in the directory you are in, which can sometimes cause your terminal font to go screwy. I would expect an easier test would be to simply do this;
    Code:
    echo `find . -type f | argshuf`
    which should just print out the filename that argshuf selected. If you run it multiple times you should see a sample of the randomness of argshuf.

    Once you've got the argshuf command properly installed, you're ready to complete the last step. The howto author, (and as you've pointed out previously in this thread), states that in order to pipe this output correctly to phosphor you need to enter the following into the phosphor screensaver settings, Text Program option dialog box;
    Code:
    cat `find /usr/src/linux/ -name ‘*.c’ | argshuf`
    (Notice we changed the directory name from the original web howto, to point to the correct symbolic link) However, I think that the correct command is actually;
    Code:
    cat `find /usr/src/linux/ -name *.c | argshuf`
    Anyway, remember that in order to test any command you want to pipe to phosphor, it has to work correctly from the command line. So if you open a terminal window and try both commands, (again as a regular user, not using sudo), and see which one works, you can use that one with the phosphor settings. If neither works, then we need to debug the command to see which part isn't working. inspirations365, at this point I'd hazard a guess and say that the reason that your command isn't working is that you've not compiled and installed the argshuf program correctly because you mention the output message being something like command not found.

    If this is true, you can consider compiling and installing argshuf to fix this, or you can consider the second method, outlined on this webpage, as an easier alternative to achieving the same thing. These are the steps necessary, (I've made some slight changes to the original author's script here). I first recommend storing this shell script in the /usr/local/bin directory, (along with the perl script it will create). So first change to that directory;
    Code:
    cd /usr/local/bin
    Next we need to create the shell script as a super user, using sudo, and we'll call the script phosphor-kernel-script.sh with this command;
    Code:
    sudo nano phosphor-kernel-script.sh
    In to that file you only need to cut and past the following;
    Code:
    #!/bin/sh
    
    file=/usr/local/bin/phosphor-kernel-src.pl     # script to create
    linux_src_dir=/usr/src/linux                   # location of kernel src
    
    cat << EOF > "$file"
    #!/usr/bin/perl
    srand;
    rand(\$.) < 1 && (\$line = \$_) while <DATA>;
    print \$line;
    __DATA__
    EOF
    find -L "$linux_src_dir" -name \*.c >> $file
    chmod 755 $file
    Now you can save the file with by pressing both the Ctrl key and O (Ctrl-O), and then exit nano by pressing both the Ctrl key and X (Ctrl-X). Next you need to change the shell script to be executable by doing the following;
    Code:
    sudo chmod 755 phosphor-kernel-script.sh
    Finally you need to build the perl script and source code list, by running the shell script you just created. Again if you care, it's something you could do every time you install a new version of the linux source code files. Here's that command;
    Code:
    sudo /usr/local/bin/phosphor-kernel-script.sh
    After a few seconds your system should return you to a command prompt and you can now look in the /usr/local/bin directory and see the new perl script called;
    Code:
    phosphor-kernel-src.pl
    Now you should be able to run this perl script and it will randomly spit out a linux source code filename. By just entering the command in a terminal window as a regular user, (NOT using sudo),
    Code:
    /usr/local/bin/phosphor-kernel-src.pl
    and you should get a random linux source code filename like;
    Code:
    /usr/src/linux/arch/x86/kernel/kprobes.c
    If you've followed this far, then you only have one small step left to do, and that is to configure the phosphor screensaver to use this perl script by entering the following command into the proper Text Program dialog box;
    Code:
    /usr/local/bin/phosphor-kernel-src.pl| xargs cat
    Again try it from the command line in a terminal window, (as your regular user not using sudo), and you should see the contents of a random source code file go scrolling past. If not, then there's something wrong with the shell or perl script, that needs to be looked at. Thanks to both of you for pointing out links to this cool screensaver mod, and hopefully we can all help debug any problems that anyone has trying to implement something uber geeky like this, with whichever method they choose to use.

    Good Luck..

    (For anyone who got put out with the length of this post, sorry. It was a cool subject, I had the time, was feeling especially verbose, and I figured I needed to do something special for my 400th post here..)
     
  17. Bungalo Bill

    Bungalo Bill Notebook Deity

    Reputations:
    97
    Messages:
    806
    Likes Received:
    0
    Trophy Points:
    0
    Sweet guide man. Good to see some verbose posts on the linux forum. :)
     
  18. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    Ugh....i wanted to start over, but after rm linux-source I can't get it back! If I try it again I get
    Code:
    Reading package lists... Done
    Building dependency tree      
    Reading state information... Done
    linux-source is already the newest version.
    The following packages were automatically installed and are no longer required:
      libraw1394-dev libdc1394-22-dev libtheora-dev libgsm1-dev
    Use 'apt-get autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    I feel so dumb! Is there a way to get it back into the proper directory?
     
  19. jas

    jas Notebook Evangelist

    Reputations:
    697
    Messages:
    622
    Likes Received:
    5
    Trophy Points:
    31
    Try these commands to clean up your system configuration;
    Code:
    sudo apt-get autoremove
    Code:
    sudo dpkg --configure -a
    Code:
    sudo apt-get clean
    Code:
    sudo apt-get update
    Code:
    sudo apt-get install linux-source
    I'm not 100% sure that all of these commands are necessary to clean up your config, but I'm sure that other Ubuntu users can chime in and provide guidance on how to do this as well.

    Good Luck..
     
  20. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    Output:
    Code:
    Reading package lists... Done
    Building dependency tree      
    Reading state information... Done
    linux-source is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    
    :(

    But if I can just get someone to send me the file linux-source-2.6.22.tar.bz2, that would be all I'd need.
     
  21. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30
    Wouldn't someone else just have to input the same command and copy the .tar.bz2 file to an accessible directory and then upload it?
     
  22. jas

    jas Notebook Evangelist

    Reputations:
    697
    Messages:
    622
    Likes Received:
    5
    Trophy Points:
    31
    Again, since I don't run Ubuntu, I'm not sure of the correct answer here, but this blog suggests that you may already have the archive file still on your system. You can try the suggestion there of issuing this command;
    Code:
    sudo apt-get install –no-download linux-source
    or you can look in this directory
    Code:
    /var/cache/apt/archives/
    to see if the linux-source archive file is there. Copy it to the /usr/src directory, and then unarchive it. If that doesn't work, then I would suggest that it's going to be easier, (and cleaner), for you to fix your Ubuntu config so it removes the linux-source package from the installed packages list, (even though you rm'ed it in the directory tree), and then reinstall it with apt. Try doing;
    Code:
    sudo apt-get remove linux-source
    or
    Code:
    sudo apt-get --purge remove linux-source
    and then once it's cleaned out of the installed packages list, reinstall with
    Code:
    sudo apt-get install linux-source
    For future reference, once you use a system's package manager to install something, you can now see the benefit of using the same package manager to remove it.

    Good Luck..
     
  23. Charr

    Charr Notebook Deity

    Reputations:
    415
    Messages:
    1,564
    Likes Received:
    0
    Trophy Points:
    55
    You can get that from kernel.org. Here is the download link:
    http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.tar.bz2
     
  24. inspirations365

    inspirations365 Notebook Consultant

    Reputations:
    42
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    30

    Thank you both! I got the file that I needed (I actually posted that I needed the wrong kernel version, so thankfully that site has all of them!) and thanks to Jas's instructions I got it working. Thanks a ton everyone!!!
     
  25. theZoid

    theZoid Notebook Savant

    Reputations:
    1,338
    Messages:
    5,202
    Likes Received:
    22
    Trophy Points:
    206
    YouTube Vid !!!
     
  26. Siobkerry

    Siobkerry Newbie

    Reputations:
    0
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    5
    Sorry to bring up an old thread however i found this on google and there doesn't seem to be a whole lot more information available. I've followed Jas's guide and been playing with it for a while now and everything is working well however the problem I am having is that the screensaver is only printing the names of the files rather than the source contained in those files. I have been trying for a while now to fix this and tried a lot of different things but nothing seems to be working. The only two possible problems I could find are that when I put "/usr/local/bin/phosphor-kernel-src.pl| xargs cat" into the program field it doesn't work (however it does work and prints the source code correctly when I enter it into the terminal) and the other possible reason its not working is that I don't have the Dump Pipe option field that is shown in the picture from the link for the second method jas mentioned in his guide and I have no idea how to get that field, I looked in the /config/phosphor.xml file but there was nothing in there.

    I would appreciate it if anyone had any ideas or suggestions I could try, thanks.


    Edit:
    Of Course as soon as I post i figure it out, never fails.

    Anyway for anyone else you comes across this awesome post Jas's guide on the second page is excellent just a few notes though:
    Code:
    srand;
    rand(\$.) < 1 && (\$line = \$_) while ;
    print \$line;
    
    Needs to be:

    Code:
    srand;
    rand(\$.) < 1 && (\$line = \$_) while &lt;DATA&gt;;
    print \$line;
    
    it seems the forum didn't like the tag and didn't show it.
    and also the code to put in the program text box is:
    Code:
    /usr/local/bin/phosphor-kernel-src.pl | xargs cat
    
    the change being the space before |

    this screensaver setup is awesome, I have dual monitors setup and it even prints two different files on each monitor at the same time. Very cool.

    and again I apolagize for bumping this thread.