Showing posts with label Xubuntu. Show all posts
Showing posts with label Xubuntu. Show all posts

Tuesday, June 5, 2012

External VGA monitor and Xrandr in XFCE

Finally, around Ubuntu 11.10 or so, my laptop's VGA output became usable.

Hooray for all those kernel hackers!

Now, the VGA monitor is detected during an existing X session (instead of restarting X), it doesn't flicker anymore, and XFCE's settings show it right away.

1) Plug in the monitor and turn it on. XFCE can already be running.

2) Go to Settings Manager --> Display, click on the monitor, and click the "use this output" checkbox.

[Optional] 3) Go to Settings Manager --> Desktop, and choose a distinctive desktop for the monitor.

[Optional] 4) To use the monitors side-by-side (extended mode) instead of the default mirrored mode, open a terminal window and try:
$ xrandr
Screen 0: minimum 320 x 200, current 1366 x 1536, maximum 8192 x 8192
VGA-0 connected 1024x768+0+768 (normal left inverted right x axis y axis) 304mm x 228mm
   1024x768       74.9*    75.1     70.1     71.8     60.0  
   832x624        74.6  
   640x480        72.8     75.0     66.7     60.0  
   640x400        70.1  
LVDS connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1366x768       60.0*+
   1152x768       59.8  
   1024x768       59.9  
   720x480        59.7  
   640x480        59.4


From this command, you can see that the displays are named LVDS (laptop) at 1366x768 and VGA-0 (ext monitor) at 1024.768. Let's move VGA-0 to the right of LVDS:

$ xrandr --output VGA-0 --auto --right-of LVDS

The command also works with --left-of, --above, and --below. Xrandr changes like this are not persistent across restarts, so redo it every time, put it in a bash alias, or script it into the startup.

Now I have a second (smaller) screen to the right.

Thursday, October 27, 2011

Update Problem - one bug, three symptoms

Upon upgrading in one afternoon from 10.10 to 11.04 and then to 11.10, I found a couple problems.


1) No boot! Nooooo!

I suspect I got bit by bug 858122. The workaround is in comment #22, and works.

But it made me wonder...

See, you can simply rename the symlinks for shutdown, but then the next time a package manager runs "update-rc.d", everything will get hosed again. Looks like each of 5 init.d scripts needs to be patched to show accurate #stop init information, and those patched pushed upstream...if upstream even has the problem.

That's why Comment #22 is a workaround instead of a fix.


2) Very slow boot

According to syslog,
Oct 19 13:54:06 cheesebot-supremo kernel: [ 3.362104] EXT3-fs (sda1): mounted filesystem with ordered data mode
Oct 19 13:54:06 cheesebot-supremo kernel: [ 33.253915] lp: driver loaded but no devices found
So let's try commenting out the lp driver in /etc/modules
I wonder...will CUPS still work after that?

Answer: Turns out to bot be an issue, but another arcane symptom of the same bug.


3) Boot Message "Waiting for Network Configuration"

Not really finding anything on it, seems polluted with #1.

Could there have been an initscripts install failure during an upgrade?

Answer: Turns out to not be an issue, but yet another arcane symptom of the same bug.

The takeaway: A reminder to be methodical attacking bugs. Fix one, test it, and move on.

Thursday, July 2, 2009

Installing a Samsung SCX-4725FN printer under Xubuntu 9.04

Instead of the installation disks, I used these instructions

Then go into Settings -> Printer -> Add New Printer and let it autodetect the new printer on the network.

Wednesday, July 1, 2009

Xubuntu 9.04 user-level login scripts

Here is how to get a custom script to run at XFCE startup:

  1. Create a generic startup script and save it as custom_startup.sh. You can put anything in the script; in there now is only a logger so you know it's working.
    #!/bin/sh
    # This script is run automatically by xfce4-desktop during system startup.
    logger -i "Running the custom startup script"
    

  2. Create the following entry as /home/me/.config/autostart/MyStartup.
    [Desktop Entry]
    Encoding=UTF-8
    Version=0.9.4
    Type=Application
    Name=MyStartup
    Comment=
    Exec=bash /home/me/Scripts/startup_script.sh
    StartupNotify=false
    Terminal=true
    Hidden=false
    

Sunday, June 28, 2009

Xubuntu desktop wallpaper from a website (NOAA Radar)

This post has been superseded by a newer post. Much of this information is still valid, but the newer post has more detail amd examples, and includes more services.



Living in the midwest, I check the weather radar a lot to protect my laundry drying outside from lots of pesky thunderstorms. So I want to make the radar image my desktop picture in Xubuntu, and to have it automatically update.

To get the image: I'm using http://radar.weather.gov/lite/N0R/MKX_0.png. It is from the United States National Weather Service and updates every 5-6 minutes.

A shell script to refresh the radar image as the desktop picture:

#!/bin/sh
# BEGIN CONFIGURATION
# This is the path of the final output files that get read by other processes.
# Working files show up here, too. You may wish to create your own directory.
Local_Path=/home/me/.config/weather/
Local_Name="${Local_Path}radar_image.png"
Username=<your username>

