title: nodejs sub processes in nohup bash script lock up

text: I run scripts with nohup that contain a list of a few hundred to a few thousand nodejs commands. These nodejs sub processes sync data from mysql and salesforce to couchdb.               $ nohup ./mf-sync.staging-mfdb.sh 2>&1 > mf-sync.staging-mfdb.log &     $ mf-sync.staging-mfdb.sh      The script:               #!/bin/bash     echo "Starting..."     echo "pid $$"     node /opt/node/mix-sync/mf-sync.js --mfi=100017 --source=100982     node /opt/node/mix-sync/mf-sync.js --mfi=100026 --source=101619     node /opt/node/mix-sync/mf-sync.js --mfi=100027 --source=100982     node /opt/node/mix-sync/mf-sync.js --mfi=100036 --source=101619     node /opt/node/mix-sync/mf-sync.js --mfi=100063 --source=100982     node /opt/node/mix-sync/mf-sync.js --mfi=100075 --source=101160     etc....      In a terminal I observe the sub processes stalling:               [rgoya@host ~]$ ps -e | grep sync        26 ?        00:00:00 async/mgr        30 ?        00:03:34 sync_supers      6333 ?        00:00:01 mf-sync     30097 ?        00:00:00 mf-sync.staging          [rgoya@host ~]$ ps -e | grep sync        26 ?        00:00:00 async/mgr        30 ?        00:03:34 sync_supers      6333 ?        00:00:01 mf-sync     30097 ?        00:00:00 mf-sync.staging          [rgoya@host ~]$ kill 6333          [rgoya@host ~]$ ps -e | grep sync        26 ?        00:00:00 async/mgr        30 ?        00:03:34 sync_supers      6423 ?        00:00:00 mf-sync     30097 ?        00:00:00 mf-sync.staging          [rgoya@host ~]$ ps -e | grep sync        26 ?        00:00:00 async/mgr        30 ?        00:03:34 sync_supers      6449 ?        00:00:01 mf-sync     30097 ?        00:00:00 mf-sync.staging      **NOTE:** 30097 is the pid of the `nohup` process. Examining the log before and after killing the subprocess, I see the next `nodejs` command is executed in sequence. I've tried running them with `\--debug` flag for verbose output but I do not see anything unusual. ### Additional notes   * Nodejs has a memory limit of 1GB.   * Couchdb defaults to 2048 max connections.   * The contents of `mf-sync.js`.              #!/usr/bin/env node     process.title = 'mf-sync';          var path = require('path')     ,   fs = require('fs')     ,   _ = require('underscore');          // Parse command-line arguments     var args = _.chain(process.argv).rest(2).map(function(arg) {         arg = arg.replace('--', '').split('=');         _.size(arg) === 1 && arg.push(true);         return arg;     }).object().value();          if (!args.mfi) throw new Error('MFI ID not specified');     if (!args.source) throw new Error('Source ID not specified');          // Output when using `--debug` flag     var debug = function() { if (_.has(args, 'debug')) console.info.apply(this, arguments); };          // Simulation mode     var simulate = _.has(args, 'simulate');          require('util').log('Synchronization for ' + ['mfi', args.source, args.mfi].join('/') + ' started');     simulate && console.warn('Simulation mode enabled. No changes will occurr.');     debug(args);          // Load MySQL configuration     var my = require('mysql');     var myConfig = require(path.join(__dirname, 'mysql.json'));     var db = 'gold';     if (args.source == '101027') db = 'mfdb';     var mysql = my.createConnection(myConfig[db]);     debug('MySQL', myConfig[db].database);          // Load Salesforce configuration     var sf = require('node-salesforce');     var sfConfig = require(path.join(__dirname, 'salesforce.json'));     var salesforce = new sf.Connection(sfConfig);     debug('Salesforce', sfConfig.username);          // Load CouchDB configuration     var cradle = require('cradle');     var couchConfig = require(path.join(__dirname, 'couchdb.json'));     var couch = new(cradle.Connection)(couchConfig.mfdb.host, couchConfig.mfdb.port, couchConfig.mfdb.options).database(couchConfig.mfdb.name);     debug('CouchDB', couchConfig.mfdb.name);          // Add missing function to Underscore.js     _.mixin({         compactObject: function(obj) {             _.each(obj, function(v, k) {                 if (_.isNull(v) || _.isFunction(v)) delete obj[k];             });             return obj;         }     });          // Get MFI data from MySQL     // -----------------------     var getMySQLData = function(mfi, callback) {         mysql.connect();              // Get master MFI metadata         debug('Getting master MFI metadata from `mfi`.');         mysql.query("SELECT * FROM mfi WHERE source_id = ? AND mfi_id = ?", [mfi.source_id, mfi.mfi_id], function(err, rows, fields) {             if (err) throw new Error(err);             _.defaults(mfi, _.chain(rows).first().omit(['parse', '_typeCast']).value());         });              // Define MFDB data tables         var tables = {             'usd/false': ['balance_sheet_usd', 'calculation_usd', 'income_statement_usd', 'infrastructure', 'portfolio_report_usd', 'products_and_clients', 'social_performance'],             'usd/true': ['balance_sheet_adjusted_usd', 'calculation_adjusted_usd', 'income_statement_adjusted_usd', 'infrastructure_adjusted', 'portfolio_report_adjusted_usd', 'products_and_clients_adjusted', 'social_performance'],             'local/false': ['balance_sheet', 'calculation', 'income_statement', 'infrastructure', 'portfolio_report', 'products_and_clients', 'social_performance'],             'local/true': ['balance_sheet_adjusted', 'calculation_adjusted', 'income_statement_adjusted', 'infrastructure_adjusted', 'portfolio_report_adjusted', 'products_and_clients_adjusted', 'social_performance']         };         // Remove table name variance         var baseTable = _.memoize(function(table) {             return table.replace('_usd', '').replace('_adjusted', '');         });              var docs = {};         // Get all available MFDB data for the current `mfi_vid`         debug('Getting all available MFDB data for the current `mfi_vid`.');         _.each(_.keys(tables), function(key) {             _.each(tables[key], function(table) {                 debug('Querying', key, 'data from', table);                 mysql.query("SELECT t.* FROM ?? t INNER JOIN mfi ON t.source_id = mfi.source_id AND t.mfi_id = mfi.mfi_id AND t.mfi_vid = mfi.mfi_vid WHERE t.source_id = ? AND t.mfi_id = ? ORDER BY t.fiscal_year ASC, t.period_type DESC, t.as_of_date ASC", [table, mfi.source_id, mfi.mfi_id], function(err, rows, fields) {                     if (err) throw new Error(err);                          // Create full document data                     _.each(rows, function(row) {                         // Create doc._id                         var doc_id = ['mfi-period', mfi.source_id, mfi.mfi_id, key, row.fiscal_year, row.period_type, row.as_of_date.toISOString().substr(0, 10)].join('/');                         debug('Processing', table, 'data for', doc_id);                              // Initialize document                         if (!docs[doc_id]) docs[doc_id] = {                             _id: doc_id,                             type: 'mfi-period',                             currency: key.split('/')[0],                             adjusted: key.split('/')[1] === 'true',                             fiscal_year: row.fiscal_year,                             period_type: row.period_type,                             as_of_date: row.as_of_date                         };                         if (!docs[doc_id].currency_code && row.currency_code) docs[doc_id].currency_code = row.currency_code;                              // Extend MFDB data into document                         debug('Adding', table, 'data to', doc_id);                         row = _.chain(row).omit(['mfi_id', 'mfi_vid', 'source_id', 'period_type', 'as_of_date', 'fiscal_year', 'currency_code', 'currency_unit']).compactObject().value();                         if (!_.isEmpty(row)) docs[doc_id][baseTable(table)] = row;                     });                 });             });         });              // Get all scenario data to create dimension hierarchy         var tree = {};         mysql.query("SELECT * FROM scenarios", function(err, rows) {             debug('Processing scenario data into hierarchical tree.');             if (err) throw new Error(err);                  // Get all children scenarios for any given parent             var getChildren = function(parent) {                 var children = _.chain(rows).where({parent: parent}).sortBy('weight').pluck('scenarios').object({}).tap(function(scenarios) {                     // Remove used scenarios from master list to decrease stack size                     _.each(_.keys(scenarios), function(scenario) {                         rows = _.without(rows, _.findWhere(rows, {scenarios: scenario}));                     });                 }).value();                 if (_.isEmpty(children)) return null;                 return children;             }                  // Recursively get dimension hierarchy             var getTree = function(hierarchy) {                 if (_.isEmpty(hierarchy)) return;                 _.each(_.keys(hierarchy), function(p) {                     hierarchy[p] = getChildren(p);                     if (!_.isEmpty(hierarchy[p])) getTree(hierarchy[p]);                 });             }                  tree = getChildren('');             getTree(tree);         });              // Find path to nested object property         var findPath = _.memoize(function(needles, haystack) {             function constructPath(haystack, needle, path) {                 if (!_.isObject(haystack)) return false;                 if (typeof haystack !== 'object') return false;                 for (var key in haystack) {                     var value = haystack[key];                     var currentPath = _.extend([], path);                     currentPath.push(key);                     if (key === needle) return currentPath;                     var foundPath = constructPath(value, needle, currentPath);                     if (foundPath) return foundPath;                 }             }             // Handle comma-separated nested hierarchies             return _.chain(needles.split(',')).map(function(needle) {                 return constructPath(haystack, needle, []);             }).flatten().compact().value();         });         // Assign value inside a nested object property         var deepAssign = function(obj, path, val) {             for (var i = 0 in path) {                 var key = path[i];                 if (i == path.length - 1) {                     if (typeof obj[key] === 'object') obj[key].value = val;                     else obj[key] = val;                 } else if (typeof obj[key] !== 'object') {                     obj[key] = _.isUndefined(obj[key]) ? {} : {value: obj[key]};                 }                 obj = obj[key];             }         }         // Sanitize dimension names         var sanitizeDimensions = _.memoize(function(dimensions) {             return _.map(dimensions, function(dimension) {                 dimension = dimension.replace(/mix_/g, '').replace(/Dimension/g, '').replace(/Member/g, '');                 if (/:/.test(dimension)) return dimension.split(':')[1];                 else return dimension;             });         });              // Get dimension data for all available documents         _.each(['usd', 'local'], function(currency) {             var dimensions_table = currency === 'usd' ? 'dimensions_usd' : 'dimensions';             debug('Querying', currency, 'data from', dimensions_table);             mysql.query("SELECT d.fiscal_year, d.period_type, d.as_of_date, d.scenarios, d.line_item_value, t.db_table, t.db_field FROM ?? d INNER JOIN mfi ON d.source_id = mfi.source_id AND d.mfi_id = mfi.mfi_id AND d.mfi_vid = mfi.mfi_vid LEFT JOIN Taxonomy t ON d.element_id = t.Elementid WHERE d.line_item_value IS NOT NULL AND t.db_table IS NOT NULL AND t.db_field IS NOT NULL AND d.source_id = ? AND d.mfi_id = ?", [dimensions_table, mfi.source_id, mfi.mfi_id], function(err, rows, fields) {                 debug('Processing all data from', dimensions_table);                 if (err) throw new Error(err);                 _.each(rows, function(row) {                     var dimension_path = findPath(row.scenarios, tree);                     if (_.isEmpty(dimension_path)) return console.warn('MISSING SCENARIO', row.scenarios);                     _.each(['true', 'false'], function(adjusted) {                         var doc_id = ['mfi-period', mfi.source_id, mfi.mfi_id, currency, adjusted, row.fiscal_year, row.period_type, row.as_of_date.toISOString().substr(0, 10)].join('/');                         var path = sanitizeDimensions([row.db_table, row.db_field].concat(dimension_path));                         docs[doc_id] && deepAssign(docs[doc_id], path, parseFloat(row.line_item_value));                     });                 });             });         });              mysql.end(function(err) {             debug('Disconnected from MySQL', db);             if (err) throw new Error(err);             callback(mfi, docs);         });     }          // Get MFI metadata from Salesforce     // --------------------------------     var getSalesforceData = function(mfi, docs, callback) {         var remaining = 4;         var done = function(mfi, docs) {             if (--remaining === 0) {                 callback(mfi, docs);                      // Logout from Salesforce                 salesforce.logout(function(err) {                     debug('Logged out from Salesforce');                     if (err) throw new Error(err);                 });             }         }              // Login into Salesforce         debug('Login into Salesforce');         salesforce.login(sfConfig.username, sfConfig.password + sfConfig.security_token, function(err, userInfo) {             if (err) throw new Error(err);                  // Get main MFI Metadata             debug('Getting MFI metadata from Salesforce');             salesforce.query("SELECT Id, Name, Record_ID__c, mix_Diamonds__c, Date_Established__c, mix_Region__c, Country__c, Operations_Comprised_by_MF__c, Regulated__c, Current_Legal_Status__c, Profit_Status__c FROM Account WHERE Record_ID__c = '" + mfi.mfi_id + "'", function(err, result) {                 if (err) throw new Error(err);                 if (result.totalSize === 0) throw new Error('MFI does not exist');                 var record = {};                 _.chain(result.records).first().omit(['attributes', 'Id']).each(function(v, k) {                     // Make attributes lowercase                     record[k.toLowerCase()] = v;                 });                 _.extend(mfi, record);                 mfi.mfi_name = mfi.name;                 done(mfi, docs);             });                  // Determine whether MFI contains Social Performance Profile data             debug('Determining whether MFI contains SP Profile data.');             salesforce.query("SELECT Id, Record_ID__c FROM Account WHERE Record_ID__c = '" + mfi.mfi_id + "' AND Id IN (SELECT Organization__c FROM SP_Profile__c)", function(err, result) {                 if (err) throw new Error(err);                 mfi.sp_profile = !_.isEmpty(result.records);                 done(mfi, docs);             });                  // Get list of MFI Network Affiliations             debug('Getting list of MFI Network Affiliations');             salesforce.query("SELECT Source_Organization__r.Name FROM Partnership__c WHERE Relationship__c = 'Network Affiliation' AND Status__c = 'Current' AND Target_Organization__r.Id = '" + mfi.organization_id + "'", function(err, result) {                 if (err) throw new Error(err);                 mfi.networks = _.chain(result.records).pluck('Source_Organization__r').pluck('Name').value();                 done(mfi, docs);             });                  // Get annual diamonds             debug('Getting annual diamonds.');             salesforce.query("SELECT Period__c, Diamond_Score__c FROM Data_Campaign_Status__c WHERE Organization__c = '" + mfi.organization_id + "'", function(err, result) {                 if (err) throw new Error(err);                 // Group diamonds by year                 var diamonds = _.chain(result.records).map(function(period) {                     return _.chain(period).pick(['Period__c', 'Diamond_Score__c']).values().value();                 }).object().value();                 // Add diamonds to corresponding periods                 _.chain(docs).filter(function(doc) { return doc.period_type === 'ANN'; }).each(function(doc) {                     doc.annual_diamonds = diamonds[doc.fiscal_year];                 });                 done(mfi, docs);             });         });     }          // Calculate Peer Group data     // -------------------------     var calculatePeerGroupData = function(docs, callback) {         // Safely get data point value         var getVal = function(obj, group, prop) {             if (_.has(obj, group) && _.has(obj[group], prop)) {                 return obj[group][prop].value || obj[group][prop];             }             return undefined;         }              _.each(docs, function(doc, id) {             var peer_groups = {};                  // Age             debug('Calculating peer group age for', doc._id);             if (_.has(doc, 'date_established__c')) {                 var age = Math.abs(Date.parse(doc.as_of_date) - Date.parse(doc.date_established__c)) / (86400000 * 365.242199);                 if (age) {                     if (age < 4) peer_groups['age'] = 'New';                     else if (age <= 8) peer_groups['age'] = 'Young';                     else if (age > 8) peer_groups['age'] = 'Mature';                 }             }                  // Intermediation             debug('Calculating peer group intermediation for', doc._id);             var deposits = getVal(doc, 'balance_sheet', 'deposits');             var total_assets = getVal(doc, 'balance_sheet', 'total_assets');             if (!_.isUndefined(deposits) && !_.isUndefined(total_assets) && total_assets > 0) {                 var ratio = deposits / total_assets;                 if (ratio === 0) peer_groups['intermediation'] = 'Non FI';                 else if (ratio < 0.2) peer_groups['intermediation'] = 'Low FI';                 else if (ratio >= 0.2) peer_groups['intermediation'] = 'High FI';             }             else if (total_assets === 0) {                 peer_groups['intermediation'] = 'Non FI';             }                  // Market             debug('Calculating peer group market for', doc._id);             var depth = getVal(doc, 'calculation', 'average_balance_borrower_per_capita') || getVal(doc, 'calculation', 'average_outstanding_balance_per_capita');             var average_loan_size = getVal(doc, 'calculation', 'average_balance_borrower') || getVal(doc, 'calculation', 'average_outstanding_balance');             if (!_.isUndefined(depth) || !_.isUndefined(average_loan_size)) {                 if (depth < .2 || average_loan_size < 150) peer_groups['market'] = 'Low End';                 else if ((depth >= .2) && (depth < 1.5)) peer_groups['market'] = 'Broad';                 else if ((depth >= 1.5)  && (depth < 2.5)) peer_groups['market'] = 'High End';                 else if ((depth >= 2.5)) peer_groups['market'] = 'Small Business';             }                  // Outreach             debug('Calculating peer group outreach for', doc._id);             var total_borrowers = getVal(doc, 'products_and_clients', 'total_borrowers');             if (total_borrowers < 10000) peer_groups['outreach'] = 'Small';             else if (total_borrowers < 30000) peer_groups['outreach'] = 'Medium';             else if (total_borrowers >= 30000) peer_groups['outreach'] = 'Large';                  // Scale             debug('Calculating peer group scale for', doc._id);             if (_.has(doc, 'mix_region__c')) {                 var gross_loan_portfolio = getVal(doc, 'balance_sheet', 'gross_loan_portfolio');                 if (gross_loan_portfolio < 2000000 || (gross_loan_portfolio < 4000000 && doc.mix_region__c == 'Latin America and The Caribbean')) peer_groups['scale'] = 'Small';                 else if (gross_loan_portfolio < 8000000 || (gross_loan_portfolio < 15000000 && doc.mix_region__c == 'Latin America and The Caribbean')) peer_groups['scale'] = 'Medium';                 else if (gross_loan_portfolio > 8000000) peer_groups['scale'] = 'Large';             }                  // Sustainability             debug('Calculating peer group sustainability for', doc._id);             var operational_self_sufficiency = getVal(doc, 'calculation', 'operational_self_sufficiency');             if (!_.isUndefined(operational_self_sufficiency)) {                 if (doc.adjusted) peer_groups['sustainability'] = operational_self_sufficiency < 1 ? 'Non-FSS' : 'FSS';                 else peer_groups['sustainability'] = operational_self_sufficiency < 1 ? 'Non-OSS' : 'OSS';             }                  if (!_.isEmpty(peer_groups)) docs[id].peer_groups = peer_groups;         });              callback(docs);     }          // Send data to CouchDB     // --------------------     var updateCouchDB = function(docs, callback) {         // Update master MFI record         debug('Updating master MFI record');         var mfi = docs.shift();         couch.get(mfi._id, function(err, doc) {             if (err) {                 if (err.error === 'not_found') {                     require('util').log('Inserting ' + mfi._id);                     !simulate && couch.save(mfi._id, mfi, function(err, res) {                         debug('Inserted', res);                         if (err) throw new Error(err);                     });                 } else throw new Error(err);             } else if (doc._rev) {                 require('util').log('Updating ' + mfi._id);                 !simulate && couch.save(mfi._id, doc._rev, mfi, function(err, res) {                     debug('Updated', res);                     if (err) throw new Error(err);                 });             }         });              // Get list of existing IDs in CouchDB         debug('Getting list of existing IDs in CouchDB');         couch.all({startkey: ['mfi-period', args.source, args.mfi].join('/'), endkey: ['mfi-period', args.source, args.mfi, '~'].join('/')}, function(err, ids) {             if (err) throw new Error(err);                  // Remove outdated documents from CouchDB             _.chain(ids).pluck('id').difference(_.pluck(docs, '_id')).map(function(id) {                 return _.findWhere(ids, {id: id});             }).each(function(doc) {                 require('util').log('Removing ' + doc.id);                 couch.remove(doc.id, doc.value.rev, function(err, res) {                     debug('Removed', res);                     if (err) throw new Error(err);                 });             });                  // Insert/update all documents for this MFI             _.each(docs, function(doc) {                 var update = _.findWhere(ids, {id: doc._id});                 if (update) {                     require('util').log('Updating ' + doc._id);                     !simulate && couch.save(doc._id, update.value.rev, doc, function(err, res) {                         debug('Updated', res);                         if (err) throw new Error(err);                     });                 } else {                     require('util').log('Inserting ' + doc._id);                     !simulate && couch.save(doc._id, doc, function(err, res) {                         debug('Inserted', res);                         if (err) throw new Error(err);                     });                 }             });                  callback();         });     }          // Initialize MFI document     var mfi = {         _id: 'mfi/' + args.source + '/' + args.mfi,         type: 'mfi',         source_id: args.source,         mfi_id: args.mfi,         updated: new Date()     };          getMySQLData(mfi, function(mfi, docs) {         getSalesforceData(mfi, docs, function(mfi, docs) {             // Merge MFI metadata into each period             _.each(docs, function(doc, id) {                 docs[id] = _.extend(_.clone(mfi), doc);             });             calculatePeerGroupData(docs, function(docs) {                 // Convert to array for bulk updating                 docs = _.union([mfi], _.values(docs));                 updateCouchDB(docs, function() {                     require('util').log('Synchronization for ' + ['mfi', args.source, args.mfi].join('/') + ' finished');                 });             });         });     });      ### Questions I would like to know:   1. Why these sub processes appear to freeze? (I cannot find any evidence that the ones that freeze are any different than the ones that execute and stop).   2. How I might be able to script stopping a sub process that freezes for several minutes, so that I do not have to kill it manually?


