Search This Blog

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 :)


Thursday, May 24, 2012

HowTo: Build GDB for ARM on Fedora 17

http://www.linuxquestions.org/questions/linux-newbie-8/no-termcap-library-found-when-building-gdb-879757/

Found a need to build a cross gdb, just one more time...It comes with a simulator...


yum install ncurses-devel texinfo gettext flex bison expat-devel sharutils dejagnu glibc-static libunwind-devel valgrind gcc-c++ gcc-gfortran readline-devel rpm-devel python-devel texinfo-tex

# Ada compiler (may not be available in cross compiler)
yum install gnat


Monday, April 9, 2012

HowTo: Ubuntu unknown user in statoverride

Tip : syntax error: unknown user ‘munin’ in statoverride file « OpenWebTech.fr

I installed virt-goodies on Ubuntu 10.04, and then nothing else would install. Even after uninstalling...A user called munin...

While the fix is easy...I could only find it in France, so here we go:

grep 'munin' /var/lib/dpkg/statoverride
#You should have the following lines:
#grep 'munin' / var / lib / dpkg / statoverride
#difference difference 755 / var / lib / difference
#difference difference 755 / var / www / difference
#difference difference 775 / var / lib / difference / plugin-state
#root munin 750 /etc/munin/plugin-conf.d
#munin munin 755 / var / cache / munin / www
#munin adm 750 / var / log / munin
#To solve the problem simply remove them with a little sed:
sed -i '/munin/d' /var/lib/dpkg/statoverride

Tuesday, March 6, 2012

HowTo: Fix Vi Backspace and delete problems

Backspace and delete problems - Vim Tips Wiki

Coming into a Suse system, vi didn't do colors, and the backspace key wasn't working...Here are three obscure things found when logging into lots of different systems.

Add these lines to your ~/.vimrc file.
NOTE: Use the real backspace key for ^?

syntax on
imap ^?


You may also need to fix the backspace key in the terminal. Put something like this in your .profile, .bashrc, whichever works.

stty erase '^H'

Some systems don't add a .profile to your user account. No problem until you log in remotely (i.e. ssh), then you get a warning, can't find your profile, screen doesn't look right...

ln -s ~/.bashrc ~/.profile # In case you don't have a .profile, get one this way.

Friday, March 2, 2012

HowTo: search for files excluding binary files on Linux

search for files excluding binary files - The UNIX and Linux Forums

An old problem with CVS is that you need to identify the binary files as you add them in (cvs add -kb). Otherwise, the next version will do an ASCII merge, trash the previous version, and you won't know until you try to restore an old version. Mostly happens when moving between Linux and Windows. Thanks to zazzybob, this will find ASCII files really well, and save me a bunch of work.

find . -type f -print | xargs file | grep "ASCII\|HTML\|text\|XML" | cut -d: -f1

Finds all binary files (almost) but very close...With the CVS problem, 'cvs add' the known good ASCII files, and any that are missed won't be re-added...

find . -type f -print | xargs file | grep -v "ASCII\|HTML\|text\|XML" | cut -d: -f1

Wednesday, February 22, 2012

HowTo: check if a file exists in a makefile (using makefile conditionals)

How to check if a file exists in a makefile - Stack Overflow

There are so many examples with redundant uses of wildcard
$(findstring ., $(wildcard *.))

Use the "wildcard" function:

$(wildcard *.h) 
EDIT: in order to match a specific list, do
$(wildcard $(HEADER_FILES)) 
There is no need to use $(filter ...), the wildcard function automatically filters files which don't exist.

ifeq ($(wildcard $(HEADER_FILES)), )
# This will stop the make trying to resolve HEADER_FILES for echo :)
echo "ERROR: $(HEADER_FILES)"
else
# File exists, continue or do something else...
endif

Tuesday, January 31, 2012

HowTo: Free IPA on Fedora

InstallAndDeploy - Free IPA

FreeIPA
The above link is mostly correct, but a few changes for Fedora 16 and above.

systemctl disable NetworkManager.service
chkconfig network on
systemctl start network.service

install-ipa-service
# IPA isn't enabled by default (yet)
systemctl enable ipa.service
systemctl restart sshd.service
systemctl start ipa.service
# Set up your local browser with the IPA cert.
firefox http://localhost

# Define this machine as a client to the new server.
ipa-client-install

ipa-ldap-updater --test