# This is the closest weather station for observations. Find your weather 
# station: http://www.nws.noaa.gov/xml/current_obs/. Format is four letters. 
# All UPPER CASE. For example, 'KMKE' for Mitchell Field in Milwaukee, WI
Station=KMKE

# This is the closest weather radar. Find your radar: http://radar.weather.gov/
# Check the link to your weather radar, for example:
# http://radar.weather.gov/ridge/radar.php?rid=mkx&product=N0R&overlay=11101111&loop=no
# The radar name is in the 'rid=' field. In this example, mkx is Milwaukee, WI
# Format is UPPER CASE. For example, 'MKX' for Milwaukee.
Radar_Name=MKX
Radar_Url="http://radar.weather.gov/lite/N0R/${Radar_Name}_0.png"

# (OPTIONAL) The height of your top menu bar, in pixels.
# The radar image is padded by this amount on the top edge so the menu doesn't
# block the timestamp in the image.
#Radar_Image_Top_Padding=15
# END CONFIGURATION

# BEGIN RADAR IMAGE
# Download the radar image.
echo "Weather Update: Downloading the most recent radar image available..."
curl -o $Local_Name $Radar_Url

# (OPTIONAL) Use imagemagick to pad the image top so the timestamp is not 
# blocked by the menu bar.
#convert $Local_Name -background none -splice 0x${Radar_Image_Top_Padding} $Local_Name

# Refresh desktop background with 'xfdesktop -reload'. NOTE - some versions 
# of XFCE flicker all the icons brighter when this occurs, providing visual 
# feedback that the refresh occurred. An Alternate method to avoid the 
# flicker is below.
# The 'DISPLAY=:0.0' prefix is required so root processes like cron and 
# Upstart can process it.
# The 'sudo -u $Username' is required because a root process (like an Upstart 
# trigger) may be trying to change a user's desktop. Sudo changes the command 
# to run as user instead of root. Use your username, of course.
DISPLAY=:0.0 sudo -u $Username xfconf-query -v -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s $Local_Name
DISPLAY=:0.0 sudo -u $Username xfdesktop -reload

# Alternate method to avoid the flicker by changing desktop pictures for 
# just a moment, then changing it back.
#DISPLAY=:0.0 sudo -u $Username xfconf-query -v -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s /usr/share/xfce4/backdrops/xfce4logo.png
#DISPLAY=:0.0 sudo -u $Username xfconf-query -v -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s $Local_Name

# END RADAR IMAGE
I'll save this script as radar_background.sh, and make it executable with sudo chmod +x radar_background.sh.

Notes:
  1. The DISPLAY=:0.0 element is explained here.
  2. The xfconf-query command, and how to change the background using DBus, are discussed in the XFCE forums

Updating the desktop picture manually:

Since we have it in a shell script already, we can create a .bashrc alias to run the script manually.
nano .bashrc opens the .bashrc for editing.
Add the line alias radar='/home/me/radar_background.sh' to the bottom of the file and save it.
Open a new terminal window (terminals only read the .bashrc upon starting) and try the command radar.



Updating the desktop picture automatically: Since we can update the desktop image using bash commands, let's make a crontab entry to update the desktop image automatically. Here's what it looks like - a crontab entry with just the shell command:

# m h  dom mon dow   command
*/20 * * * * /home/me/radar_background.sh
Note that the desktop picture will refresh every 20 minutes.

Explaining the cron instructions:

# m h dom mon dow command - That's just part of the crontab

*/20 * * * * - tells the machine to run the script every 20 minutes. */5 * * * * will run the script every five minutes.

> /dev/null at the end (optional) - tells the machine to not e-mail me every time the script runs.

Make sure the command is all on one line (not wrapped), or you'll get crontab errors.

Wednesday, June 18, 2008

DVD ISO to AVI file

I have an old DVD ISO image (I make DVDs of my kids), and I want to make an AVI copy to upload the funniest bits to YouTube. This is on an Ubuntu 8.04 system, your mileage may vary.

  1. Install dvd::rip using Synaptic
  2. Mount the .iso image (source):
    1. Create a mount point with sudo mkdir /mnt/iso
    2. Mount the image with sudo mount -o loop /path/and/file.iso /mnt/iso
      Alternate: Somewhere along the line, my Thunar magically gained this ability when I right-click on the .iso icon, but I cannot remember which package made this possible...
  3. Rip the DVD. Open dvd::rip.
    1. Preferences: I created no special folder for ripped projects; just saved to the home directory. I checked the dependencies, and had to download a mountain of them (xine, mplayer, etc) using Synaptic.
    2. Storage: Click 'Choose DVD image directory', and select /mnt/iso. Select the button for 'Encode DVD on the fly' since it's already on the hard drive.
    3. Rip Title: Click 'Read DVD table of contents' and the chapters appear. I highlighted (CTRL + Click) the chapters I wanted to convert.
    4. Clip and Zoom: Click the preset menu, select 'Autoadjust - Medium Frame Size, HQ Resize'.
    5. Transcode: Video bitrate calculation is the size of the final file, so I can keep it small (~10 MB per minute, or ~200 MB per half hour). Finally, click 'Transcode' and wait an hour or two or five for the machine to work.
    6. Test the finished file to ensure it's really what you want. I had to do it a couple times, twiddling with various controls.
  4. Cleanup.
    1. Unmount the iso: sudo umount /mnt/iso
    2. Remove the empty mount point: sudo rmdir /mnt/iso
    3. Delete the .iso file (optional, obviously)
    4. Open Synaptic and get rid of all the packages you won't use again. Or use:
      sudo apt-get remove dvdrip mplayer xine
      sudo apt-get autoremove
      sudo apt-get autoclean
      

