Not scripting related however:
I am using x2go to access my linux (ubuntu) system remotely, using the kdeWM. If I use firefox though, the moment I right click anywhere on a web page (say to open a link in a new tab or window), firefox freezes.
Turns out it's an issue with the pulse audio daemon, and at least if you're using x2go like me, it's easy to fix once you know what the problem is.
When disconnected from your linux server, in the x2go client, go into the session preferences, click on the Media tab -> and uncheck "Enable sound support". Selecting esd might also fix it, but I haven't tried that.
Many thanks to the comment by oms-ubun at: https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/528798 for directing me to the issue.
Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts
Monday, September 21, 2015
Tuesday, March 24, 2015
linux (fedora) how to change your screen resolution
The following are intended for when you're using a virtual machine (proxmox host in my case), and the resolution is too high for your 1080p laptop screen that you're using to manage the VMs remotely.
However these methods will probably work with a physical linux installation also (not just a virtual one).
As of 2015 the following method worked for me on Fedora 21 (server version):
Edit the following file with your favorite text editor (mine is VIM): /etc/default/grub
find the line starting with: GRUB_CMDLINE_LINUX=
and put at the end: video=800x600"
when you're done the line should look something like:
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora-server/root rd.lvm.lv=fedora-server/swap rhgb quiet video=800x600"
note: instead of 800x600 you can use, 640x480 or 1024x768 also
sources:
https://fedoraproject.org/wiki/Display_resolution_of_Fedora_18_virtual_machines
https://fedoraproject.org/wiki/GRUB_2?rd=Grub2
To change the resolution off X-windows (xorg),
xrandr --output VGA-0 --mode 800x600
-if you have any errors type xrandr by itself, (and hit enter), and you will see a list of available outputs and the list of modes for each one:
source: https://wiki.archlinux.org/index.php/xrandr
edit: below is my original method, which newer versions of fedora (as of 2015/ fedora 21) doesn't appear to work very well.
If you're running fedora in a virtual machine (proxmox, vmware, virtualbox), and the screen resolution of fedora in console mode (not X), is so high that it takes up your entire screen you can change it using fbset.
If you don't have fbset, first you'll have to install it "sudo yum install fbset"
Then you can change the resolution with the following:
sudo fbset -xres 800 -yres 600
(can use 1024 768, or other resolutions also).
However these methods will probably work with a physical linux installation also (not just a virtual one).
As of 2015 the following method worked for me on Fedora 21 (server version):
Edit the following file with your favorite text editor (mine is VIM): /etc/default/grub
find the line starting with: GRUB_CMDLINE_LINUX=
and put at the end: video=800x600"
when you're done the line should look something like:
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora-server/root rd.lvm.lv=fedora-server/swap rhgb quiet video=800x600"
note: instead of 800x600 you can use, 640x480 or 1024x768 also
sources:
https://fedoraproject.org/wiki/Display_resolution_of_Fedora_18_virtual_machines
https://fedoraproject.org/wiki/GRUB_2?rd=Grub2
To change the resolution off X-windows (xorg),
xrandr --output VGA-0 --mode 800x600
-if you have any errors type xrandr by itself, (and hit enter), and you will see a list of available outputs and the list of modes for each one:
source: https://wiki.archlinux.org/index.php/xrandr
edit: below is my original method, which newer versions of fedora (as of 2015/ fedora 21) doesn't appear to work very well.
If you're running fedora in a virtual machine (proxmox, vmware, virtualbox), and the screen resolution of fedora in console mode (not X), is so high that it takes up your entire screen you can change it using fbset.
If you don't have fbset, first you'll have to install it "sudo yum install fbset"
Then you can change the resolution with the following:
sudo fbset -xres 800 -yres 600
(can use 1024 768, or other resolutions also).
Labels:
console,
fbset,
fedora,
linux,
resolution,
screen,
virtual machine,
vm,
vmware
Saturday, April 27, 2013
dhclient and /etc/resolv.conf being overwritten.
In ubuntu 12.12 (the one I'm currently using), dhclient is used to get a dhcp lease. For most people this works just dandy. However if you use it for routing, and/or running your own dns server inside your network, or just want to have some dns servers used for whatever reason that the dhcp server doesn't issue you can do the following.
if you want just your custom dns server:
supersede domain-name-servers 8.8.8.8;
In fedora you have to go to /etc/sysconfig/network-scripts/, and find the file for your network device (something like ifcfg-ethX, where X is a number usually 0).
change the line PEERDNS=yes to =no.
If you go into the /etc/dhcp directory you will see a file called dhclient.conf
somewhere (anywhere really), in the file put the following line:
prepend domain-name-servers 8.8.8.8;if you want just your custom dns server:
supersede domain-name-servers 8.8.8.8;
This will put the 8.8.8.8 dns server at the top of the list of dns servers in the /etc/resolv.conf file, in addition the to usual ones that the dhcp server gave to your computer.
Of course for your network you will probably replace 8.8.8.8 with the ip address of another dns server (unless you really want to use one of google's dns servers).
In fedora you have to go to /etc/sysconfig/network-scripts/, and find the file for your network device (something like ifcfg-ethX, where X is a number usually 0).
change the line PEERDNS=yes to =no.
Friday, April 26, 2013
installing ssh fedora
Fedora nowadays doesn't have the ssh server by default, if you want it here's how (fedora no longer uses /etc/init.d):
yum install openssh
service sshd start
service sshd enable
note: if you want to start/enable other services on fedora you can replace sshd with the name of the other service.
yum install openssh
service sshd start
service sshd enable
note: if you want to start/enable other services on fedora you can replace sshd with the name of the other service.
Thursday, March 7, 2013
rrd illegal time fix, and editing xml with sed
And now for some BASHing...
If you use rrd, and do a reboot of your computer, on rare occasion you might run into an error like the following (I put xxx in some places for privacy).
ERROR: Cannot update /var/www/mrtg/xxx/10.x.x.5_xx.rrd with '1359389221:4100149299:563322753' /var/www/mrtg/xxx/10.x.x.5_xx.rrd: illegal attempt to update using time 1359389221 when last update time is 1359402962 (minimum one second step)
That long 10 digit number starting with 1359... is a unix time stamp, which is just the number of seconds that have elapsed since january 1st 1970. If you can't figure out the cause of this error, you can edit the rrd files. Unfortunately they are in a binary format and need to first be exported to xml, edited, and then converted back to binary format. While there is a python script for editing xml files exported from rrd databases, it required a library which I was unable to properly install on my linux machine. So I decided to create a bash script using sed, and not bother with python (or it's libraries)
Remember this is a BASH script, not a BATCH script. So if you're going to run this on a windows machine you'll need to install cygwin first, and run it from inside of cygwin.
#!/bin/bash
# you will probably want to run this as# find . -iname "*.rrd" -print0 |xargs -0 -I {} rrd-fixer.sh {}
#first we convert the rrd file to xml format
rrdtool dump $1 > $1.xml
#we need to figure out the current unix date (epoc format, number of seconds
#since 1970)
udate=`date +%s`
#the heart and soul, take out the bad last update stamp, and replace it with
# one mrtg (or other rrd based tools), won't barf on
sed -e "s/<lastupdate>1[0-9]\{9\}/<lastupdate>$udate/" $1.xml > $1.fixed.xml
#rrdtool won't overwrite the bad rrd file on it's own, so have to remove
#it ourselves
rm $1
#convert the .xml file back to .rrd format
rrdtool restore $1.fixed.xml $1
#cleanup the xml files
rm $1.xml
rm $1.fixed.xml
# ---------- end of bash script --------------------------
note: if you want to run this on a folder with many rrd files (like mrtg or smokeping will often create), you will probably want to run the script in the following manner:
find . -name "*.rrd" -print0 |xargs -0 -I {} rrd-fixer.sh {}
or if you want to simplify it:
ls -1 *.rrd |xargs rrd-fixer.sh
fyi, the python script I came across is at: http://pierre.palatin.fr/old/rrd-repair
Wednesday, February 27, 2013
synchronizing cross platform
If you've been in the computer field at all for the past few years, you've heard of the cloud, amazon s3, ec2, dropbox, windows live, carbonite, google docs, etc....
What if you don't want to store everything in the cloud, either it's too private, or don't want to run afoul of some data privacy laws (hippa?), or it would just cost too much to store all of the hours of baby videos you took.
Now you could use robocopy, or rsync, but these are both one direction. If you have a laptop that you edit information on along with a desktop (or another laptop?), you probably want to sync your information between the two not just do a one direction backup.
Unison is the program I've been using to keep various repositories of information in sync. It's cross platform, bi-directional, and doesn't involve the cloud, you control where everything is.
my usage is:
unison -batch profile.prf
the -batch option automates the synchronization process, without it, unison will ask about each and every file that it's copying, should it copy, delete, overwrite one, etc..., so you should probably run it just the first time without the -batch option (if at all).
profile.prf is the name of the configuration file (in the .unison folder if you don't specify a path to it), it can be any name though (pro.prf, home-sync.prf, etc...).
it'll also run over ssh like rsync does, or run a server also like rsync.
a unique feature of unison which I enable is for it to store previous versions of files into a separate folder (or you can store them in a hidden folder in the listing of folders being synchronized).
one of my .prf files, this is for windows, but unison on linux works just as well, just change the folders.
#######------start of prf file--------------
root = //server1/share/synced-folder1
root = //server2/share/synced-folder2
path = subfolder1
path = subfolder2
path = subfolder3
#as this is for windows, don't use fastcheck for unix usually
fastcheck = true
backup = Name *
#ignore any hidden folders, and cd images
ignore = Name {,.}*{.iso}
#where unison stores it's previous versions
backupdir = c:\Users\user1\unison-bak
#where to store the logs
logfile = c:\Users\user1\unison-logs\info-db
#the maximum number of previous versions
maxbackups = 10
#######------end of prf file--------------
What if you don't want to store everything in the cloud, either it's too private, or don't want to run afoul of some data privacy laws (hippa?), or it would just cost too much to store all of the hours of baby videos you took.
Now you could use robocopy, or rsync, but these are both one direction. If you have a laptop that you edit information on along with a desktop (or another laptop?), you probably want to sync your information between the two not just do a one direction backup.
Unison is the program I've been using to keep various repositories of information in sync. It's cross platform, bi-directional, and doesn't involve the cloud, you control where everything is.
my usage is:
unison -batch profile.prf
the -batch option automates the synchronization process, without it, unison will ask about each and every file that it's copying, should it copy, delete, overwrite one, etc..., so you should probably run it just the first time without the -batch option (if at all).
profile.prf is the name of the configuration file (in the .unison folder if you don't specify a path to it), it can be any name though (pro.prf, home-sync.prf, etc...).
it'll also run over ssh like rsync does, or run a server also like rsync.
a unique feature of unison which I enable is for it to store previous versions of files into a separate folder (or you can store them in a hidden folder in the listing of folders being synchronized).
one of my .prf files, this is for windows, but unison on linux works just as well, just change the folders.
#######------start of prf file--------------
root = //server1/share/synced-folder1
root = //server2/share/synced-folder2
path = subfolder1
path = subfolder2
path = subfolder3
#as this is for windows, don't use fastcheck for unix usually
fastcheck = true
backup = Name *
#ignore any hidden folders, and cd images
ignore = Name {,.}*{.iso}
#where unison stores it's previous versions
backupdir = c:\Users\user1\unison-bak
#where to store the logs
logfile = c:\Users\user1\unison-logs\info-db
#the maximum number of previous versions
maxbackups = 10
#######------end of prf file--------------
Subscribe to:
Posts (Atom)