title: Is there any shared filesystem based on public key authentication?

text: I normally use NFS, however I am not so comfortable with the security as basically a root user can just change his UID to an arbitrarily one in order to obtain access to a shared folder. Moreover, access can be restricted based on the IP address of a machine, but someone who has access to the router can temporarily change his IP address (to one having access). I think the best solution would be a shared file system which uses public key authentication to manages access rights, e.g. similar to ssh. Does such a technology exist for a **multi-user** network file system in linux with **concurrent read/write** access?


title: Light linux for disk operations

text: I have old computer with Windows XP system and it started crashing randomly. I need light OS, which can be booted as Live CD/DVD in which I could copy all data from hdd to external hdd. I have tried few system (ofc ubuntu, but also puppy linux) but they all didn't run (kernel panic while booting) or works **very** slow. All I need is OS with drivers for hdd, windows file system (fat, ntfs) and terminal with cp.


title: Is there a command reverse search in vim?

text: In linux cli I can do `ctrl-r` and do a reverse search and choose something I have done easily.   Is there something similar in vim? I mean I may run a command using `:` (could be anything like a long substitution) and if I need to do it again I need to retype it.   Is there a way to avoid retyping but instead somehow search back and execute it?


title: How to setup anonymous NFS correctly

text: I set up an NFS server on Ubuntu Server 12.04 for my linux based DVB-S receiver (Spark 7162) Unfortunately the receiver is only able to connect anonymously. Directories are created but can not be written to because the permissions are not sufficient:               drw-r--r-- 2 receiver receiver 4096 Feb  8 22:49 @Law & Order_ Special Victims Unit_1      Because of this writing broadcasts to NFS fails. This is the content of my /etc/fstab:               /home   /export/users   none    bind,umask=000   0      0      I toyed around with fmask=0 and dmask=0 but this didn't help either. Both the /export and the /export/users directory are set up this way: > drwxrwxrwx 3 receiver receiver 4096 Feb 8 18:08 export This is the content of my /etc/exports:               /export/users   192.168.0.0/24(rw,nohide,insecure,no_subtree_check,async,anonuid=1001,anongid=1001)      In the .profile of user "receiver" I set umask 000 What am I doing wrong ? Even although I set permissions very generously I simply can't get the directory permissions right and write to it.


