Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Saturday, August 30, 2014

Zen and the art of system maintenance

I recently discovered that my linux box was woefully low on disk space. So much so that the boot partition was entirely consumed and so was the root partition. I had separated /boot, /home and / on to various partitions. While I reserved several GiB for /home, I reserved only and about 4.5G for / and about 200MiB for /boot.

And I'm still suffering because of it.

I was unable to update the system because it kept complaining that / didn't have enough space. The event that kicked me into action was that /boot ran out of space and some update message threatened imminent system failure.

I employed the services of Ubuntu's excellent disk usage analyzer. In my zeal to seek and destroy large space hoggers, I deleted several large files (more on which files these were and why they were left around, later), and several older kernels from /boot *manually*, e.g.

pushd /boot
sudo rm init*12.04-02*.
sudo rm vmlinuz*12.04-02*.

While this was sound in theory because I had newer kernels around, I still shot myself in the foot when I rebooted. I got the following message:

GRUB: error 15 file not found

Clearly, I had deleted something that had an entry in grub's menu.lst. Weirdly enough, none of the newer kernels which were left behind were updated in menu.lst. I think the reason /boot got consumed that rapidly was that Update manager failed to update menu.lst, but left the kernels in place.

So how to recover?

1. Downloaded UBUNTU rescue remix 12.04 iso and burnt it to DVD
2. boot with DVD
3. examine all hardware in system using lshw
4. determine which class of systems were present

sudo lshw -short

5. lshw -class disk

From the list presented, i saw that /dev/sda2 (ext3) matched my /boot in size and type, so I went ahead and mounted it:
6. sudo mkdir /mnt/sda2
7. sudo mount -t ext3 /dev/sda2 /mnt/sda2
8. pushd /mnt/sda2/boot/grub
9. sudo cp menu.lst menu.lst~
10. sudo vi menu.lst
11. for the very first boot entry (my default was set to 0, so changing the first would work), change init* and vmlinuz* occurrences to appropriate (latest) kernel image from /dev/sda2/boot
12. save file and reboot

Viola! working system. :-)
Joy to the world.


References:
lshw man page
ubuntu rescue remix 12.04

Wednesday, September 11, 2013

Here goes whoopsie!

Mucking around in my system, I noticed a file  /var/lock/whoopsie. Since I had no idea what this was and where this came from, I was naturally suspicious. A couple of web searches answered the question for me. Apparently, this is Ubuntu's take on Dr. Watson, or crash-reporting.

I wanted it turned off, and here's how I did it:

pushd /etc/default/
sudo cp whoopsie whoopsie.backup
sudo vi whoopsie

change report backups to false. I.e.

diff whoopsie.backup whoopsie
3c3
< report_crashes=true
---
> report_crashes=false

sudo stop whoopsie

references:
http://askubuntu.com/questions/135540/what-is-the-whoopsie-process-and-how-can-i-remove-it

Tuesday, November 27, 2012

Installing Brother MFC-J430W on Ubuntu 12.04.1 LTS

Yep, upgraded from my Brother MFC-210C to MFC-J430W. Thanks OfficeMax for the awesome Thanksgiving sale. Now, we have wireless printing in da home! This allows me to print from my iOS devices as well!

Brother's instructions helped me get up and running quickly, but since they are trying to cover several setup configurations all at once, it can get a little confusing. Here's what I did to install it on my fresh Ubuntu 12.04.1 LTS install.

Determine drivers needed
we need to figure out what drivers to install for Ubuntu 12.04.1 LTS

From the following page, it looks like it is brscan4 http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/download_scn.html#brscan3