Problem: system-config-authentication doesn't work with IPA yet.
Solution: ipa-client-install (Thank you sgallagh)
Watch for this bug 731094 to be resolved as well.
On the root server, ipa-client-install is done as part of ipa-server-install.


Problem: IPA and Dirsrv not started.
/var/log/messages: startup - The default password storage scheme SSHA could not be read or was not found in the file /etc/dirsrv/slapd-PKI-IPA/dse.ldif. It is mandatory.

On a hard shutdown, the dse.ldif files were empty.

[root@montechristo ~]# locate dse.ldif
/etc/dirsrv/slapd-PKI-IPA/dse.ldif
/etc/dirsrv/slapd-PKI-IPA/dse.ldif.bak
/etc/dirsrv/slapd-PKI-IPA/dse.ldif.startOK
/etc/dirsrv/slapd-SOLENGTECH-BIZ-TM/dse.ldif
/etc/dirsrv/slapd-SOLENGTECH-BIZ-TM/dse.ldif.bak
/etc/dirsrv/slapd-SOLENGTECH-BIZ-TM/dse.ldif.startOK
/usr/share/dirsrv/data/template-dse.ldif

Solution: Copy dse.ldif bak files, and restart services.

cp /etc/dirsrv/slapd-PKI-IPA/dse.ldif.bak /etc/dirsrv/slapd-PKI-IPA/dse.ldif
systemctl restart dirsrv@PKI-IPA.service
cp /etc/dirsrv/slapd-SOLENGTECH-BIZ-TM/dse.ldif.bak /etc/dirsrv/slapd-SOLENGTECH-BIZ-TM/dse.ldif
systemctl start dirsrv@SOLENGTECH-BIZ-TM.service
systemctl start ipa.service

Thursday, January 26, 2012

HowTo: Change default OS in Grub2 Fedora

Grub2 - FedoraProject

I'm having trouble with kmod-nvidia keeping up with the kernels. So I need to change the default OS more than I'd like on Fedora 16...

Note, the Grub2 rules for Ubuntu are different than Fedora, and conflict.

Whenever you change the drives or OS you need to generate a new configuration file.

grub2-mkconfig -o /boot/grub2/grub.cfg
  
It will display a list of OS files found, Windows and Linux.
Found linux image: /boot/vmlinuz-3.2.3-2.fc16.x86_64
Found initrd image: /boot/initramfs-3.2.3-2.fc16.x86_64.img
Found linux image: /boot/vmlinuz-3.1.9-1.fc16.x86_64
Found initrd image: /boot/initramfs-3.1.9-1.fc16.x86_64.img
Found Windows NT/2000/XP (loader) on /dev/sdc1
done


To list the found OS's:
grep menuentry /boot/grub2/grub.cfg