title: exim4 on debian: why does this ACL work when testing with -bh but not in actual use?

text: I've got local_acl_check_data to reject the typical spammer tactic of using the same address as From: and To:, but since some less-spammy sources, such as Yahoo Groups, do this, I'm using a whitelist as well. Here is the ACL:               # block spammers who use the same "from" and "to" address     accept         senders = ${if exists{CONFDIR/local_sender_whitelist}\                        {CONFDIR/local_sender_whitelist}\                        {}}     deny         condition = ${if eqi{${address:$h_from:}}{${address:$h_to:}}{true}{false}}         log_message = rejecting spam with to:${address:$h_to:} and from:${address:$h_from:}         message = Message identified as spam. If you think this is wrong, get in touch with postmaster      Problem is, when I test with:               jcomeau@tektonic:~$ cat bin/testacl      exim4 -bh 66.163.168.186 <<EOT     helo tester     mail from: PetalumaFreecycle@yahoogroups.com     rcpt to: jc@example.com     data     from: PetalumaFreecycle@yahoogroups.com     to: PetalumaFreecycle@yahoogroups.com     subject: should be ok          this one should not reject     .     mail from: PetalumaFreecycle@yahoo.com     rcpt to: jc@example.com     data     from: PetalumaFreecycle@yahoo.com     to: PetalumaFreecycle@yahoo.com     subject: should reject          this one should be rejected     .     quit     EOT      It works as expected: the first message is accepted because it found yahoogroups.com in the whitelist, and the second was rejected. But in real operation, the yahoogroups.com emails are rejected by that ACL along with the spammers. I'm using 4.72-6, and this has happened for all the versions I've been using for the last few years. I've run out of ideas. As requested, the log of exim4 rejecting a message which should have passed:               jcomeau@tektonic:~$ grep -C2 Freecycle /var/log/exim4/rejectlog     2011-02-25 09:52:00 1Psz1U-00020g-79 H=n52c.bullet.mail.sp1.yahoo.com [66.163.168.186] F=<sentto-15991578-2122-1298645513-jc=example.com@returns.groups.yahoo.com> rejected after DATA: rejecting spam with to:PetalumaFreecycle@yahoogroups.com and from:PetalumaFreecycle@yahoogroups.com     Envelope-from: <sentto-15991578-2122-1298645513-jc=example.com@returns.groups.yahoo.com>     Envelope-to: <jc@example.com>     --       MIME-Version: 1.0     I Message-ID:        Mailing-List: list PetalumaFreecycle@yahoogroups.com; contact PetalumaFreecycle-owner@yahoogroups.com       Delivered-To: mailing list PetalumaFreecycle@yahoogroups.com       List-Id: <PetalumaFreecycle.yahoogroups.com>       Precedence: bulk       List-Unsubscribe: <mailto:PetalumaFreecycle-unsubscribe@yahoogroups.com>       Date: 25 Feb 2011 14:51:53 -0000     F From: PetalumaFreecycle@yahoogroups.com     T To: PetalumaFreecycle@yahoogroups.com       Subject: [Petaluma Freecycle] Digest Number 2122       X-Yahoo-Newman-Property: groups-digest-trad-m     R Reply-To: "No Reply"<notify-dg-PetalumaFreecycle@yahoogroups.com>       Content-Type: text/plain; charset=ISO-8859-1       Content-Transfer-Encoding: quoted-printable      And here's what my testacl script shows for the first test:               >>> using ACL "acl_check_data"     >>> processing "accept"     >>> check senders = ${if exists{/etc/exim4/local_sender_whitelist}{/etc/exim4/local_sender_whitelist}{}}     >>> yahoogroups.com in "yahoogroups.com"? yes (matched "yahoogroups.com")     >>> PetalumaFreecycle@yahoogroups.com in "/etc/exim4/local_sender_whitelist"? yes (matched "yahoogroups.com" in /etc/exim4/local_sender_whitelist)     >>> accept: condition test succeeded     LOG: 1PuxAz-0005jZ-B0 <= PetalumaFreecycle@yahoogroups.com H=n52c.bullet.mail.sp1.yahoo.com (tester) [66.163.168.186] P=smtp S=380     250 OK id=1PuxAz-0005jZ-B0


title: I can't remove a directory tree with rm -rf

text: This seems very strange to me. I'm running kernel 2.6.37.2 and ran:               ~]$ cp -r /proc/ here     ~]$ rm -rf here      I get some permission denies when copying as expected and I eventually hit Control-C. I get `Permission denied` on a lot of files when trying to remove the new directory and files. As a note, I found this weird behavior because a friend sent me a `.tgz` of a snapshot of his `/proc` dir. I extracted the directory and when I was finished looking through it I had the same problem. `rm -rf` as root does work. `lsattr` shows the e attribute (which is what all of my files/directories show).


title: Number comparisons in BusyBox ash