brscan4 models
DCP-7055 DCP-7055W  DCP-7057  DCP-7060D  DCP-7065DN  DCP-7070DW  DCP-8110DN
DCP-8150DN  DCP-8155DN  DCP-8250DN  DCP-9055CDN  DCP-9270CDN  DCP-J140W  DCP-J525W
DCP-J725DW  DCP-J925DW  FAX-2950  FAX-2990  HL-2280DW  MFC-7240  MFC-7290
MFC-7360  MFC-7360N  MFC-7362N  MFC-7460DN  MFC-7470D  MFC-7860DN  MFC-7860DW
MFC-8510DN  MFC-8515DN  MFC-8520DN  MFC-8690DW  MFC-8710DW  MFC-8910DW  MFC-8950DW / MFC-8950DWT
MFC-9125CN  MFC-9325CW  MFC-9460CDN  MFC-9465CDN  MFC-9560CDW  MFC-9970CDW  MFC-J2510
MFC-J280W  MFC-J425W  MFC-J430W  MFC-J432W  MFC-J435W  MFC-J4410DW  MFC-J4510DW
MFC-J5910DW  MFC-J625DW  MFC-J6510DW  MFC-J6710DW  MFC-J6910DW  MFC-J825DW  MFC-J835DW


Since I have a 32 bit install, i'll be going with the following:
brscan4 32bit  deb  0.4.1-2  61 KB  2012.Oct.09
scan-key-tool 32bit  deb  0.2.4-0  45 KB  2012.Oct.09

Found at: http://www.brother.com/cgi-bin/agreement/agreement.cgi?dlfile=http://www.brother.com/pub/bsc/linux/dlf/brscan4-0.4.1-2.i386.deb&lang=English_lpr

and http://www.brother.com/cgi-bin/agreement/agreement.cgi?dlfile=http://www.brother.com/pub/bsc/linux/dlf/brscan-skey-0.2.4-0.i386.deb&lang=English_lpr

Pre-requisites

found at:http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/before.html#prereq

List of pre-requisites: http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/before.html
Pre-required Procedure (2) (sic)
    Related distributions
    Ubuntu8.04 or greater
    Related products/drivers
    cupswrapper printer/PC-FAX drivers
    Requirement
    1. "sudo aa-complain cupsd" command is required before the installation.
    2. "sudo mkdir /usr/share/cups/model" command (as it is) is required before the installation. 

NOTE:aa-complain changes the enforcment of security policies so that instead of aborting the offending operation, a complaint is written to the syslog instead. From the aa-complain man-page:


 aa-complain is used to set the enforcement mode for one or more profiles to complain. In this mode security policy is not enforced but
       rather access violations are logged to the system log.

Driver download page: http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/index.html

Download the lpr driver
 http://www.brother.com/cgi-bin/agreement/agreement.cgi?dlfile=http://www.brother.com/pub/bsc/linux/dlf/mfcj430wlpr-3.0.0-1.i386.deb&lang=English_lpr

Download cups driver
 http://www.brother.com/cgi-bin/agreement/agreement.cgi?dlfile=http://www.brother.com/pub/bsc/linux/dlf/mfcj430wcupswrapper-3.0.0-1.i386.deb&lang=English_gpl

Install the lpr driver per the following instructions. I'm linking to the original Brother page for reference.
ref: http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/instruction_prn3.html ref: http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/instruction_prn1a.html

follow the install instructions for cupsdriver:


# pushd :~/temp/brother-printer/brother-mfc-j430w
# sudo dpkg  -i  --force-all mfcj430wlpr-3.0.0-1.i386.deb

Selecting previously unselected package mfcj430wlpr.
(Reading database ... 169820 files and directories currently installed.)
Unpacking mfcj430wlpr (from mfcj430wlpr-3.0.0-1.i386.deb) ...
Setting up mfcj430wlpr (3.0.0-1) ...

# sudo dpkg  -i  --force-all mfcj430wcupswrapper-3.0.0-1.i386.deb
Selecting previously unselected package mfcj430wcupswrapper.
(Reading database ... 169848 files and directories currently installed.)
Unpacking mfcj430wcupswrapper (from mfcj430wcupswrapper-3.0.0-1.i386.deb) ...
Setting up mfcj430wcupswrapper (3.0.0-1) ...
cups stop/waiting
cups start/running, process 11255
lpadmin -p MFCJ430W -E -v usb://Brother/MFC-J430W?serial=BROG2F131293 -P /usr/share/cups/model/Brother/brother_mfcj430w_printer_en.ppd

