Most of the time i am behind a NAT router either at work or at home and those error are pretty common on my openSUSE system.
The old school trick i always do is ping those hosts.
ping download.opensuse.org
ping downloadcontent.opensuse.org
now edit the file /etc/hosts and add
RESULT-OF-IP-FROM-PING download.opensuse.org
RESULT-OF-IP-FROM-PING downloadcontent.opensuse.org
eg. something like this.
195.135.221.134 download.opensuse.org
195.135.221.157 downloadcontent.opensuse.org
That trick always saves me from choosing a local mirror manually. It works for me and I'm not saying it will work for everyone, just try it and see.
Thursday, December 11, 2014
Monday, April 7, 2014
Boot-Installed-System
Saturday, March 8, 2014
Disable autorefresh
Disabling auto refresh of your repositories has some benefits. If you are on a limited internet connection or you just do not want to refresh every time you invoke zypper or yast sw_single then this post might be of interest for you.
Disable auto refresh for all remote repositories.
zypper mr -R -t
Now if you want to perform an update obviously you need to refresh the repositories. Here is a function that should help you do that. OpenSUSE defaults to bash for the log-in shell so you can just add this to your /etc/bash.bashrc.local note that bashrc.local does not exist and needs to be created.
update () {
## Check if user is root, if not exit with an error.
if (( EUID !=0 )); then
echo 'Root privileges are required for refreshing system repositories.' 1>&2
return 1
fi
## Create an array from the enabled repos by parsing zypper lr.
enabled=()
while IFS="|" read -ra line; do
[[ ${line[3]} = *Yes* ]] && enabled+=("${line[0]// /}")
done < <(zypper lr)
## Refresh all enabled repos and update.
zypper ref "${enabled[@]}" && zypper up
}
After you have save it you can source bashrc.local run: source /etc/bash.bashrc.local and then you can just run: update
One question might arise if you change you're log-in shell into something more advance. Don't worry you can just create a bash script and name it update (or whatever name you like) and modify that function like this.
#!/bin/bash
## Check if user is root, if not exit with an error.
if (( EUID !=0 )); then
echo 'Root privileges are required for refreshing system repositories.' 1>&2
exit 1
fi
## Create an array from the enabled repos by parsing zypper lr.
enabled=()
while IFS="|" read -ra line; do
[[ ${line[3]} = *Yes* ]] && enabled+=("${line[0]// /}")
done < <(zypper lr)
## Refresh all enabled repos and update.
zypper ref "${enabled[@]}" && zypper up
Put it in say /usr/local/bin or any place that you are comfortable with. Make it executable
chmod +x update Then you can just run update .
Happy updating!
Disable auto refresh for all remote repositories.
zypper mr -R -t
Now if you want to perform an update obviously you need to refresh the repositories. Here is a function that should help you do that. OpenSUSE defaults to bash for the log-in shell so you can just add this to your /etc/bash.bashrc.local note that bashrc.local does not exist and needs to be created.
update () {
## Check if user is root, if not exit with an error.
if (( EUID !=0 )); then
echo 'Root privileges are required for refreshing system repositories.' 1>&2
return 1
fi
## Create an array from the enabled repos by parsing zypper lr.
enabled=()
while IFS="|" read -ra line; do
[[ ${line[3]} = *Yes* ]] && enabled+=("${line[0]// /}")
done < <(zypper lr)
## Refresh all enabled repos and update.
zypper ref "${enabled[@]}" && zypper up
}
After you have save it you can source bashrc.local run: source /etc/bash.bashrc.local and then you can just run: update
One question might arise if you change you're log-in shell into something more advance. Don't worry you can just create a bash script and name it update (or whatever name you like) and modify that function like this.
#!/bin/bash
## Check if user is root, if not exit with an error.
if (( EUID !=0 )); then
echo 'Root privileges are required for refreshing system repositories.' 1>&2
exit 1
fi
## Create an array from the enabled repos by parsing zypper lr.
enabled=()
while IFS="|" read -ra line; do
[[ ${line[3]} = *Yes* ]] && enabled+=("${line[0]// /}")
done < <(zypper lr)
## Refresh all enabled repos and update.
zypper ref "${enabled[@]}" && zypper up
Put it in say /usr/local/bin or any place that you are comfortable with. Make it executable
chmod +x update Then you can just run update .
Happy updating!
Sunday, November 17, 2013
Vboxwebsrv with systemd on openSUSE
This works if you need to restart vboxwebsrv using systemd in openSUSE. Some folks will raise some eye browse with this configuration for sure :-). The USER-NAME in the entry below is the username of the user who will access vboxwebsrv.
Create a unit file in /etc.
why etc? because according to the man pages somewhere that if a local admin will make a unit file it should be in /etc because the order of which the unit file to be executed. Meaning if you have conflicting unit files in /usr and in /etc then the latter will be prioritize. Note that packages (*.rpm) unit files are in /usr.
Put the entry below inside that unit file.
[Unit]
Description=VirtualBox Web Service
After=network.target
[Service]
Type=forking
PIDFile=/run/VBoxWeb/VBoxWeb.pid
EnvironmentFile=/usr/lib/systemd/system/VBoxWeb.service
ExecStartPre=/bin/bash -c 'if [[ -e $PIDFile ]]; then rm -f "$PIDFile"; fi'
ExecStart=/usr/bin/vboxwebsrv --pidfile "$PIDFile" --background
Restart=on-failure
User=USER-NAME
Group=vboxusers
[Install]
WantedBy=multi-user.target
This is not a shell script! That is what systemd folks will say for sure ;-). The ExecStartPre in that unit file is removing (deleting) the pid file so when vboxwebsv should restart you will not get any errors. The EnvironmentFile entry is like sourcing a shell script. In this case it is sourcing the unit file itself, hence the variable PIDFile. Note that with systemd 208 which is the default fro 13.1 the ExecPre line in that unit file is not required anymore, seems systemd is much smarter now a days! :-). 12.3 below you might still need it.
Create the temporary files and directories.
Change the permission.
Disable the vboxwebsrv service that came with VirtualBox package.
or
Start your newly created (unit file) Daemon.
Enable your newly created (unit file) Daemon.
This is very useful when you are using phpvirtualbox and you are restarting the vms every once in a while.
Cheers...
Create a unit file in /etc.
- /etc/systemd/system/VBoxWeb.service
why etc? because according to the man pages somewhere that if a local admin will make a unit file it should be in /etc because the order of which the unit file to be executed. Meaning if you have conflicting unit files in /usr and in /etc then the latter will be prioritize. Note that packages (*.rpm) unit files are in /usr.
Put the entry below inside that unit file.
[Unit]
Description=VirtualBox Web Service
After=network.target
[Service]
Type=forking
PIDFile=/run/VBoxWeb/VBoxWeb.pid
EnvironmentFile=/usr/lib/systemd/system/VBoxWeb.service
ExecStartPre=/bin/bash -c 'if [[ -e $PIDFile ]]; then rm -f "$PIDFile"; fi'
ExecStart=/usr/bin/vboxwebsrv --pidfile "$PIDFile" --background
Restart=on-failure
User=USER-NAME
Group=vboxusers
[Install]
WantedBy=multi-user.target
This is not a shell script! That is what systemd folks will say for sure ;-). The ExecStartPre in that unit file is removing (deleting) the pid file so when vboxwebsv should restart you will not get any errors. The EnvironmentFile entry is like sourcing a shell script. In this case it is sourcing the unit file itself, hence the variable PIDFile. Note that with systemd 208 which is the default fro 13.1 the ExecPre line in that unit file is not required anymore, seems systemd is much smarter now a days! :-). 12.3 below you might still need it.
Create the temporary files and directories.
- echo "d /run/VBoxWeb 0755 USER-NAME vboxusers" > /etc/tmpfiles.d/VBoxWeb.conf
- mkdir /run/VBoxWeb
Change the permission.
- chown USER-NAME:vboxusers /run/VBoxWeb
- chmod 755 /run/VBoxWeb
Disable the vboxwebsrv service that came with VirtualBox package.
- chkconfig vboxweb-service off
or
- systemctl disable vboxweb-service.service
Start your newly created (unit file) Daemon.
- systemctl start VBoxWeb.service
Enable your newly created (unit file) Daemon.
- systemctl enable VBoxWeb.service
This is very useful when you are using phpvirtualbox and you are restarting the vms every once in a while.
Cheers...
Thursday, October 10, 2013
VirtualBox Autosave Autostart of vms
This assumes that you are the only user on your system if not then you can try my Phpvirtualbox guide. You do not need your favorite sudo utility nor running su just to set your vms to auto. Enable the systemd service one time and use VBoxManage to set your vms to auto.
Download the script that will handle the vms.
- wget https://raw.github.com/Jetchisel/VBoxAutostart/master/systemd-vboxinit
- cp -v systemd-vboxinit ~/bin
- chmod ug+x ~/bin/systemd-vboxinit
Change the group to vboxusers
- chgrp vboxusers ~/bin/systemd-vboxinit
2. Download the unit file that will execute your script during boot/restart/shutdown of the host.
- wget https://raw.github.com/Jetchisel/VBoxAutostart/master/VBoxAutostart@.service
- cp -v VBoxAutostart@.service /usr/lib/systemd/system
- systemctl start VBoxAutostart@your-user-name.service
- systemctl enable VBoxAutostart@your-user-name.service
- systemctl status VBoxAutostart@your-user-name.service
3. Choose your vms that you want to autostart and autosave during boot/restart/shutdown of your host.
Get the names of the vms.
- VBoxManage list vms
- VBoxManage setextradata YOUR-VM-NAME pvbx/startupMode auto
- VBoxManage getextradata YOUR-VM-NAME pvbx/startupMode
- VBoxManage setextradata YOUR-VM-NAME pvbx/startupMode manual
- VBoxManage setextradata YOUR-VM-NAME pvbx/startupMode
- You can use the ExtraData script from the zip file below to manage your vms.
4. To access your vms.
- rdesktop localhost:1234
where 1234 is the port number which you can set via the gui or via VBoxManage.
A gui app which you can use is krdc for Kde and gnome-rdp for Gnome.
The zip file from github. https://github.com/Jetchisel/VBoxAutostart/archive/master.zip
I have package this stuff and it's in OBS now as an rpm. Look for systemd-vboxinit
NOTE: if you have the Phpvirtualbox solution then you do not need this thus it can conflict with each other.
Monday, September 23, 2013
PhpSysInfo
Download the latest release in http://sourceforge.net/projects/phpsysinfo/files/latest/download
Add an entry to apache2 config
Add the entry below
Again the only thing to adjust to your set up is /data/apache2.
Restart apache2
Type the url on your browser
Unpack that tar ball. I choose to install in /data/apache2. - tar -zxvf phpsysinfo-"$version"-tar.gz -c /data/apache2
- cd /data/apache2/phpsysinfo-"$version"
- cp -v phpsysinfo.ini.new phpsysinfo.ini
- chown -Rv wwwrun:www /data/apache2/phpsysinfo-"$version"
Add an entry to apache2 config
- vi /etc/apache2/conf.d/phpSysInfo.conf
Add the entry below
Alias /sysinfo /data/apache2/phpsysinfo-"$version"
<Directory /data/apache2/phpsysinfo-"$version">
Options Indexes MultiViews FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory /data/apache2/phpsysinfo-"$version">
Options Indexes MultiViews FollowSymLinks
Order allow,deny
Allow from all
</Directory>
Again the only thing to adjust to your set up is /data/apache2.
Restart apache2
- systemctl restart apache2.service
Type the url on your browser
- localhost/sysinfo
Thursday, September 19, 2013
phpVirtualBox on openSUSE reloaded
phpVirtualBox home page has been moved from google to sourceforge it is in http://sourceforge.net/projects/phpvirtualbox/files/latest/download. You will need to install VirtualBox since it is just a front end. before you can use this app. Refer to my guide on how you can install vbox. After you have installed vbox you will install a web server. We will use apache2 as an example. You can either use yast2 software management to install the lamp_server pattern and some php packages or use our friend zypper.
In this setup i choose to install to a different directory than /srv/www/htdocs. So just in case something unrecoverable happens :P in my system i will not delete the directory where phpvirtuablox resides. Here i choose /data/apache2. You can put it any where you like just replace the config entry in apache2.
- zypper in patterns-openSUSE-lamp_server php5-soap
- vi /etc/apache2/conf.d/phpvirtualbox.conf
The only thing you need to replace to meet your setup is /data/apache2 the rest is as-is.
Alias /phpvirtualbox /data/apache2/phpvirtualbox
<Directory /data/apache2/phpvirtualbox>
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
- unzip phpvirtualbox-"$version".zip -d /data/apache2/ && cd /data/apache2
- mv -v phpvirtualbox-"$version" phpvirtualbox && cd phpvirtualbox
- mv config.php-example config.php
var $username = 'jetchisel';
var $password = 'mypassword';
- var $ location = 'http://127.0.0.1:18083';
- var $consoleHost = 'IP ADDRESS OF YOUR COMPUTER';
Create an file called virtualbox in /etc/default and put something like this.
VBOXWEB_USER=jetchisel
Set permissions as root run the following commands.
- chgrp -Rv vboxusers /data/apache2/phpvirtualbox
- chmod -Rv 775 /data/apache2/phpvirtualbox
var $startStopConfig = true;
var $enableAdvancedConfig = true;
For the deprecated system V.
- wget https://raw.github.com/Jetchisel/vboxinit/master/sysV-vboxinit -O vboxinit
- cp -v vboxinit /etc/init.d/vboxinit
- chmod u+rx /etc/init.d/vboxinit
- chkconfig vboxinit on
- /etc/init.d/vboxinit {start|stop|restart|status}
Enable the init scripts at boot time.
- chkconfig vboxweb-service on
Restart the init scripts as root run the following.
- service vboxautostart-service restart
- service vboxweb-service restart
For SYSTEMD
Download the systemd version for SuSE.
- wget https://raw.github.com/Jetchisel/systemd-vboxinit/master/systemd-vboxinit
- cp -v systemd-vboxinit /usr/lib/systemd
- chmod ug+x /usr/lib/systemd/systemd-vboxinit
- chgrp vboxusers /usr/lib/systemd/systemd-vboxinit
Create a systemd unit "vboxvmservice.service" (or any name that suits you)
inside /usr/lib/systemd/system and add the entry below: Replace " username " with the user that belongs to the vboxusers group.
[Unit]
Description=VBox Virtual Machine Service
Requires=systemd-modules-load.service
After=systemd-modules-load.service
Before=shutdown.target reboot.target halt.target
[Service]
Type=oneshot
User=username
Group=vboxusers
KillMode=none
StandardOutput=syslog+console
EnvironmentFile=/etc/default/virtualbox
ExecStart=/usr/lib/systemd/systemd-vboxinit start
ExecStop=/usr/lib/systemd/systemd-vboxinit stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
If you choose to save the systemd-vboxinit script in another path and not /usr/lib/systemd then you need to adjust the following entry.
- ExecStart=/path/to/file/systemd-vboxinit start
- ExecStop=/paht/to/file/systemd-vboxinit stop
Start that newly created unit.
- systemctl start vboxvmservice.service
- systemctl enable vboxvmservice.service
Enable the init scripts;
- systemctl enable vboxweb-service.service
Start and enable apache2.
- systemctl start apache2.service
- systemctl enable apache2.service
In your browser type the url below:
- localhost/phpvirtualbox
First log in:
- username: admin
- password: admin
After a log in you can add a user that can handle your vms.
Configure vms in phpvirtualbox's graphical menu.
- Settings --> General --> Basic --> "StartupMode --> Automatic"

An example of running vms at boot.
Checking the status of your unit after booting.
Zip file from github: https://github.com/Jetchisel/systemd-vboxinit/archive/master.zip
You can search phpvirtualbox for an rpm package of this in OBS.
Kudos to Mr. Ian Moore the author of phpvirtuabox.
Subscribe to:
Posts (Atom)