text: I have the following script that extracts data from the EXIF command on my BusyBox ash-based system. I parse the date tag from the end of the file and use case as a final check to ensure the format is correct. My problem is the if statement at the end always seems to return true ie. `d="$e - Jebby (exif"` always runs. If I echo $en and echo $dn it shows $en is greater than $dn but the if statement still runs the `d="$e - Jebby (exif"`               x=<valid filename>     e=$(exif -d -m -t 0x9003 -- "$x" 2>/dev/null)     let l=${#e}-18     e=$(expr substr "$e" $l 19)     e="${e%[ ][0-2][0-9][:][0-6][0-9][:][0-6][0-9]*}"      e="${e##*[!1-2][!09][!0-9][!0-9][!:][!0-1][!0-9][!:][!0-3][!0-9]}"     e=$(expr substr "$e" 1 4)$(expr substr "$e" 6 2)$(expr substr "$e" 9 2)     case "$e" in         [1-2][09][0-9][0-9][0-1][0-9][0-3][0-9])          let en=$e+3          ds="${d% - Jebby (}"          let dn=$ds          if [ $en -lt $dn ]; then             d="$e - Jebby (exif"          fi     esac


title: How can I preview the GRUB2 boot screen?

text: I've been reading a tutorial that shows how to set the background image that will be displayed behind the GRUB2 boot options menu. However, I am concerned that the text might not be visible against the image I've chosen. How can I preview what the screen will look like, without having to restart the computer?


title: Command working from CLI but not from script

text: I have a command that I use from the CLI to properly color files, folders, executables, etc. The command that I'm executing looks like this:               test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"      I'd like to run this command from inside a script, but it does not work:               #!/usr/bin/env bash          test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"      How can I excute this command inside a script? I can't figure out why this command doesn't work from within a script? running `/bin/bash -x myscript.sh` produces the following output:               $ /bin/bash -x myscript.sh     + test -r /home/turtle/.dircolors     + dircolors -b /home/turtle/.dircolors     LS_COLORS='no=00;38;5;244:rs=0:di=00;38;5;33:ln=01;38;5;37:mh=00:pi=48;5;230;38;5;136;01:so=48;5;230;38;5;136;01:do=48;5;230;38;5;136;01:bd=48;5;230;38;5;244;01:cd=48;5;230;38;5;244;01:or=48;5;235;38;5;160:su=48;5;160;38;5;230:sg=48;5;136;38;5;230:ca=30;41:tw=48;5;64;38;5;230:ow=48;5;235;38;5;33:st=48;5;33;38;5;230:ex=01;38;5;64:*.tar=00;38;5;61:*.tgz=01;38;5;61:*.arj=01;38;5;61:*.taz=01;38;5;61:*.lzh=01;38;5;61:*.lzma=01;38;5;61:*.tlz=01;38;5;61:*.txz=01;38;5;61:*.zip=01;38;5;61:*.z=01;38;5;61:*.Z=01;38;5;61:*.dz=01;38;5;61:*.gz=01;38;5;61:*.lz=01;38;5;61:*.xz=01;38;5;61:*.bz2=01;38;5;61:*.bz=01;38;5;61:*.tbz=01;38;5;61:*.tbz2=01;38;5;61:*.tz=01;38;5;61:*.deb=01;38;5;61:*.rpm=01;38;5;61:*.jar=01;38;5;61:*.rar=01;38;5;61:*.ace=01;38;5;61:*.zoo=01;38;5;61:*.cpio=01;38;5;61:*.7z=01;38;5;61:*.rz=01;38;5;61:*.apk=01;38;5;61:*.gem=01;38;5;61:*.jpg=00;38;5;136:*.JPG=00;38;5;136:*.jpeg=00;38;5;136:*.gif=00;38;5;136:*.bmp=00;38;5;136:*.pbm=00;38;5;136:*.pgm=00;38;5;136:*.ppm=00;38;5;136:*.tga=00;38;5;136:*.xbm=00;38;5;136:*.xpm=00;38;5;136:*.tif=00;38;5;136:*.tiff=00;38;5;136:*.png=00;38;5;136:*.svg=00;38;5;136:*.svgz=00;38;5;136:*.mng=00;38;5;136:*.pcx=00;38;5;136:*.dl=00;38;5;136:*.xcf=00;38;5;136:*.xwd=00;38;5;136:*.yuv=00;38;5;136:*.cgm=00;38;5;136:*.emf=00;38;5;136:*.eps=00;38;5;136:*.CR2=00;38;5;136:*.ico=00;38;5;136:*.tex=01;38;5;245:*.rdf=01;38;5;245:*.owl=01;38;5;245:*.n3=01;38;5;245:*.ttl=01;38;5;245:*.nt=01;38;5;245:*.torrent=01;38;5;245:*.xml=01;38;5;245:*Makefile=01;38;5;245:*Rakefile=01;38;5;245:*build.xml=01;38;5;245:*rc=01;38;5;245:*1=01;38;5;245:*.nfo=01;38;5;245:*README=01;38;5;245:*README.txt=01;38;5;245:*readme.txt=01;38;5;245:*.md=01;38;5;245:*README.markdown=01;38;5;245:*.ini=01;38;5;245:*.yml=01;38;5;245:*.cfg=01;38;5;245:*.conf=01;38;5;245:*.c=01;38;5;245:*.cpp=01;38;5;245:*.cc=01;38;5;245:*.log=00;38;5;240:*.bak=00;38;5;240:*.aux=00;38;5;240:*.lof=00;38;5;240:*.lol=00;38;5;240:*.lot=00;38;5;240:*.out=00;38;5;240:*.toc=00;38;5;240:*.bbl=00;38;5;240:*.blg=00;38;5;240:*~=00;38;5;240:*#=00;38;5;240:*.part=00;38;5;240:*.incomplete=00;38;5;240:*.swp=00;38;5;240:*.tmp=00;38;5;240:*.temp=00;38;5;240:*.o=00;38;5;240:*.pyc=00;38;5;240:*.class=00;38;5;240:*.cache=00;38;5;240:*.aac=00;38;5;166:*.au=00;38;5;166:*.flac=00;38;5;166:*.mid=00;38;5;166:*.midi=00;38;5;166:*.mka=00;38;5;166:*.mp3=00;38;5;166:*.mpc=00;38;5;166:*.ogg=00;38;5;166:*.ra=00;38;5;166:*.wav=00;38;5;166:*.m4a=00;38;5;166:*.axa=00;38;5;166:*.oga=00;38;5;166:*.spx=00;38;5;166:*.xspf=00;38;5;166:*.mov=01;38;5;166:*.mpg=01;38;5;166:*.mpeg=01;38;5;166:*.m2v=01;38;5;166:*.mkv=01;38;5;166:*.ogm=01;38;5;166:*.mp4=01;38;5;166:*.m4v=01;38;5;166:*.mp4v=01;38;5;166:*.vob=01;38;5;166:*.qt=01;38;5;166:*.nuv=01;38;5;166:*.wmv=01;38;5;166:*.asf=01;38;5;166:*.rm=01;38;5;166:*.rmvb=01;38;5;166:*.flc=01;38;5;166:*.avi=01;38;5;166:*.fli=01;38;5;166:*.flv=01;38;5;166:*.gl=01;38;5;166:*.m2ts=01;38;5;166:*.divx=01;38;5;166:*.webm=01;38;5;166:*.axv=01;38;5;166:*.anx=01;38;5;166:*.ogv=01;38;5;166:*.ogx=01;38;5;166:';      export LS_COLORS


title: How do I reset RHEL6 to autocreate home directory upon login?

text: I am using a RHEL6 host that is set up using LDAP for authenication. Upon first login it is supposed to create the home directory for the user (e.g. `/home/gisle` where _gisle_ is my login username). I have not configured this host myself. I goofed up. I am supposed to connect from another host ( _staff.example.com_ ) in the cluster using the following command:               ssh gisle@remote.example.com      I've done this on dozen of identically configured hosts, and it works. However, this time I typed:               ssh remote.example.com      I was not prompted for a username, but username _gisle_ was obviously assumed. When I typed in the password (using the same password as I use to authenticate on _staff.example.com_ ), I was authenticated with LDAP and logged in, but no home directory was created on this inital login (instead my account was set up with my home directory set to the home directory path picked up from the machine I was coming from - i.e. `/home/staff/g/gisle`). Logging out and logging in again (with `ssh gisle@remote.example.com`) does not fix the problem. The notion about the "wrong" home directory persists. I have the same username (gisle) on both systemes. My home directory on _staff.example.com_ is `/home/staff/g/gisle`. This directory does not exist on _remote.example.com_ - nor is it supposed to exist. Here is the result of logging in on the remote now:               $ ssh gisle@remote.example.com     Last login Sun Jan 19 16:22:40 2014 from staff.example.com     Could not chdir to home directory /home/staff/g/gisle     $ whoami     gisle     $ echo $HOME     /home/staff/g/gisle     $ pwd     /      I need to "reset" the status of my account so that the RHEL6 host forget all about me logging in, believe I am logging in for the first time, and automatically create the home directory. I have root access on _remote.example.com_ , but do not know what to do.


title: FTP and iptables. Connection fails but ports are open

text: I installed proftp on my machine. With iptables disabled I can connect to the machine, using ftp-client or telnet.   With iptables connection fails - telnet says "Connection failed"                 # works     telnet 192.10.10.11 22           # connection failed     telnet 192.19.10.11 20     telnet 192.19.10.11 21      I found this topic, but it did not help. Since I do open the Ports 22 and 21,20 the same way they should all be accessable through telnet? But 22 works and 21,20 fail. Any ideas why this happens? `sudo iptables -L -v`                Chain INPUT (policy DROP 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination         0     0 ACCEPT     all  --  lo     any     anywhere             anywhere       100  7136 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:ssh         3   152 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:ftp         0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpts:1010:1012       586 78898 ACCEPT     udp  --  eth0   any     anywhere             anywhere             udp dpt:openvpn         0     0 ACCEPT     all  --  tun+   any     anywhere             anywhere       348 22567 ACCEPT     all  --  tap+   any     anywhere             anywhere        69 10294 DROP       all  --  any    any     anywhere             anywhere          Chain FORWARD (policy DROP 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination          Chain OUTPUT (policy DROP 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination         0     0 ACCEPT     all  --  any    lo      anywhere             anywhere        95 11028 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp spt:ssh         0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp spt:ftp-data       354 55626 ACCEPT     udp  --  any    eth0    anywhere             anywhere             udp dpt:openvpn         0     0 ACCEPT     all  --  any    tun+    anywhere             anywhere       353 26295 ACCEPT     all  --  any    tap+    anywhere             anywhere         4   392 DROP       all  --  any    any     anywhere             anywhere      `iptables configurations:`               #!/bin/sh          # Flushing all rules     iptables -F     iptables -X          # Setting default filter policy     iptables -P INPUT DROP     iptables -P OUTPUT DROP     iptables -P FORWARD DROP          # Allow unlimited traffic on loopback     iptables -A INPUT -i lo -j ACCEPT     iptables -A OUTPUT -o lo -j ACCEPT          # Allow ssh on Port 22     iptables -A INPUT -p tcp --dport 22 -j ACCEPT     iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT                    # Ports for FTP          #Allowing FTP Connections, including passive ports. (proftpd)     sudo iptables -A INPUT -p tcp --dport 21 -j ACCEPT          # Allowing FTP Connections in active mode, where Data are passed through Port 20     sudo iptables -A OUTPUT -p tcp --sport 20 -j ACCEPT          # Allowing Ports for Passive Mode connection, where Data is passed through ports     sudo iptables -A INPUT -p tcp --dport 1010:1012 -j ACCEPT                         # allow connection via 1194 so that openVpn can use the network adapter     iptables -A INPUT -i eth0 -p udp --dport 1194 -j ACCEPT     iptables -A OUTPUT -o eth0 -p udp --dport 1194 -j ACCEPT     # allow connections via openVPN tun and tap interfaces     iptables -A INPUT -i tun+ -j ACCEPT     iptables -A OUTPUT -o tun+ -j ACCEPT     iptables -A INPUT -i tap+ -j ACCEPT     iptables -A OUTPUT -o tap+ -j ACCEPT               # make sure nothing else comes or goes out of this box     iptables -A INPUT -j DROP     iptables -A OUTPUT -j DROP


title: Unmet Dependencies and sub-process /usr/bin/dpkg returned an error code(1) error in DEBIAN

text: I'm trying to install desktop environment on Debian in VM gnome:                 apt-get install gnome-desktop-environment      Throws Error:                Reading package lists.. Done      Building dependency tree      Reading state information.. Done      You might want to run 'apt-get-f install' to correct these;      The following packages have unmet Dependencies:      gnome-desktop-environment : Depends: gnome(>=1:3.4+7+deb7u1) but it is not going to be installed       liblouis2 : Depends: liblouis-data but it is not going to be installed       python-pyatspi2 : Depends: python-pyatspi(=2.5.3+dfsg-3) but it is not going to be installed       tracker-gui: Depends: tracker(=0.14.1-3) but it is not going to be installed       E:Unmet dependencies. Try apt-get install with no packages(or specify a solution).      Then tried this code               apt-get -f install       Errors were encountered while processing                  /var/cache/apt/archives/tracker_0.14.1-3_amd64.deb        /var/cache/apt/archives/liblouis-data_2.4.1-1_all.deb        /var/cache/apt/archives/libatk-adapter_2.5.3-2_amd64.deb        /var/cache/apt/archives/libgail-common_2.24.10-2_amd64.deb        /var/cache/apt/archives/python-pyatspi_2.5.3+dfsg-3_all.deb      E: sub-process /usr/bin/dpkg returned an error code(1)       And also i have tried below code but failed                    # apt-get install aptitude tasksel          # tasksel install gnome-desktop --new-install


title: Can't download Debian's Two Blu-Ray Disk

text: I use this command:               $ jigdo-lite --noask debian-7.1.0-amd64-BD-1.jigdo     $ jigdo-lite --noask debian-7.1.0-amd64-BD-2.jigdo      I'm already download 41Gb. But It is stuck with next err:               --2013-10-15 15:27:36--  ftp://ftp.debian.org/debian/pool/main/v/virtuoso-opensource/virtuoso-opensource-6.1-bin_6.1.4+dfsg1-7_amd64.deb       (try: 5) => ‘debian-7.1.0-amd64-BD-1.iso.tmpdir/ftp.debian.org/debian/pool/main/v/virtuoso-opensource/virtuoso-opensource-6.1-bin_6.1.4+dfsg1-7_amd64.deb’     Connecting to ftp.debian.org (ftp.debian.org)|130.89.148.12|:21... connected.     Logging in as anonymous ...      Error in server response, closing control connection.     Retrying.      Is there any hooks or alternatives to Jigdo? I'm really do not understand why there is no .torrent files. I can't see the progress of downloading, I have no idea which of deb packages doesn't downloaded yet, except this virtuoso. Is there another way to get Debian's Two Blu-Ray Disk?


title: mpd/mpc and NTFS mount

text: My music directory is kept on an NTFS mount as it was the simplest way to have it on both window and *nix machines. I am trying to get mpd/mpc to actually read the directory and getting no where. /etc/fstab shows:               /dev/sda1   /media/MediaVault   ntfs    defaults 0 0      /etc/mpd.conf shows:               music_directory "/media/MediaVault/MP3z"     user "mpd"      However, mpd cannot seem to find that music directory. When I run it (via service) I get the following in the log:               mpd[6508]: Failed to stat directory "/media/MediaVault/MP3z": Permission denied      And mpc add X gives me: `X: directory or file not found`. However:               ; ls -ld /media/MediaVault/MP3z     8.0K drwxrwxrwx. 1 root root 8.0K Sep 29 10:45 /media/MediaVault/MP3z/     ; ls -ld /media/MediaVault/         4.0K drwxrwxrwx. 1 root root 4.0K Oct 13 12:51 /media/MediaVault/     ; ls -ld /media/                0 drwxr-xr-x. 5 root root 100 Oct 15 08:43 /media/      Note that I can access the ntfs mounted partition fine as my normal user and xmms2 (another daemon/client music player) can access all the media files without a problem. This makes me think that the problem is mpd and not my set up... Any idea? **UPDATE** : After some experimenting, here more puzzling data:               ; ls -ld /media/MediaVault/MP3z/Soundtracks__Games/portal_still_alive.mp3      5.4M -rw-rw-rw-. 2 root root 5.4M Nov 14  2007 /media/MediaVault/MP3z/Soundtracks__Games/portal_still_alive.mp3     ; mpc add /media/MediaVault/MP3z/Soundtracks__Games/portal_still_alive.mp3     error adding /media/MediaVault/MP3z/Soundtracks__Games/portal_still_alive.mp3: directory or file not found     ; grep MediaVault /etc/fstab      13:/dev/sda1    /media/MediaVault       ntfs    auto,user,noatime,noexec,rw,async,fmask=0111 0 0      To me, this does not appear to be a permission problems at the system level. However, mpd _does have a problem_... **FINAL** : _I am afraid I had to get ride of mpd/mpc as it was making my system X11 crash on boot. Yeah, why would it do that? I have no idea, logs are not much help. To be honest, I was just trying it as it seems to be more popular than xmms2. I am sticking with xmms2._


title: What is the difference between 'nobootwait' and 'nofail' in fstab?

text: In this question I asked what how to not make a media failure halt the system boot process. However, I got two suggestions for fstab options   * nobootwait   * nofail What is the difference between the two?


title: How do I solve rcp errors on Solaris?

text: I am using Sun Solaris7 for running my ucam software, and I need to load data from my ucam system to one of my plotters that is also running on Solaris 7. When I load the job I am getting the following error, can anyone suggest me to solve this problem? `.rhosts` file and IP addresses of both systems are correct, and both are communicating perfectly. It shows the error when I am loading the job. ![A screenshot of the error message](http://i.stack.imgur.com/BrJeU.png)


title: How to find 3G signal strength when connection is already established by pppd?

text: I want signal strength information when pppd connection is already running. I am running pppd on embedded Linux environment and 3g modem manufactured Cinterion. I knew commands from which i am able to know signal strength but when my pppd connection is running it will block /dev/ttyUSB and because of that i am not able to find signal strength information. Need further more information please tell me. Thanks in Advance, Ravi Bhuva.


title: Ubunutu software-centre is not working, showing black screen

text: I am trying to open ubuntu software-center but it get paused and after that shows complete black and nothing is happening. Same thing has happened when I try to run from command line. This is the response from it.               $ software-center     2013-10-22 18:41:33,104 - softwarecenter.ui.gtk3.app - INFO - setting up proxy 'None'     2013-10-22 18:41:33,108 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True     2013-10-22 18:41:33,548 - softwarecenter.backend.reviews - WARNING - Could not get usefulness from server, no username in config file     2013-10-22 18:41:33,702 - softwarecenter.ui.gtk3.app - INFO - show_available_packages: search_text is '', app is None.      as for a solutions I tried:   1. trying to remove it               $sudo apt-get purge software-center     $sudo apt-get update        2. once again install it               $sudo apt-get install software-center      but again same thing is happening. Can anybody suggest me something onto this?


title: is there a Webview for debian to see what software, packages, etc. are installed?

text: I am searching for a webview where I have some overview over my system on my debian server. Is there something out there?


title: Security - Giving Apache write access to /var/www/html

text: I am running Worpdress on an CentOS Webserver. Now, to enable wordpress to be able to upload/write files to the default webserver directory               /var/www/html       I had to do the following change on the server as root user:               [user@host ~]$ chown apache /path/to/upload/dir     [user@host ~]$ chmod 755 /path/to/upload/dir      What security implications does this have? I know I can move all my files to say the /home/ directory and point Apache to it, but it is too much effort... Can I keep it like this or it it unsafe to do so?


title: Having multi lines in bash command substitution

text: I have a very long bash command inside a command substitution like following:               $( comaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaand )      I want to know if there is a way to break this command into shorter lines for the sake of readability like following:               $( com         aaaaaaaaaaaaaa        aaaaaaaaaaaaaa        nd )


title: Is there a way to prevent emerge --sync from deleting files from the portage tree?

text: Although `PORTAGE_RSYNC_OPTS`, a `make.conf` option, allows one to change the rsync options but removing `\--delete` from it causes `emerge` to fail. I think with it remarking about missing md5-cache entries or such. I would like to keep the old ebuild files for a bit longer than the upstream portage tree does.


title: strings command printing some extra characters

text: I am trying to capture mysql traffic using tcpdump and converting it to text using `strings` command, but while capturing mysql traffic, I am getting some extra character at the end of each character. I am unable to figure out the reason. e.g.               CREATE TABLE foo1.foo (id INTEGER, name VARCHAR(20))H>      As you can see, there is `H>` at the end of query. Can someone help me in solving this. **Edit:** I am running the following command to capture the traffic.               $ sudo tcpdump -i any -s 0 -l -w - dst port 3306 | stdbuf -i0 -o0 -e0 strings -12


title: Mapping menu key to alt using setxbdmap

text: On an Asus X551M running Xubuntu 14.04, I would like to set the following keyboard configuration: **The pair of modifier keys immediately adjacent to the spacebar are mapped to control. The next closest pair are mapped to` Alt`.** That is, the bottom row of my keyboard looks like this:               [ctrl] [fn] [win] [alt] [    space    ] [alt] [menu] [ctrl]      whereas I want it to behave logically like this:               [ctrl] [fn] [alt] [ctrl] [    space    ] [ctrl] [alt] [ctrl]      (I never use the outermost pair of `Ctrl` keys, so their mapping is arbitrary.) In the past I've done this by manually editing my `xmodmap` file, which never Just Works on the first try. Further, `xmodmap` locks up when loading config files, which is apparently a known issue. Everything I've read on the subject suggests that `xmodmap` is deprecated and I should use `setxbdmap` instead. So I first tried:               setxbdmap -option altwin:ctrl_alt_win      which works almost perfectly. Now my keyboard is logically:               [ctrl] [fn] [alt] [ctrl] [    space    ] [ctrl] [menu] [ctrl]      i.e. I just need to map the `Menu` key to `Alt`. Is there a way to do this using `setxbdmap`? I next looked through `/usr/share/X11/xbd/rules/evdev.lst` until I found the line:               altwin:menu     Add the standard behavior to Menu key      and tried that, but it seems to have made no difference. There is an option:               ctrl:menu_rctrl   Menu as Right Ctrl      which is almost what I want except, naturally, that it maps `Menu` to `Ctrl` instead of `Alt`. So, is there any way to do this with `setxbdmap`?


title: Why/how does "uptime" show CPU load >1?

text: I have a **1 core CPU** installed on my PC. Sometimes, `uptime` shows load >1. How is this possible and what does this mean? EDIT: The values go up to `2.4`


title: How to perform a sed in-place substitution that only creates backups of files that were changed?

text: I ran the following to replace a term used in all files in the current working directory:               $ find . -type f -print0 | xargs -0 sed -i'.bup' -e's/Ms. Johnson/Mrs. Melbin/g'      This performed the word substitution but it also created `.bup` files of files that never had the `Ms. Johnson` string. How do I perform the substitution without creating all these unnecessary backups?


title: How can I update the OUI list used for Netdiscover?

text: Netdiscover keeps showing a lot of "Unknown vendor" devices, when I generally can find the vendor pretty quickly via Google. Is there any way to manually update whatever OUI list Netdiscover uses?


title: Is there a way to check a users SSH key to see if the passphrase is blank

text: I'm looking to lock down our Solaris 10, RHEL 5, and SLES 11.2 servers. It has come to my attention that some of the users have no passphrase for their SSH keys. Is there a way I can check for this with a script? ## Update Below I have posted the script I wrote from the answer @tylerl gave me. I'm posting this incase someone else needs this info in the future. There is most likely better ways to do this, but this works. I still need to write additional scripts for the accounts that are not automounted. Thanks everyone for all the help               #!/bin/bash     # This script is for checking for a blank passphrase. Meaning no passphrase to secure your SSH key.     # Script most be run as root.     # Example: sudo ./check-sshkeys          mount share:/vol/home /mnt     ls /mnt >/tmp/ls     for s in `cat /tmp/ls`     do echo -e "\e[1m User $s \033[0m "          if ls /mnt/$s/.ssh/id_rsa 2>/dev/null             then grep ENCRYPTED /mnt/$s/.ssh/id_rsa || echo -e "No RSA     passphrase"             else echo "RSA key not found"     fi     if ls /mnt/$s/.ssh/id_dsa 2>/dev/null             then grep ENCRYPTED /mnt/$s/.ssh/id_dsa || echo -e "No DSA     passphrase"             else echo "DSA key not found"     fi     done     rm /tmp/ls     umount /mnt


title: Keypad plus and minus names in ~/.XCompose

text: I use XIM under Debian Linux with Gnome 2. Many compose sequences are already defined in the system, including the one for `±` sign:               palec@Palec:~$ grep PLUS-MINUS /usr/share/X11/locale/en_US.UTF-8/Compose     <Multi_key> <plus> <minus>          : "±"   plusminus # PLUS-MINUS SIGN      This does not work with numpad of my Lenovo G550’s keyboard. I noticed that numbers on numpad require `KP_` prefix to be matched, so I tried adding copy of the original rule with keys changed to `KP_plus` and `KP_minus` to my `~/.XCompose`, where I already have other rules I use in addition to those from the system `Compose` file. No luck though. I did not manage to find any useful doc for XIM nor `~/.XCompose`. Is there any? Most of information on XIM and compose sequences I got from forums I found by googling. How to get the name of a key for use in `~/.XCompose`? Particularly, what are they for numpad `+` and `-`? I do not insist on XIM, but I want to be able to configure custom compose sequences. If there is another, preferably better documented solution, I’d like to hear about it.


title: CPU and RAM monitorization by parent id

text: I'm trying to monitor the CPU and RAM usage (in % of total for example) of a given process wich may spawn several processes. The parent process is `/bin/rscw` so I get its pid by `ppid_bl=$(ps -ef | grep [b]in/rscw | awk '{print $2}')` and then I try something like `ps -ppid $ppid_bl S` **(1)** because in `man ps` it appears `-ppid Select by parent process ID. This selects the processes with a parent process ID in pidlist. That is, it selects processes that are children of those listed in pidlist.` `Output format S Sum up some information, such as CPU usage, from dead child processes into their parent. This is useful for examining a system where a parent process repeatedly forks off short-lived children to do work.` My question is, is my approach right? I'm getting `ps` error with **(1)** , and this it's because I'm not using the right `ps` syntax, but maybe I'm not doing things right even with a correct syntax. Thanks for your time.


title: Different behaviour of systemctl suspend when executed via i3 wm key binding

text: I am using the i3 tiling windows manager in combination with light-locker to lock the screen. Light-locker displays a lock message on the locked TTY and shows the password screen on a second TTY. When closing the notebook lid or executing `systemctl suspend` from a terminal emulator, the lock messages appears for a short time, then the system goes into S3 state. On resume, the lock message is visible for a short time again, then light-locker switches to the password entry-TTY, which is the desired behaviour. The problem occurs when I bind the systemctl command to a specific key via the i3 config file like this:               bindsym s exec --no-startup-id systemctl suspend, mode "default"      When pressing $mod + s, the screen turns black immediately, not showing the lock message. On resume, the screen turns on, displaying the unlocked desktop for a half second, then the lock messages flashes for the fraction of a second and then the password entry-TTY is shown. This behaviour is not acceptable, as it exposes the desktop after suspending the computer, even the desktop is only visible for a short time. My guess is, that when using bash to execute `systemctl suspend`, the command takes longer time or sth. like that, making it possible for light-locker to switch to the lock message before the system suspends. How can I avoid or circumvent the different behaviour of the key binding?


title: Create a service that logs all input

text: I need to create a service that logs all input on a certain port to a file. Do I have to create a custom program for this, or is there an existing tool out there that can help me with this?


title: Howto copy and text from termial to (GTK-)emacs?

text: If I select text in my terminal (in my case `urxvt`) and then click with the middle mouse button into an emacs window (GTK), it pastes the selected text from terminal. Since I don't want this behaviour for the middle mouse button I usually add this to my `.emacs` file:               (define-key global-map [mouse-2] nil)      However then I am not able to paste text from a terminal at all. So how can I fix this (for example that a selection from a terminal is inserted by `C-y`)? This worked in my old box but since upgrading to ubuntu 13.10 and emacs24 it doesn't. So it must be possible, but I don't know how to.


title: Search/grep ftp remote filenames

text: I have already seen How to perform GREP on FTP? - that question implies that a `grep` in the remote file contents is needed; and as such, the answer is that the `ftp` protocol does not support that (download of all remote files locally is needed, before a search in their contents can be initiated). I'm looking for something a bit more "simple" - I'd just like to grep/search for remote filenames; I'd imagine this requires that the remote directory tree is somehow downloaded. How could I do this through the command line?


title: Unable to install handbrake on Ubuntu 13.10 via PPA

text: I'm trying to install `handbrake` on my system Ubuntu 13.10 via PPA but not able to do so. I followed this website. I ran the below commands:               $ sudo add-apt-repository ppa:stebbins/handbrake-releases     $ sudo apt-get update      Then when I ran `sudo apt-get install handbrake`, I got the error as below.               ravi@ravi-Aspire-5315:~$ sudo apt-get install handbrake     Reading package lists... Done     Building dependency tree            Reading state information... Done     E: Unable to locate package handbrake      The same error of "unable to locate package handbrake" I got when I used a different PPA got by googling. What's the issue here!!


title: Read/write access on raw NTFS image

text: I backed up an entire 32GB NTFS partition to a raw image with with `dd`. The file-system on the partition in accessible under Debian after mounting with:               $ sudo mount -o ro,loop /media/Path/To/ImageFile.img /tmp/IMAGE/      After remounting this image, without specifying `ro`, can the NTFS file-system safely be modified (such as editing files, copying new files, deleting files, etc.)? I know GNU/Linux can read/write NTFS file-systems -- my question is whether the NTFS file-system in the image can safely be modified after mounting the image as read/write.


title: Rsync except .svn folders and their sub-contents?

text: Dealing with a subversion repo and a new user that didn't quite understand how it worked. Long story short, since their local structure was messed up due to copying random .svn folders about, I did the following:   * copied the local structure to a folder called staging    * recursively deleted all .svn folders from the staging directory   * checked out the repo to a "clean folder" Now we're at the last step — getting the staging folder contents to overwrite the clean contents. I need to have a command copy the contents of the staging directory to the clean directory, removing everything that is only in the clean directory, BUT leaving the clean folder's .svn folders in tact. This sounds like a job for rsync. Would the following command be correct?               rsync -avr --exclude=.svn* [staging] [clean]


title: How to delete older files in a folder in unix?

text: Can anyone help me find the meaning of the below statement? I am new to Unix programming.               find /sourcedirectory -mtime +2 -exec mv "{}" /destination/directory/ \;


title: Leafpad ignoring gtkrc

text: On a fresh install of Debian Wheezy, I have Leafpad 0.8.18.1-3. Following instructions I created a .gtkrc-2.0 in my home folder and put the commands to change the text area colors. This had no effect. The problem has been noted before, but didn't get an answer. I did find mention of someone having it work several years ago.


title: Connecting Debian webserver to network

text: I am currently running a webserver with Debian 5.0.2. It has been working (more or less) fine for the past 2-3 years but recently it went down due to some power-outage. Ever since I have brought it back online it has been unable to connect to the network. I have disabled and re-enabled the ethernet port but still can't connect. Here is the following information when running `ifconfig eth0`:               Link encap: Ethernet  HWaddr:00:02:a5:95:e6:21      inet6 addr:fe80::202:a5ff:fe95:e621/64 scope:Link      UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1      RX packets:255593 errors:0 droped:0 overruns:0 frame:0      TX packets: 15 errors:0 droped:0 overruns:0 carrier:0      collisions:0 txqueuelen:1000     RX bytes:21904751 (20.8MiB)  TX bytes:5821  (5.6KiB)      As well, in the `etc/network/interfaces` file I do have the line:               iface eth0 inet dhcp I am afraid I am stumped as to why it will not connect. I understand that there is still a value missing for the inet address, but it should be getting this from the network (and before anyone asks; everything is fine with the network, it is a university wide network) yet it cannot connect to it... The Ethernet port and cable are also functioning correctly.


title: I want a script which will take multiple column numbers from a user and reverse the contents

text: I want a Unix script which will take multiple column numbers from the user and reverse the contents.               declare -a param="$@"     # enter 0 when exit the insert element     echo "Enter the numbers"     read n     while [ $n -ne 0 ]     do         x[$i]=`expr $n`         read n         let i++     done          #display the all array elements     echo "Array values ${x[@]}"     echo "Array values ${x[*]}"          # To find the array length     length=${#x[*]}     echo $length


title: how to make less -S not take up the entire screen

text: suppose I have this: `cat new_file.txt | less -FRSX` Then suppose I press the right button in order to scroll to the right This will cause the contents of new_file.txt to move to the top of the command line and moreover there's a whole bunch of empty space between content of new_file.txt and the current command For instance here's what it'll look like               contentsofnewfile.txtyupmorecontenntsconteeentsss     ~     ~     ~     ~     ~     ~     ~     ~     .     .     .     ~     (END)      how do I make it so that even if I press the right button, the content of the file stays where it is instead of moving to the top (though it should still scroll to the right) and moreover that there will be no empty lines such as the               ~     ~     ~      displayed above


title: Select a range of files from directory structure /year/month/date.db

text: I have databases stored in the directory structure > year/month/date.db an example would be > db/2013/10/15.db I need to be able to select a range of these with a script ("dbSelect 2013/09/01.db 2013/10/15.db" should output all .db files between those dates. Any ideas as to how I could go about this?


title: lsof - debug the output information

text: I was going through the questions of this site. In this particular question, I see the command lsof being used to list the files that are open for a particular user. I ran the below command in my terminal.               lsof -a -u root -d txt      I am seeing a long output which are completely irrelevant (at least to me). I am finding it hard to understand the output produced. This is               mapping-d  3992 root txt       REG    8,5    29728 7169187 /usr/libexec/mapping-daemon     clock-app  4005 root txt       REG    8,5    88048 7169216 /usr/libexec/clock-applet     mixer_app  4007 root txt       REG    8,5    53484 7169197 /usr/libexec/mixer_applet2     gnome-scr  4078 root txt       REG    8,5   168628 1337742 /usr/bin/gnome-screensaver     notificat  4081 root txt       REG    8,5    34732 1324168 /usr/libexec/notification-daemon     gnome-ter  4219 root txt       REG    8,5   309400 1318348 /usr/bin/gnome-terminal     gnome-pty  4221 root txt       REG    8,5    12384 1899888 /usr/lib/vte/gnome-pty-helper     bash       4222 root txt       REG    8,5   735932  196459 /bin/bash     firefox   15551 root txt       REG    8,5   121288 2424613 /usr/lib/firefox/firefox     npviewer. 15790 root txt       REG    8,5   174364 1996912 /usr/lib/nspluginwrapper/npviewer.bin     bash      15908 root txt       REG    8,5   735932  196459 /bin/bash     lsof      16014 root txt       REG    8,5   129820 1323233 /usr/sbin/lsof     lsof      16015 root txt       REG    8,5   129820 1323233 /usr/sbin/lsof      I was expecting, if I had opened a _txt_ file as the _root_ user, only that file's information would be displayed, if I run the **lsof** command. Can someone please help me in understanding what this command actually produces as the output?


title: Separating OS on a SSD from user settings and apps on HDD

text: I want to be able to format my OS SDD and format and reinstall without losing any user data, is this possible? I'm currently doing this on Windows 7 and 8 with the help of portable apps and some hacks. Drivers are downloaded automatically on Windows so I don't know how to translate this on Linux. For example, my Firefox and Thunderbird profiles are pointed to my second drive so I just update the path and I'm done. What would be the best approach? I'm very confused about where things are installed, after reading a few articles apparently it's all over the filesystem (from `/opt` to `/usr`) so there's no easy way to do this? And of course I'm moving the `/home` folder to the other disk.


title: Is autofs the only open-source choice for mounting nfs and/or cifs

text: I've been using autofs for a number of years and was wondering if there is an alternative to autofs that would handle cifs/smb shares in a more interactive way? When I say more interactive I'm mostly referring to allowing interactivity for password authentication (and not keeping your password in a file)?


title: Further clarification as to whether interuppts are disabled in top-half handler or not

text: Recently I came across a note in an online post that states the following: > In modern kernels, most of the differences between fast and slow interrupts > have disappeared. There remains only one: fast interrupts (those that were > requested with the `SA_INTERRUPT` flag) are executed with all other > interrupts disabled on the current processor. Note that other processors can > still handle interrupts, although you will never see two processors handling > the same IRQ at the same time. In other online documentation I've found statements that suggest that while handling any given interrupt, at least in the top-half handler, all other interrupts are disabled. This seems at odds with the quotation above. I'm most interested in the context of single CPU arm systems. Can someone enlighten me as to which of these views is correct? Likewise, help in understanding the difference between "masking" and "disabling" interrupts in linux would be helpful. From my research it seems that masking is done in the interrupt controller (PIC) whereas disabling can be done by the CPU. Further adding to my confusion is the fact that the linux functions `disable_irq()`, `disable_irq_nosync()` and `enable_irq()` seem to be related to masking rather than "disabling". Is this correct? Finally, I've found comments online stating that masking can NOT be done within a top-half interrupt handler (which makes some sense to me). However, if this is the case, wouldn't it imply that the above-referenced function calls are not suitable for use in top-half handlers?


title: Giving www-data permision to Dropbox subfolder?

text: I want to give my website the permission to read files & folders from a Dropbox subfolder. I _think_ I have added the correct permissions, but I can't get the `www-data` user to get access to the folders.               $ cd /home/edent/Dropbox     $ ls -la     total 9944     drwxrwxr-x    6 edent edent       4096 Aug 14  2012 .     drwx------   67 edent edent      20480 Feb 27 09:11 ..     drwxrwxr-x+ 772 edent www-data  118784 Jan 29 20:45 Foo     drwxrwxr-x    4 edent edent       4096 Aug 14  2012 Bar      All the sub-folders and files of `Foo` are also `drwxrwxr-x+ edent www-data` So, I switch to the user `www-data` but it doesn't have permission to access those files and folders!               $ sudo su www-data     $ groups     www-data     $ id     uid=33(www-data) gid=33(www-data) groups=33(www-data)     $ cd /home/edent/Dropbox/Foo     sh: 3: cd: can't cd to /home/edent/Dropbox/Foo      However, if I **start** in `/home/edent/Dropbox/Foo` I can access files but _not_ directories.               $ cd ~/Dropbox/Foo/     $ sudo su www-data     $ ls     (file listing)     $ tail example.txt     (file displayed)     $ cd Bar/     sh: 4: cd: can't cd to Bar      What am I doing wrong? All I want is for Apache to access a limited set of folders - I don't want to open up my entire filesystem.


title: File monitoring to pre-empt hacker

text: We have a hacker occasionally attempting to hack a site, and so far unsuccessful, but I would like a way to determine if the site has been compromised (i.e., files edited). The type of attacks are LFI and attempting to inject iFrames in some source files. What can I install on my Debian server to alert me via an e-mail if certain files or directories are modified?


title: Installing crontab using bash script

text: I have created a script to install two scripts on to the crontab.               #!/bin/bash           sudo crontab -l > mycron      #echo new cron into cron file           echo "*/05 * * * * bash /mnt/md0/capture/delete_old_pcap.sh" >> mycron #schedule the delete script      echo "*/12 * * * * bash  /mnt/md0/capture/merge_pcap.sh" >> mycron     #schedule the merge script          #install new cron file      crontab mycron     rm mycron      The script runs, and add the two lines to the crontab. But if I run the script again, it adds those lines again , thus I will have four lines saying the same stuff. I want the install script to run such that, the lines inserted to the crontab do not repeat. How can I do that


title: How to replace current word under cursor in Emacs

text: How do I replace current word under cursor in Emacs? I know that I can use query-replace or replace-string but every time I do so I have to type entire string to be replaced, this is just annoying. Vi has equivalent command cword and I can use a shortcut to pull the word under cursor for replacement:               nmap <leader>z :%s#\<<C-r>=expand("<cword>")<CR>\>#      Anybody know how to do it with Emacs?


title: Set tab indent in Emacs

text: I have a very simple thing I want to do in Emacs. I want to set it so that when I press the TAB key, it inserts two spaces. Just this. It's all I ask. I have tried doing this for a couple of years now, and there's just no way to do it. In every file type it blows up in a different way. HTML file? Random choice between getting four spaces or tabbing to previous line indent. Python file? Just four spaces and I'll ignore any setting you have. It also randomly seems to stop working depending on the phase of the moon when it was previously working. In my .emacs:               (setq indent-tabs-mode nil)     (setq tab-width 2)      This should work, right? No. No it doesn't. It seems emacs has a magical fairy "file mode" for each extension that completely overrides what I tell it. So do I have to find this magical fairy configuration and override it for each file type? What can I do to get this simple thing to work. Halp.


title: Completely Backing Up Linux Installation

text: I come from Windows, and I've been getting into Linux a little bit lately. Trying to make that my default OS for now. I've wanted to try out a couple different flavors of Linux. I spent probably a week getting Ubuntu to fully work correctly with drivers and all that and that is what I'm running right now. What I want to do is wipe out my Ubuntu installation and try some Fedora 15. I also come from the Android world where you boot into recovery, do a complete backup of everything, wipe it and flash something else and play around with it, and if you don't like it you restore your backup from before. Is there anything similar? So just in case I don't stick with Fedora I can reload my Ubuntu and not have to spend another week setting it up.


title: Debugging Java program for changing timezone configuration file on Ubuntu

text: Here is a ruby script I wrote to change the timezone configuration on Ubuntu. I run it with **jruby** (a Ruby interpreter running in a JVM).               require 'java'          if ARGV.length == 0       puts "Usage: jruby change_timezone.rb America/Toronto"       exit     end          old_zone = File.read("../../../etc/timezone")     puts old_zone     time1 = Time.now     puts "Current Time:"+time1.localtime.to_s          new_zone = ARGV[0]     open('../../../etc/timezone','w') do |f|       f.puts new_zone.to_s       f.close     end          new_zone = File.read("../../../etc/timezone")     puts new_zone     time2 = Time.now     puts "Updated Time:"+time2.localtime.to_s      It does change the configuration file properly. However, the output for the script is not as expected. Assume the default value for the timezone is `America/Toronto`. When I run the command `jruby change_timezone.rb Asia/Chongqing`, the output is:               America/Toronto     Current Time:Thu Jul 07 14:43:23 -0400 2011     Asia/Chongqing     Updated Time:Thu Jul 07 14:43:23 -0400 2011 (My Note: +0800 expected!!!)      Continuing with the command `jruby change_timezone.rb Europe/Amsterdam`, I end up with the following:               Asia/Chongqing     Current Time:Fri Jul 08 03:18:25 +0800 2011 (My Note: it actually got updated from last run!!!)     Europe/Amsterdam     Updated Time:Fri Jul 08 03:18:25 +0800 2011 (My Note: +0200 expected!!!)      Going further with `jruby change_timezone.rb Europe/Amsterdam` again, I get the following:               Europe/Amsterdam     Current Time:Thu Jul 07 21:21:27 +0200 2011     Europe/Amsterdam     Updated Time:Thu Jul 07 21:21:27 +0200 2011      Can someone figure out why it didn't work as expected?


title: Problem with $PATH and executable file

text: I am a complete unix noob so please forgive my simple question. I have a unix executable file located in a directory I generated. I believe I need to get this directory in my `$PATH` so that the unix executable is executable, but the documentation for the source code says that I need to edit my shell configuration file to add `$home/meme/bin` to my shell's path. Could anyone provide any help for me with this problem?


title: is there a way to set coloring for cd tab complete?

text: I use ubuntu 11.04. Is there a way to set coloring for output after tab completion listing of a cd, ls, or etc. ? i.e. `myshell@root$ cd ~/user/files/` I hit tab... _myfile_ myfoo mybar <-- this output is colored? I hope you enjoyed my diagram.


title: How can I configure mutt to display my replies within threads?

text: While mutt has `set sort = threads` to show threaded, "conversation" style messages, it doesn't display one's own replies in the threads. Instead, you have to change to the Sent folder to see your own messages. Is there any way to display one's own replies where they belong inside threads? Edit: I found `notmuch-mutt` has some of the behavior I'm looking for. It defines a macro that looks at message-ids and can create a virtual folder to show an entire threaded conversation regardless of where each message lives. Out of the box it only works on search results. I'll have to do some more digging to figure out how it works and see if the same behavior can't be applied to regular mailboxes.


title: SED: insert something to the last line?

text: The command inserts a tag to the beginning of a file:               sed -i "1s/^/<?php /" file      How can I insert something to the end of each file with SED?


title: Unable to get Wireless working during Arch Linux install

text: I'm following the Arch Linux install guide here: https://wiki.archlinux.org/index.php/Beginners%27_Guide I'm installing from a live disc. I've just used pacstrap to install the base system. I then used chroot to configure the system (time zones, language, etc.) My wireless has been working fine up to this point but only on the live disc and through `wifi-menu`. From my understanding I now need to get Wi-Fi working on the actual system. I'm choosing to do this manually with `netctl`. I enter the netctl directory and notice that there is a profile already created there for me. I'm guessing this is because wifi-menu automatically created it for me. So I run:               netctl enable wlp2s0-linksys      I receive the error message `running in chroot, ignoring request` A ping to Google shows that I am still not connected. How can I set this netctl profile to be used on boot when I'm running off of the hdd from the actual installation and not the disc?


title: High ping/latency on Xen box

text: **I am having problems with my Xen box.** Once in a while it has too high ping/latency and it is very annoying. It does not matter if I am pinging server from outer network (LAN0) or inner network (LAN1), high ping is for both of lines. Hopefully someone can help me. P.S. Without Xen everything is running smoothly. P.P.S. I had the same problem with another box running Xen, but somehow the problem disappeared. About configuration:                    LAN0                LAN1           |                   |     +-----+-------------------+--+     |     |                   |  |     | +---+---------------+   |  |     | |   |               |   |  |     | | eth0    xenbr0    | eth1 |     | |                   |   |  |     | |    vif1.0         |   |  |     | |      |            |   |  |     | +------+------------+   |  |     |        |                |  |     | +------+----------+     |  |     | |      |          |     |  |     | |     eth0        |     |  |     | |      |          |     |  |     | |  +-+-+---+---+  |     |  |     | |  |   |   |   |  |     |  |      | | www ssh ftp pop |    ssh |     | |                 |        |     | |     Domain1     | Domain0|     +-+-----------------+--------+      Sometimes there are many packets with high ping in a row. ![ping](http://i.stack.imgur.com/Ul8tu.png) Sometimes there is only one high ping packet in a minute or so. ![ping2](http://i.stack.imgur.com/ADgdl.png) xm info               host                   : server     release                : 3.5.0-23-generic     version                : #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013     machine                : x86_64     nr_cpus                : 8     nr_nodes               : 1     cores_per_socket       : 4     threads_per_core       : 1     cpu_mhz                : 2992     hw_caps                : bfebfbff:20100800:00000000:00000940:000ce3bd:00000000:00000001:00000000     virt_caps              :     total_memory           : 32761     free_memory            : 662     free_cpus              : 0     xen_major              : 4     xen_minor              : 1     xen_extra              : .2     xen_caps               : xen-3.0-x86_64 xen-3.0-x86_32p     xen_scheduler          : credit     xen_pagesize           : 4096     platform_params        : virt_start=0xffff800000000000     xen_changeset          : unavailable     xen_commandline        : placeholder dom0_mem=1024M     cc_compiler            : gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)     cc_compile_by          : stefan.bader     cc_compile_domain      : canonical.com     cc_compile_date        : Tue Jun 25 13:22:36 UTC 2013     xend_config_format     : 4


title: Prevent closing of plasma-desktop in Awesome WM

text: I run KDE with Awesome WM. Sometimes, I have no window (client) open and press `Mod4`+`C` to close a window, but `plasma-desktop` is selected. So it kills `plasma-desktop` which makes my background image and other background things. Is there some way to prevent this for the given window class? Something I can put into the `rules` section of the `rc.lua`?


title: CUPS: problem with color printing

text: I have two Debian machines, one has `CUPS` set up and I can print on my color printer, everything works fine. The other machine is new. I want to set up `CUPS` exactly same as on the first machine. I have simply copied the whole directory `/etc/cups/` from the first machine to the second, including the `.ppd` file for the color printer. However, when I print from the second machine on the color printer, it only prints black/white, instead of color. From the first machine, I can print color fine. But all the settings are the same (`.ppd` file is the same) Is it possible I need to install some additional package, to be able to print color ? This is my `/etc/cups/printers.conf`:               <DefaultPrinter XE_WC7346>     AuthInfoRequired none     Info Xerox WorkCentre 7346     Location C45     DeviceURI ipp://192.198.1.23/printers/XE_WC7346     State Idle     StateTime 1382368451     Reason media-low-report     Reason toner-low-report     Type 0     Accepting Yes     Shared No     JobSheets none none     QuotaPeriod 0     PageLimit 0     KLimit 0     OpPolicy default     ErrorPolicy stop-printer     </Printer>


title: How to get pass a localisation issue when setting up a maven project?

text: I'm trying to install ovirt on my mint laptop. Installing oVirt on a debian distribution is expirimental and there is little knowledge about troubleshooting on the web. However, I have found the source of my issue, I'm just not sure how to fix it. The output of the failed maven test is as follows:                   -------------------------------------------------------------------------------     Test set: org.ovirt.engine.core.branding.BrandingManagerTest     -------------------------------------------------------------------------------     Tests run: 11, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.249 sec <<< FAILURE!     testGetMessageDefaultLocale(org.ovirt.engine.core.branding.BrandingManagerTest)  Time elapsed: 0.016 sec  <<< FAILURE!     org.junit.ComparisonFailure: The result should be 'Main header' expected:<Main header[]> but was:<Main header[(fr)]>             at org.junit.Assert.assertEquals(Assert.java:115)             at org.ovirt.engine.core.branding.BrandingManagerTest.testGetMessageDefaultLocale(BrandingManagerTest.java:81)             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)             at java.lang.reflect.Method.invoke(Method.java:606)             at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)             at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)             at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)             at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)             at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)             at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)             at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)             at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)             at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)             at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)             at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)             at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)             at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)             at org.junit.runners.ParentRunner.run(ParentRunner.java:309)             at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)             at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)             at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)             at java.lang.reflect.Method.invoke(Method.java:606)             at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)             at com.sun.proxy.$Proxy0.invoke(Unknown Source)             at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)             at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)             at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)      notice the 6th row: `The result should be 'Main header' expected:<Main header[]> but was:<Main header[(fr)]>` It seems that the test failed over a string mismatch, probably because my Linux is installed in French. I want to find a way to force the installation to install only in English to avoid this. I have tried addind `BUILD- LOCALES="en"` but that did not fix the issue. Any ideas?