check to ensure that drivers are installed:

# dpkg  -l  |  grep  Brother
ii  mfcj430wcupswrapper                        3.0.0-1                                         Brother CUPS Inkjet Printer Definitions
ii  mfcj430wlpr                                3.0.0-1                                         Brother lpr Inkjet Printer Definitions
ii  printer-driver-ptouch                      1.3-3ubuntu0.1                                  printer driver Brother P-touch label printers

 I think P-touch is from my older MFC-201C. I'll let it be for the time-being.


Connect the printer via USB, and wait a few seconds ~30. Check to see if printer is found:


# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 005 Device 002: ID 046e:6000 Behavior Tech. Computer Corp. 
Bus 001 Device 004: ID 04f9:0281 Brother Industries, Ltd

Open up in a new browser window, and point it to your cups configuration page:

http://localhost:631/printers/

If all went well, you should see something like below:


▼ Queue Name ▼ Description Location Make and Model Status
MFCJ430W MFCJ430W  Brother MFC-J430W CUPS Idle

clicking it should take you to the link:
http://localhost:631/printers/MFCJ430W

You should see something like below:

Description: MFCJ430W
Location: 
Driver: Brother MFC-J430W CUPS (color, 2-sided printing)
Connection: usb://Brother/MFC-J430W?serial=BROG2F131293
Defaults: job-sheets=none, none media=na_letter_8.5x11in sides=one-sided
At this point, test that everything is printing correctly. From the "Maintenance" task lists, select "Print test page". I got a nice printer test page.

 

Sharing your printer over SAMBA no need since this is already a network printer. Simply download windows drivers (Mine was Vista 32bit), and add new printers (network), and the rest happens automatically

Scanner installation

insure sane-utils and xsane packages are installed

sudo-apt get install sane-utils
sudo apt-get install xsane
Instructions at: http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/instruction_scn1a.html

Install USB scanner work only with root

 sudo dpkg  -i  --force-all brscan4-0.4.1-2.i386.deb
Selecting previously unselected package brscan4.
(Reading database ... 169852 files and directories currently installed.)
Unpacking brscan4 (from brscan4-0.4.1-2.i386.deb) ...
Setting up brscan4 (0.4.1-2) ...
This software is based in part on the work of the Independent JPEG Group.

check if it is installed and loaded:
dpkg  -l  |  grep  Brother
ii  brscan4                                    0.4.1-2                                         Brother Scanner Driver

test if printing works for root

sudo xsane

Setting up for normal users:
Instructions: http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/instruction_scn1c.html#u9.10


sudo vi /lib/udev/rules.d/40-libsane.rules
Add the following lines indicated by "+". The lines not starting with + are given for context (diff style). Ensure that + is not included in your actual edits:

ENV{libsane_matched}=="yes", RUN+="/bin/setfacl -m g:scanner:rw $env{DEVNAME}"

+# Brother scanners
+ATTRS{idVendor}=="04f9", ENV{libsane_matched}="yes"

LABEL="libsane_rules_end"

save and reboot

sudo reboot

Monday, November 26, 2012

Getting backuppc to work after upgrading to Ubuntu 12.04.1 LTS "PRECISE"

I saw the latest notice saying Ubuntu 12.04.1 LTS was available, so I went ahead and bit the bullet and updated. So far, it's been a positive experience, but I'm sure there will be other things I'll find that broken or that need tweaking. Backupppc is just the first thing I've discovered. I've also seen several backup apps available in the Ubuntu Store, but I'm not yet sure which ones will work for my use-case (backing up windows laptop to server at home).

first things first: this is my current install:

# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.1 LTS"


backuppc version: version 3.2.1

This string is available when you log in to the webadmin page.

During the install, i ended up selecting "Install distributor's version" of config.pl. Everything went nice and dandy till I logged in after the reboot. I found that my laptop was listed as before, but none of the backups were displayed.
This was understandable because I had changed the location of the backups from the default.