The package ripmake didn't work - tcprobe failure.

Sunday, June 1, 2008

Sending e-mail from the command line

I want to send automatic e-mail as a cron job from my Xubuntu 8.04 laptop. Originally, I tried routing it through the legacy mail spools - it is, after all, on the same laptop as my e-mail - but gave up in despair. Thanks to Ubuntu Forums for the info.

  1. sudo apt-get install ssmtp heirloom-mailx
    or install ssmtp and nail using Synaptic.
  2. sudo mousepad /etc/ssmtp/ssmtp.conf to edit the ssmtp config file. Modify or add the following lines to the config file:
    mailhub=mail.mymailserver.com
    AuthUser=me@mymailserver.com
    AuthPass=my_mail_password
    
    The nail config file does not need to be changed at all.
  3. Using the nail command to send e-mail:
    Tip: Pay close attention to the <RETURN>s and <CTRL+D>s
    First line: nail recipient@address.com<RETURN>
    Second line: Subject: subject<RETURN>
    Third line: E-mail body text<CTRL+D>

    Example:
    nail me@virusmagnet.com
    Subject: Lotta viruses coming into this account
    I need to stop responding to the spam.
  4. Generating e-mail as part of a script or cron job:

    Script nail -s "Test 3" recipient@email.com < /tmp/test_email will send the following e-mail.
    From: You (automatic)
    To: recipient@email.com
    Subject: Test 3
    Message Body: (read from file /tmp/test_email)


    nail -s "Test 3" recipient@email.com < /dev/null will send an e-mail with a blank body - good for quick reminders using the subject line only.

    To generate e-mail from cron events, use the command crontab -e to edit your crontab file:

    26 21 * * * nail -s "Test 3" recipient@email.com < /tmp/test_email

    This crontab entry will send the same "Test 3" e-mail every day at 9:26 p.m.

Many elements can be added or customized - this is simple enough to generate automatic e-mails to myself.

UPDATE: September 9, 2008: I could do this in evolution, but it's more fun to use cron and nail or zenity
This crontab entry:

0 6 28 * * /usr/bin/nail -s "Reminder bot: Pay The Store Rent!" me@example.com </dev/null

will send the following e-mail at 6:00 am on the 28th of each month,

From:    me <my computer>
To:      me@example.com
Subject: Reminder bot: Pay The Store Rent!
Date:    Thu, 28 Jul 2008 06:00:01 -0500 
Text:    None
So I won't forget to pay the rent.... It's important.
This sends an e-mail to a known (to nail) e-mail server, so all machines that check the account get the mail.
Alternately, if I want a a pop-up window:

0 6 28 * * DISPLAY=:0.0 /usr/bin/zenity --info --title "Reminder Bot" --text "Pay The Store Rent"

will give me a pop-up window instead, and

0 6 28 * * DISPLAY=:0.0 /usr/bin/zenity --notification --text "Reminder Bot: Pay The Store Rent"

will give me a tiny notification-area icon.

Thursday, May 15, 2008

Xubuntu 8.04 sessions

Had terrible problems with applications autostarting at login that I didn't want. I looked everywhere in /etc and /home/me/.config, but OpenOffice and Thunar just kept appearing.

Then I figured it out. One lousy time I checked the Save session for future logins option on logout. So it restarted that way every time.

So the fix was to shut down all applications, logout (saving the session), log back in. Voila! All fixed.

Friday, March 7, 2008

Fixed Toshiba Sound!

Since the reinstall, there's been no sound in Linux. Xubuntu has output no sound. Found the following solution on the Ubuntu Forums.

Edit the alsa config file: sudo mousepad /etc/modprobe.d/alsa-base

Added the following lines at the bottom of the file:

# Fix for Toshiba sound. From Ubuntu Forums
options snd-hda-intel model=auto

We'll see how it works at the next reboot.

Wednesday, March 5, 2008

Reinstallation fallout

<p>So far, only three problems with the reinstallation.</p>
<ol>
  <li>Some data from my shared partition was lost - my backup wasn't as thorough as I thought. I also had to reenter all my e-mail accounts to Evolution (backup copy on the Mac, whew). Nothing critical, just minor annoyances...and a couple Doctor Who episodes.</li>
  <li>The trackpad was fine for the first day, then suddenly became jumpy and unusable today. Looking through various forums, it seems I'm not alone. May or may not be related to the reinstall. On Windows, it was intermittent. On Xubuntu, it's always bad.</li>
  <li>Sound works great on Windows, no sound at all in Xubuntu.  Well, I kind of expected it...</li>
</ol