title: Mail character set for norwegian characters

text: When extracting a message from my inbox containing the norwegian letter "ø" I find that it is encoded with 3 bytes as "=F8" or hexadecimal "0x3d4638". In UTF-8 the letter "ø" is encoded with two bytes as "0xc3b8", whereas in ISO-8859-1 it is encoded as one byte with code "0xf8". What kind of encoding is used by my mail server when it saves incoming mail? That is, in which encoding is "ø" equal to "0x3d4638"?


title: I don't see .bashrc in my home directory but want to make a permanent change to my path

text: I am trying to add a location to my $PATH variable on a Mac running OS X. I am following this tutorial, which says to edit the .bashrc file. I don't see this file in the home directory even when I do               cd ~/      ls -A       Can I just go ahead and create that file? Or am I missing something?


title: Disable GUI on BeagleBone Black running Debian

text: The Debian image for the BeagleBone Black that they have on their website comes with a GUI by default. I'd like to completely disable the GUI, but in the simplest way possible. It is used as a headless device and doesn't need those resources sucked up. I've successfully disabled it, but I feel my procedure is breaking things behind the scenes. All I'm doing is:               $ sudo apt-get remove lightdm      In retrospect, perhaps `purge` would be better. Can anyone see holes in the method, or recommend a better method?