By default, backuppc wants to install at: /var/lib/backuppc However, I got a 1TB drive much after I had started backing up, so I moved the entire backup to the following path: /mnt/windowsE/backuppc 

YES, that's a windows NTFS partition. I wanted to do that so that I could have access to the data from native windows as well (backup isn't the only purpose for the drive, it's my media store as well, and keeping it windows, simplifies a whole bunch of other things. NFS / CIFS not withstanding)

 SIDEBAR: following is an excellent starting point for doing this switcheroo http://sourceforge.net/apps/mediawiki/backuppc/index.php?title=Change_archive_directory

However, I hadn't followed the instructions exactly: I manually edited /etc/backuppc/config.pl and changed $topDir to point directly to my new location /mnt/windowsE/backuppc.

It turns out that this is not cool per backuppc because the $topDir path in config.pl is "informational" only, and is used for updating. In the internals, the path is actually hard-coded during installation, and this can lead to various funkiness.

The better method is to set the appropriate path right during the initial install of backuppc, but this was not possible in my case. The alternative is to then mount the desired path on the expected location ("if you can't bring the mountain to Mohammad...")

 I set up my /etc/fstab with the following rule:
/mnt/windowsE/backuppc /var/lib/backuppc bind defaults,bind,uid=114,gid=127 0 0


uid=114 and gid=127 correspond to the userid and gropuid of the dedicated backup user on my machine. These can be retrieved using:
# id -u backup_user
114
# id -g backup_user
127


Also, since the default config.pl had been over-written, my backup method was no longer set to rsyncd. I restored these settings from the previous version (Ubuntu update was nice enough to store this as /etc/backuppc/config.pl.ufc-old).

After the above changes, I issued a reboot so that the system starts up cleanly (though I hate doing that!). Plus it let me see if there would be any issues with backuppc starting by itself at reboot.

None occurred and I'm cooking with gas.

Tuesday, January 5, 2010

So long VNC. I will miss you. NOT.

Being a lazy embedded software engineer has several advantages, like being able to control every gadget in your house from your couch. Needless to say, you also remotely log in to the several boxes spread around the house.

However, if you happen to be using a windows machine (e.g. a laptop, you are on your couch of course... and only because your smartphone probably does not have a capable enough client just yet) to log in to a unix box and desire to partake in the advantages a GUI offers (all you ssh console people, the GUI is a major advancement, so get with the times already!), then you have to contend with the beast known as VNC.

if you are on a Ubuntu machine (yes, no self-respecting engineer has only a windows machine.. it will, at the very least, dual-boot in to Linux), then ubuntu's Remote Desktop works splendidly. However, if you are ssh-ing over the "nekked inter-webs" then VNC is your only option. and that blows.

Or so I used to think, before running into FreeNX. Google, thou truly art a friend! FreeNX blows VNC completely out of the water. No more need to juggle between Hextile, CoRRE, Tight and other sub-par encodings. No more jiggling of the colormaps, image quality and compression levels only to have the entire processor reduced to competing with molasses, and failing.

also ALT +TAB works! Though it does require one keystroke to enable: "CTRL + ALT + K"
Thanks Mark!

Adios VNC-viewer / REAL VNC. you suck. Hello, FreeNX!

Sunday, August 16, 2009

Wake on Lan: a different kind of magic (packet)

I was having trouble using ether-wake (or etherwake) to wake up my machines. However, I noticed that using wakeonlan (which is a Perl script!) seemed to always work. As an aside, I preferred wakeonlan because it is simpler and doesn't require the extra step of becoming root. Anyways, I wanted to use something that was program and not just a perl script, so I tried figuring out what was different.

A quick wireshark session revealed the packets to be different. And analyzing the packets made me understand what was already written in the manuals for both programs a little better: wakeonlan was using UDP packets (type 0x800), where was ether-wake was generating the "true" magic packet: a raw ethernet packet of type 0x802.