menuentry 'Fedora Linux, with Linux 3.2.3-2.fc16.x86_64' --class fedora --class gnu-linux --class gnu --class os {
menuentry 'Fedora Linux, with Linux 3.1.9-1.fc16.x86_64' --class fedora --class gnu-linux --class gnu --class os {
menuentry "Windows NT/2000/XP (loader) (on /dev/sdc1)" --class windows --class os {


To check, by name, the saved entry:
grub2-editenv list
saved_entry=Fedora Linux, with Linux 3.1.9-1.fc16.x86_64


If you have not changed disk drives or partitions, start here
To boot the previous OS (i.e. Linux 3.1.9-1):
grub2-set-default 1
 
To boot the usual OS: (once everything is working again)
grub2-set-default 0
 
 
</pre> with the title of the newly installed Fedora's entry. From that point on you can change the default by calling <pre>grub2-set-default <title or number></pre> or view it by running <pre>grub2-editenv list</pre> <p>To do that, you'll need the list of possible menu entries, which you can find with </p> <pre>grep menuentry /boot/grub2/grub.cfg<br /><br /><br /></pre><br />

Wednesday, January 11, 2012

HowTo: Install GNOME 3 Shell Extensions

Five must have Gnome shell extensions for Fedora 15 « Justin Stories

Earlier, I've blogged on the difficult to install weather extension (Rick Foos HowTo Blog: Gnome Shell Weather Extension ~ Web ...).

So how do you install GNOME 3 Shell Extensions?

First, Remember - Must Reset Desktop when Changing Shell Extensions
Alt-[F2], r

...Ubuntu is mostly the same with apt-get instead of yum...After you install the extensions, exactly the same...

# Install GUI to manage shell extensions.
yum -y install gnome-tweak-tool

# What are the available shell extensions?
yum list gnome-shell-extension-*

A list follows with some possibilities...
Installed Packages
gnome-shell-extension-common.noarch 3.2.3-1.fc16 @updates
gnome-shell-extension-systemMonitor.noarch 3.2.3-1.fc16 @updates
Available Packages
gnome-shell-extension-alternate-tab.noarch 3.2.3-1.fc16 updates
gnome-shell-extension-alternative-status-menu.noarch
3.2.3-1.fc16 updates
gnome-shell-extension-apps-menu.noarch 3.2.3-1.fc16 updates
gnome-shell-extension-auto-move-windows.noarch 3.2.3-1.fc16 updates
gnome-shell-extension-cpu-temperature.noarch 0-0.3.git1f471c7.fc16 updates
gnome-shell-extension-dock.noarch 3.2.3-1.fc16 updates
gnome-shell-extension-drive-menu.noarch 3.2.3-1.fc16 updates
gnome-shell-extension-gpaste.noarch 2.1-1.fc16 updates
gnome-shell-extension-icon-manager.noarch 0-0.4.gitc34779c.fc16 updates
gnome-shell-extension-mediaplayers.noarch 0-0.1.git259f96e.fc16 fedora
gnome-shell-extension-native-window-placement.noarch
3.2.3-1.fc16 updates
gnome-shell-extension-noim.noarch 1.0-1.fc16 fedora
gnome-shell-extension-noripple.noarch 1.0-1.fc16 fedora
gnome-shell-extension-pidgin.x86_64 0-0.5.git80d4ea4b59.fc16
fedora
gnome-shell-extension-places-menu.noarch 3.2.3-1.fc16 updates
gnome-shell-extension-pomodoro.noarch 0-0.2.git13030cd.fc16 fedora
gnome-shell-extension-presentation-mode.noarch 0-0.3.gitbe7e0ae.fc16 updates
gnome-shell-extension-remove-accessibility-icon.noarch
20111008-1.fc16 updates
gnome-shell-extension-remove-bluetooth-icon.noarch
0.2-1.fc16 updates
gnome-shell-extension-remove-volume-icon.noarch 0.3-1.fc16 updates
gnome-shell-extension-righthotcorner.noarch 1.0-1.fc16 fedora
gnome-shell-extension-theme-selector.noarch 0.9-3.fc16 fedora
gnome-shell-extension-user-theme.noarch 3.2.3-1.fc16 updates
gnome-shell-extension-windowsNavigator.noarch 3.2.3-1.fc16 updates
gnome-shell-extension-workspace-indicator.noarch 3.2.3-1.fc16 updates
gnome-shell-extension-workspacesmenu.noarch 0-1.fc16 fedora
gnome-shell-extension-xrandr-indicator.noarch 3.2.3-1.fc16 updates
# If you're not one to mess around, install them all...You can always remove them later...
yum install gnome-shell-extension-*

# Enable/Disable Shell Extensions from a gui.
gnome-tweak-tool



While many of them may not do what you expect, some are good.

Some extensions will need settings to be customized.

# Find where the settings for a shell extension are located.
# NOTE: Extensions may or may not have 'extension' in their schema name.
gsettings list-schemas

# Find the current settings, for an extension.
# if you have a keyword to grep, you can use that or copy one of the schemas from the list.
gsettings list-recursively $(gsettings list-schemas | grep weather)

org.gnome.shell.extensions.weather city ''
org.gnome.shell.extensions.weather position-in-panel 'center'
org.gnome.shell.extensions.weather show-comment-in-panel true
org.gnome.shell.extensions.weather show-text-in-panel true
org.gnome.shell.extensions.weather translate-condition true
org.gnome.shell.extensions.weather unit 'fahrenheit'
org.gnome.shell.extensions.weather use-symbolic-icons false
org.gnome.shell.extensions.weather woeid 'USTX0058'

# Find out what the valid settings are...
# Most useful for enums, otherwise just reports the data type and none exactly say what will happen...
gsettings range org.gnome.shell.extensions.weather unit

enum
'celsius'
'fahrenheit'

# Change a setting
gsettings set org.gnome.shell.extensions.weather unit 'fahrenheit'

Now you are an unintended expert in GNOME 3 shell extensions...This is a step backward, there was a GUI to add shell extensions in GNOME 2...I had no intention of becoming a shell extension expert...So I'm an unintended expert...

- Rick