title: Mutt: how to safely store password?

text: My .muttrc file looks something like this one or see below a glimpse. I am hesitant with the password. How should I store my password to use it with `mutt`?               set imap_user = "username@gmail.com"     set imap_pass = "password"          set smtp_url = "smtp://username@smtp.gmail.com:587/"     set smtp_pass = "password"     set from = "username@gmail.com"     set realname = "Your Real Name"


title: How to download a file on a webpage that is not a direct link but a javascript click.submit()?

text: Examples are http://developer.amd.com/tools-and-sdks/heterogeneous- computing/amd-accelerated-parallel-processing-app-sdk/downloads/ The files are listed in a table that need javascript to run on `click.submit()`. wget is not working in this case.


title: Access Linux after installing another OS

text: I recently installed Fedora 20 and during the installations, I made a new disk partition where I installed Windows after Fedora. I do not get the alternative of booting Fedora now. How would I go about booting Fedora?


title: Gnome graphical interface failed to load

text: I have Debian Linux with Gnome on my laptop. My laptop dropped from a chair (It was off at that moment). I turned it on. It loads to text mode directly. I log in and run `startx`. It runs and mouse cursor comes on the screen. But display stays black and nothing happens. What should I do?


title: Change confirm-box default positions

text: I would like to change default position of confirm boxes. For example: When I clicking on Shutdown button, the confirm box position is located on `Top-Left` by default. How do I change default position ? **Shot :** I'm Using Arch + XFCE ![enter image description here](http://i.stack.imgur.com/yGD9F.jpg)


title: Kali linux dual boot with win 8 64 bit is not working

text: I have Windows 8 64-bit installed on my Lenovo Ideapad. I tried to install Kali Linux to dual boot with Windows by downloading Kali Linux 1.0.5 32-Bit ISO and then burning it into my USB stick using LinuxLive USB Creator 2.8.27. But when I tried to run the USB stick, it throws an error `You are running 32 bit version of image into 64 bit` which is completely correct. After this, I downloaded Kali Linux 1.0.5 64-Bit and followed the same procedure but this time I am getting this error: ![enter image description here](http://i.stack.imgur.com/ADKEh.png) Is it possible to install Kali Linux to dual boot with Windows 8 64-bit? If yes, then which version of Kali Linux is supported?


title: Interpret the output of lstopo

text: I have a output from `lstopo --output-format txt -v --no-io > lstopo.txt` for a 8-core node in a cluster, which is https://dl.dropboxusercontent.com/u/13029929/lstopo.txt   1. The file is a text drawing of the node. It is too wide for both the terminal and gedit on Ubuntu of my laptop, and some of its right is moved by my laptop to the left and overlap the left part of the drawing. I wonder how I can view the file properly? ( Added: I realize that I can view the drawing properly by uploading to dropbox and opening in Firefox, which zoom out the drawing properly. But open the local file in Firefox will mis-display the dash lines "-", and I wonder why? Other than Firefox, any software can also work on it?)   2. what does "PU P#" mean in each core "Core P#"? Why are their numbers not the same?   3. Does "L1i" mean a L1 instruction cache, and "L1d" a L1 data cache?   4. Why do L2 and L3 caches not have distinction between instruction cache and data cache? Is this common for computers?   5. What does "Socket P#" mean? Is the "socket" used for connection between the L3 caches and the main memory?   6. What does "NUMANode P# (16GB)" mean? Is it a main memory chip?    7. Does the drawing show that there are four cores sharing a main memory chip , and the other four cores sharing another main memory chip?    8. Is there not a main memory shared by all the 8 cores in the node? So is the node just like a distributed system with two 4-core computers without shared memory between them? How can the two 4-core groups communicate with each other?   9. Does "Machine (32GB)" mean the sum of the sizes of the two main memory chips mentioned in 6?


title: LVM RAID 1 for root

text: I have LVM RAID 1 (not mdadm RAID 1, but exactly LVM2 RAID 1) for my root partition. I would like to make my system boot without either of the HDDs where the underlying PVs of the root LVM partition reside. The kernel launch line in grub.cfg (automatically generated by GRUB2) looks like:               linux   /kernel-genkernel-x86-3.11.7-hardened-r1-3 root=/dev/mapper/vg-root ro dolvm      It looks perfectly with both disks enabled and the system is HDD fault- tolerant runtime, i.e. it works properly if either of HDDs are down during runtime. However, if I try to boot without one of HDDs, I am getting               Refusing activation of partial LV root. Use --partial to override.      during boot and kernel panic. From one side it seems reasonable since it's not a normal behavior for lvm to launch when one of PV is absent. However, it's absolutely necessary in order to boot server. The potential workaround I can think of is adding some additional option to kernel launch line. Do you know how to make the LVM RAID 1 work for root partition when on of HDDs does not work?