So essentially, the NICs on all my machines seem to not support the ether-wake generated magic packet. That also probably explains why my DDWRT router can't wake my connected machines (this is different from WOWL packets over the wireless link. DDWRT has a known issue about dropping WOL packets when acting as a wireless bridge, but I digress).

The solution to my problem was wakelan. More details at found at http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/wol-mini-howto-3.html

source: ftp://metalab.unc.edu/pub/Linux/system/network/misc/

This is a simple one c-file program that spits out a UDP WOL packet on the specified port. The good thing is that it doesn't need super-user privilege and the great thing is that it works just as well as the wakeonlan script with my machines!

Tuesday, July 21, 2009

Printing in Ubuntu

I had my linux laptop printing to my Brother MFC-210c printer, but since i've changed laptops and now finally got a dedicated linux machine, I wanted to setup a print server. First things first, get the printer to work with CUPS.

Followed instructions from this website:
http://ubuntuforums.org/showthread.php?t=590793

Also very useful was Brother's linux support site (very happy that they're doing this! my next printer is probably going to be Brother too when this one fails!)

*http://solutions.brother.com/linux/en_us/index.html


*http://solutions.brother.com/linux/en_us/instruction_prn1a.html#dpkg1



machine arch: intel p4 HT running ubuntu 8.10

(repeated below for local record)

* install tcsh:


sudo apt-get install tcsh


* download lpd and cups drivers (.dep packages)
from here and here



cd ~/temp/brother-driver
sudo mkdir /var/spool/lpd
sudo dpkg -i --force-all --force-architecture mfc210clpr-1.0.2-1.i386.deb
sudo mkdir /usr/share/cups/model
sudo dpkg -i --force-all cupswrapperMFC210C-1.0.2-3.i386.deb


NB: replace above .deb package with appropriate ones if things change later.

check if the drivers were correctly installed:

dpkg -l | grep --ignore-case brother


The above should generate an output that looks like below:

ii brscan2 0.2.4 Brother Scanner Driver
ii cupswrappermfc210c 1.0.2-3 Brother MFC210C CUPS wrapper driver
ii mfc210clpr 1.0.2-1 Brother lpr Inkjet Printer Definitions


