Search This Blog

Tuesday, July 9, 2013

How to Add a PPA to Ubuntu

How to Add a PPA to Ubuntu | OMG! Ubuntu!
Gitolite on Ubuntu: No admin key given

This adds the extra steps to bring in a ppa, install a new package, and reconfigure something like Gitolite3.

Replace ppa:snapy/ppa with your launchpad.
Replace gitolite3 with your package.

First, find a package you  want. I generally check to see if it's in the next release; easier to upgrade later.
https://launchpad.net/~snapy/+archive/ppa

From a terminal window:

    sudo add-apt-repository ppa:snapy/ppa
    sudo apt-get update
    sudo apt-cache gencaches
    apt-cache search gitolite3
    sudo apt-get install gitolite3

Then, after setup is finished, you can run the command sudo dpkg-reconfigure gitolite and it will prompt you to provide:
  1. The user which gitolite will use
  2. The directory which that user use to store all its files (gitolite config, gitolite managed repositories, etc)
  3. (And the most important) the public key of the user whom will be the first administrator in gitolite, which you may either put the public key (just a single line starts with ssh-rsa or path to the file which contains the public key)
   

Thursday, May 2, 2013

HowTo fix yum error: unpacking of archive failed on nfs4 directory.

Bug 210945 – yum update gives error: unpacking of archive failed on file /home: cpio: chown

My Jenkins yum updates on Fedora 18 have been failing for a while. Finally have a fix that works.

My /var/lib/jenkins directory is an NFS4 mount to a local server.
The first error on yum update was chown permissions. This was fixed by no_root_squash on the server.
To duplicate, from root try to do a chown in /var/lib/jenkins.

(fix no-permission problem)
On the local server:
/etc/exports

/srv  *(rw,fsid=0,sync,nohide,crossmnt,insecure,no_subtree_check,no_root_squash)
/srv/jenkins *(rw,sync,nohide,insecure,no_subtree_check,no_root_squash)

The next error on chown/cpio was "invalid argument". There are some older threads about a kernel problem and null characters in uid/gid, another about nfs4 problems etc. The best fix becomes avoiding the problem :)

(fix chown invalid argument problem in yum)
/etc/rpm/macros.jenkins

%_netsharedpath /var/lib/jenkins

At this point rpm will ignore doing chown's and yum is happy.

You might do the second step first to fix the yum problem, but the no_root_squash fix may avoid other problems if that is how you are using your mounted directory.

Some say no_root_squash is a security problem, so either lock down what servers can mount your directory (change * in /etc/exports above), or avoid the problem with netsharedpath.

Monday, December 3, 2012

HowTo: Fix Fedora 17 FTP server on VM

vsftpd saying 500 OOPS: priv_sock_get_cmd (after update?..) (Page 1) / Networking, Server, and Protection / Arch Linux Forums

There is an obscure, non selinux, problem with Fedora vsftpd when running on a VM.

Below is a one line fix that will save you lots of debug time :)

The log file will report various selinux failures, but that is NOT the problem. The ftp sessions will get a few error messages, and be dropped from the server.

It occurs when running Fedora in a VM.

yum -y install vsftpd
vi /etc/vsftpd/vsftpd.conf
# Workaround for 500 OOPS: priv_sock_get_cmd
use_localtime=YES
seccomp_sandbox=NO

Friday, November 9, 2012

HowTo: Volume Control/Icon in Ubuntu 10.04

Volume Control/Icon is gone (Ubuntu 10.04)

The alsa sound driver, and volume control icon don't always work in 10.04.

First, You may have this, or may not, but the Volume Control needs to be running.

Click on System>Preferences>Startup Applications
Click +Add, then input:
Name: Volume Control
Command: gnome-volume-control-applet
Comment: Launch volume control applet

Next, The top bar panel needs the volume and login icon. It's done with something called Indicator.
(Someone else already asked why it's called "indicator" :) )

Right Click on Panel (Top Bar)
Click Indicator Applet
Click Add button

You may need to reboot to take effect.

Wednesday, November 7, 2012

HowTo: Restore an Ubuntu system with a bad kernel, broken network driver, unbootable system.

http://askubuntu.com/questions/28099/how-to-restore-a-system-after-accidentally-removing-all-kernels

When you lose a network driver, or have a bad kernel for some reason, this will get you going.

You are starting a working system, then setting up the essentials to chroot into your broken system. The kernel, drivers and things you need are borrowed from the working system. Then you can reinstall packages, until it's working again.

First boot from a Live Ubuntu DVD/USB. Select Try without installing. Open a terminal, and follow the instructions in the Link. Your mileage may vary, I'll try an example with sda1 boot, and sda2 root filesystem.

 # Mount the root filesystem to /mnt
 mount /dev/sda2 /mnt
 # Check /mnt for a root filesystem (bin var etc ...)
 ls /mnt
 # Mount the boot partition to /mnt/boot
 mount /dev/sda1 /mnt/boot
 # Check /mnt/boot for kernels, if not, figure out where they are.
 ls /mnt/boot
 # Mount the system partitions from the Host OS.
 mount --bind /proc /mnt/proc
 mount --bind /sys /mnt/sys
 mount --bind /dev /mnt/dev
 # Chroot to your linux where everything works now...
 chroot /mnt
 # now you at / in your old linux.
 # set the environment
 mount -t devpts none /dev/pts
 export HOME=/root
 export LC_ALL=C
 # Verify you have a working network
 nslookup google.com
 ping google.com

At this point you can apt-get packages and fix your system.

--- after chroot
# See what kernels you already have.
ls /boot
# See what kernels you might want.

apt-cache search linux-image
# Depending on space in /boot, install an old and new one you might like
# An old generic one in the preempt list might not appear in the regular list
apt-get install linux-image-<2 .6.32-36=".6.32-36">-generic

You can fix about anything wrong with a bad system with this!


Thursday, August 9, 2012

HowTo: Git Branch Merge with Rebasing

Rebasing Merge Commits in Git | Envato Notes

Thousands of files in a git merge...Hundreds of merge conflicts...Someone will commit before you are done...so just assume...


You will have to rebase the merge before you push it to the remote.

The obvious way, git pull --rebase, not so good...you lose your merge and start over.

This describes a Branch Merge, (merging two branches in a single git clone). Android Repo doesn't do multiple branches - I tried to find an easier way...

1) Install one of the git supported merge tools.

If the merge tool is on the path, git mergetool will automatically call it for each of your merge conflicts - very fast.

merge tool candidates: meld opendiff kdiff3 tkdiff xxdiff tortoisemerge gvimdiff diffuse ecmerge p4merge araxis bc3 emerge vimdiff

(I like meld on Linux, it works with cvs, svn, and git.)

2) Branch Merge: Merge all changes from two branches so that they match in content and point in time.

# Clone the repo containing the branches you want to merge.

git clone xxx
# Get the branch_to_merge
git checkout branch_to_merge
# Bring changes from Master to branch_to_merge.
git merge master
# Resolve any conflicts
git mergetool
# Switch back to branch master
git checkout master
# Bring changes from branch_to_merge to master
git merge branch_to_merge
# Resolve conflicts
git mergetool
# See if there are any differences between the merged branches.
git diff branch_to_merge..master
# Done, start testing...

3) Get any changes since you started merging.

# Before push, get any changes.
git checkout master
# Get new commits from the remote.
git fetch
# Move your merge "aHEAD" of the new commits.

git rebase --preserve-merges origin/master
# You may have a set of conflicts to resolve.
git mergetool
# If there are conflicts, you will be on a detached head. Must continue.
git rebase --continue
# Save the commit message when it comes up.
# At the end of rebase you will be back on master branch.

# Next get these changes to the other branch being merged.
git checkout branch_to_merge
# Get any new commits from the remote branch_to_merge.
git fetch
git rebase --preserve-merges origin/branch_to_merge
git mergetool
git rebase --continue # Upon resolving the conflicts, you will see the commit message again.
# Save it, and you are (almost) done.

# If there were commits on the branch_to_merge,
# switch back to master and merge them in (checkout, merge, mergetool).

# You are at a stable point for pushing your merge again...

# Both local branches should match, no differences.
git diff branch_to_merge..master


# Both branches should match in time.
# You should see your final merge first, at the HEAD of the tree.
git checkout master
git log --oneline --graph
git checkout branch_to_merge
git log --oneline --graph

Wednesday, June 13, 2012

HowTo: Fix Gerrit 'Failure to submit due to path conflict'

Failure to submit due to path conflict but no real conflict. - Google Groups
Git Tools - Stashing


While there's a lot of discussion, there's no real howto to fix things up using repo using three simple commands.

Gerrit won't merge when someone is too slow to merge your changes, you've ameded your merge...A change came in before your change was merged...it happens...a lot.


repo start [branchname]
# You've made your changes and sent them to Gerrit...
repo upload

Gerrit merge fails. Here's HowTo fix it.

# Get on your repo start [branchname]
git checkout [branchname]
# Find the name of the remotebranch you are merging to with Gerrit.
git remote
[remotebranch]
# Your local changes need to be stashed for now.
git stash

# Fix your branch so you can merge with Gerrit.
git rebase [remotebranch]/master
# Reapply any local changes
git stash apply
# Amend the commit on your fixed branch.
git add .
git commit --amend
# After upload, you should see a new patch to your merge in Gerrit.
repo upload
# Get rid of stashed changes that have been merged
git stash clear

At this point, you should be able to review and merge in Gerrit, hurry up :)