At this point, i was ready to print a test page. However going to System | Administration | Printing showed me two Brother MFC-210C printers. One was listed as a "text only printer", which I simply deleted (because it wasn't working to begin with). Check on the remaining icon that it is listed as "Brother MFC-210C CUPS v1.1" (right click, select Properties).

Print a test page!

Next step, getting the printer shared so that windows machines can print to it.

This needs samba installed and working, which i'm assuming is already done. if not, there's another page on this blog that should help you get up and running.

The following howto page is helpful

http://tldp.org/HOWTO/Debian-and-Windows-Shared-Printing/sharing_with_windows.html

However, these throw open the system to all, so i decided to make some modifications


cd /etc/samba
sudo vi /etc/samba/smb.conf.master


add / modify the following section

[printers]
comment = All Printers
browseable = yes
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
use client driver = yes



restart samba

sudo testparm -s smb.conf.master > smb.conf
sudo /etc/init.d/samba restart


Modify cups files

Windows printer drivers format their output for the printer before sending it across the network. You must configure CUPS to accept the pre-formatted output by uncommenting the following line from


sudo vi /etc/cups/mime.convs



application/octet-stream application/vnd.cups-raw 0 -

Also uncomment the following line from

sudo /etc/cups/mime.types


application/octet-stream

Now CUPS must be told to allow connections from other machines on the network. Add these lines to /etc/cups/cupsd.conf:



AuthType None
Order Deny,Allow
Deny From All
Allow From 192.168.1.*/255.255.255.0




This allows only machines on the local network to access the cups driver.

restart the cups daemon

sudo /etc/init.d/cups restart

Wednesday, December 31, 2008

Ubuntu 8.04 screen brightness issue

Recently upgraded from Ubuntu 7.10 to 8.04 LTS on the lappy. Good for the most part, but it does seem to have its share of kinks which are surprising in that one expects incremental improvements. Screen brightness can now be set with the function keys, which is awesome. However, the GUI for doing the same through Power Management Options seems to be missing. 7.10 had this and I had to monkey with it each time the laptop came back from hibernation.

In 8.10, I have the function brightness up/down keys working, but the laptop seems to jump to medium / maximum brightness anytime I haven't touched any key for a few minutes. This is annoying. I can understand something like this happening when coming out of standby or hibernate, but while it is still running and not in screen-saver mode or anything is simply perplexing.

still searching for a fix. Also found out that there might be a heating / cooling issue.
http://forum.notebookreview.com/showthread.php?t=293543
http://linuxrevolutions.org/2008/05/14/ubuntu-804-laptop-screen-brightness/

Tuesday, July 1, 2008

Ubuntu gripes

I have had a long running argument with a few friends about the utility of Ubuntu. I started out as a Linux believer / fanatic when in school. I drank hook line and sinker the "academia" spiel about Linux being a better and more productive operating system than WinBlows to end. Till I met a few high respected practising academics and professionals who championed otherwise. Thus I decided to be a good engineer and become OS agnostic. I chose to create, in my head, a wet-ware database about what was good about each OS and use it for that purpose.

But the number of exceptions and uses has become far too much for me to bear and I must purge my knowledge in the pensieve of this blog, so that at a later date, I might refer to it without having to relearn history or reinvent the wheel. Hopefully others can use my experiences as well and make better informed and wiser decisions.

Things I do like about Ubuntu Linux:
1.

Things I don't like about Ubuntu LinSux:

1. Laptops aren't supported very well (I understand there is proprietary support required, but that doesn't mean I have to like shoddy things. I would love it if all hardware manufacturers got their act together and supported Linux all out, but then where's the monetary incentive?)

2. It seems to have an increase load of crapware or malformed experimentware. Take tracerd for instance: it is supposed to be a indexer tool to enhance searches. Nice and fine, except that it sucks. No I mean literally. It sucks all available memory and processing power away from the machine even while it is in use. At least windows products are mature enough to not do that. They may have a whole bunch of other things wrong with them (mem leaks for one, zombied processes etc.) but they tend to not cripple you while you work. Not so trackerd. It happily sucks the life of your hard drive and processing cycles from your tasks while it runs.

3. Hibernation doesn't work right. Now I'd like to accept the Ubuntu apologizer's claim "it's because of the broken M$ ACPI model", but I just can't get myself to do that. Each time the machine resumes from hibernation in windows, stuff comes back normal: the screen works, the sound works yada yada. Not so with Gutsy. NetworkManager is not going to work, in addition to sucking all processing cycles (something that isn't supposed to happen in Linux because of its excellent scheduler and extreme advantages against a micro-kernel architecture). Good luck if sound works right. Oh yeah and keep 'em fingers crossed or else the display might not come on right (though mostly, it does). Somehow ACPI under windows seems to be free from these afflictions.

4. sound card doesn't work right. In Winblows Vastage, when you connect a headphone jack, the audio in the speakers is killed (as expected). In Gutsy Linsux, connected a headphone gives you audio in two places! two for the price of one! so if you wanted to hear some music without disturbing those around you, fat chance! Also audio has never dealt very well with hibernation (see 3 above). Btw, FYI, I am currently using Gutsy as I type and I tend to do a lot of my non-work development in Gutsy.

5. Screen brightness goes to eye burning max each time the system resumes from suspend / hibernation. Have to go to Preferences | Power Management each time and jiggle screen brightness around to reduce it to comfortable levels.

6. (07/07/2008) More hibernation quirks: system resumes fine from suspend when idle, but then immediately hibernates. More here and here

7. Can't join the same wireless network after suspend / hibernate. There is an open bug on this.

8. Using Photoshop under Wine initially had the issue that the clone tool (Alt + Click) wouldn't work because it would always try to move the window. Figured out that this was because of Ubuntu's window manager (Gnome). Easily remedied in this case by changing System | Preferences | Windows | used Super "windows logo" plus click for move.



Things I do like about Windows Vista:

Things I don't like about Winblows WasteYa: