Clonezilla server is a very useful tool when you need to create and restore operating systems often but for home setups it is a bit too much.
Thats when clonezilla live come into play, of course you can make a pendrive with it or burn it on cd but I often want to make backup and not have to download iso and burn it.
I have decided to make bootable clonezilla live so each time I boot up my laptop I have choice of making backup with clonezilla.
The method I have decided to use is mounting iso image placed in /boot/clonezilla directory.
Prerequsities:
Download iso for your architecture (in most of cases it is amd64 - works as well for intel 64 processors).
Create directory:
mkdir /boot/clonezilla
Move iso image to /boot/clonezilla
mv clonezilla-live-2.4.2-32-amd64.iso /boot/clonezilla
Copy part of your /boot/grub2/grub.cfg
In my case it was
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64' --class debian --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set a9b0693b-85e9-4cd9-941d-6192145ee0f2
echo 'Loading Linux 2.6.32-5-amd64 ...'
linux /vmlinuz-2.6.32-5-amd64 root=UUID=eec16201-b3de-4f50-8536-930ec2f78152 ro quiet
echo 'Loading initial ramdisk ...'
initrd /initrd.img-2.6.32-5-amd64
}
Paste it into /etc/grub.d/40_custom and modify it so it will look like that (not exactly like that):
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Clonezilla live" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
set isofile="/clonezilla/clonezilla-live-2.4.2-32-amd64.iso"
loopback loop $isofile
linux (loop)/live/vmlinuz boot=live union=overlay username=user config components quiet noswap nolocales edd=on nomodeset nodmraid ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" keyboard-layouts= ocs_live_batch=\"no\" locales= vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img
}
So you can see that part of configuration up to line with set root='(hd0,msdos1)' is exactly the same, after that we specify isofile, mount it and use loop for vmlinx and initrd.
After saving changes to /etc/grub.d/40_custom we need to regenerate grub.cfg with command:
grub2-mkconfig -o /boot/grub2/grub.cfg
Reboot and choose Clonezilla live in grub menu and you should have backup utility at hand.
When using clonezilla live make sure that you have storage drive mounted in /home/partimag (local or over network sshfs or nfs).
When using clonezilla live network in my case did not work, I had to manually bring it up but it is topic for another post.
Red Hat Certified Linux Geek
sobota, 10 października 2015
sobota, 19 września 2015
Suse Sles hangs during reboot or during halt
Recently I had a problem while working with SLES - Suse Enterprise Linux.
During reboot it just hanged same thing was going on while shutting down with halt -p.
From the messages appearing on screen I have seen that it has trouble with un mounting nfs shares.
The problem was that Suse was first bringing down network interfaces than trying to umount nfs shares.
I could either spend time trying to fix os (add umount somewhere to pre halt operations) or I could do:
- umount -a (so all resources that are not being used will be unmounted) and then halt -p or reboot
- do reboot -f instead (reboot with force does not care if nfs resources are mounted)
So I have decided not to spend time on fixing SUSE/SLES and do umount or reboot -f.
Overall my experience with SLES/SUSE is that they did really nice installer ... but apart from that things that should work out of the box don`t.
During reboot it just hanged same thing was going on while shutting down with halt -p.
From the messages appearing on screen I have seen that it has trouble with un mounting nfs shares.
The problem was that Suse was first bringing down network interfaces than trying to umount nfs shares.
I could either spend time trying to fix os (add umount somewhere to pre halt operations) or I could do:
- umount -a (so all resources that are not being used will be unmounted) and then halt -p or reboot
- do reboot -f instead (reboot with force does not care if nfs resources are mounted)
So I have decided not to spend time on fixing SUSE/SLES and do umount or reboot -f.
Overall my experience with SLES/SUSE is that they did really nice installer ... but apart from that things that should work out of the box don`t.
My attemp to fight with Carpal tunnel syndrome (CTS)
If you spend a lot of time in front of a computer sooner or later you will get Carpal tunnel syndrome.
I remember time when I used to laugh at it and say "Keyboard and mouse can not cause any injuries", I guess I was wrong.
After quite a few years working in IT i started feeling pain in my wrists - I could no longer do push ups on palms the only option was to do it on fists. Also I felt pain during normal day to day tasks.
I have decided to something about it.
So I went kayaking for about a week at least 5 hours a day and it cured me for about half a year, but after that time pain came back.
I did some digging in internet and decided to buy two gadgets:
- microsoft natural ergonomic keyboard 4000
- logitech wireless trackball m570
Advantages of ergonomic keyboard are that wrist rest is higher then the rest of the keyboard.
In some reviews I read that quality of that keyboard is poor - I can not say that (i have been using it for few weeks I it does not feel cheap if you know what I mean).
Colleagues at work say that I look funny with it but some of them have already first symptoms of CTS so we shall see who will look funny after surgery.
As to logitech wirelles trackball m570 it is my first day of using is (my wife likes it). I read quite a lot about it and someone suggested in comments that if you are going to buy a trackball because of CTS than buy one controlled with thumb.
Another good thing about that trackball is that you get with it logitech unifying adapter nano, so you can connect multiple Bluetooth devices to it (keyboard, mouse, headphones).
In few months time I will update this post so you will know if it worked.
I remember time when I used to laugh at it and say "Keyboard and mouse can not cause any injuries", I guess I was wrong.
After quite a few years working in IT i started feeling pain in my wrists - I could no longer do push ups on palms the only option was to do it on fists. Also I felt pain during normal day to day tasks.
I have decided to something about it.
So I went kayaking for about a week at least 5 hours a day and it cured me for about half a year, but after that time pain came back.
I did some digging in internet and decided to buy two gadgets:
- microsoft natural ergonomic keyboard 4000
- logitech wireless trackball m570
Advantages of ergonomic keyboard are that wrist rest is higher then the rest of the keyboard.
In some reviews I read that quality of that keyboard is poor - I can not say that (i have been using it for few weeks I it does not feel cheap if you know what I mean).
Colleagues at work say that I look funny with it but some of them have already first symptoms of CTS so we shall see who will look funny after surgery.
As to logitech wirelles trackball m570 it is my first day of using is (my wife likes it). I read quite a lot about it and someone suggested in comments that if you are going to buy a trackball because of CTS than buy one controlled with thumb.
Another good thing about that trackball is that you get with it logitech unifying adapter nano, so you can connect multiple Bluetooth devices to it (keyboard, mouse, headphones).
In few months time I will update this post so you will know if it worked.
sobota, 29 sierpnia 2015
looking for wireless laser printer that will work on Linux - Brother HL-1210WE is the way to go
Few years back I was using brother printer (it had LPT cable, yes it was that old), what I did like about it was that there were drivers for Linux.
So when I was searching for small home printer I decided to choose Brother HL-1210WE, and it was the right choice - print via wifi on windows 7 and Linux Debian without any problem.
Setup was not complicated, when I first connected it via usb cable pop up appeared and I clicked look for drivers, selected brother hl-1230 and was ready to print.
Wireless setup was easy as well, I went to System >> Administration >> Printing >> Add Printer >> IPP protocol.
In computer section pasted printers ip address, clicked next and selected appropriate drivers, and was ready to print.
Setup on windows was easy as well I did not have to supply network settings, printer took it from windows (password, ssid, and the rest from DHCP).
After that I decided to reserve ip address on my access point for printer - so it will not change.
So once again brother proved to be right hardware/software supplier for Linux users.
So when I was searching for small home printer I decided to choose Brother HL-1210WE, and it was the right choice - print via wifi on windows 7 and Linux Debian without any problem.
Setup was not complicated, when I first connected it via usb cable pop up appeared and I clicked look for drivers, selected brother hl-1230 and was ready to print.
Wireless setup was easy as well, I went to System >> Administration >> Printing >> Add Printer >> IPP protocol.
In computer section pasted printers ip address, clicked next and selected appropriate drivers, and was ready to print.
Setup on windows was easy as well I did not have to supply network settings, printer took it from windows (password, ssid, and the rest from DHCP).
After that I decided to reserve ip address on my access point for printer - so it will not change.
So once again brother proved to be right hardware/software supplier for Linux users.
niedziela, 10 maja 2015
How to check which command line parameters kernel was booted with
Good solution is to display file /proc/cmdline for example:
cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-2.6.32-5-amd64 root=UUID=eec16201-b3de-4f50-8536-930ec2f78152 ro quiet
When checking /proc/cmdline is useful?
When we want to check if parameters given during boot worked properly if e.g memmap worked properly.
cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-2.6.32-5-amd64 root=UUID=eec16201-b3de-4f50-8536-930ec2f78152 ro quiet
When checking /proc/cmdline is useful?
When we want to check if parameters given during boot worked properly if e.g memmap worked properly.
środa, 14 stycznia 2015
bash script for changing password
I have seen a lot of articles describing how to change password via a script, some of them work most of them don't.
Below I present option that works very well.
On a local machine can perform command:
echo -e "user:password" | chpasswd
If we are not happy with pasting in password in plain text then we use mkpasswd to encrypt the password and modify slightly command for changing password:
root@debian:/var/www# mkpasswd
Password:
TqDuqPhgvp7pM
Then we use our encrypted password in command:
echo -e "user:TqDuqPhgvp7pM" | chpasswd -e
What about running this command remotely on a server:
ssh root@IP_ADDRESS 'echo -e "user:password" | chpasswd'
encrypted version works almost the same
ssh root@IP_ADDRESS 'echo -e "user:encypted_password" | chpasswd -e'
What if I want to change password on multiple servers at once:
create a file (list.txt) with a list of ip addresses one under another
212.77.100.101
212.77.100.102
...
and run a command in a loop:
for i in $(cat list.txt); do ssh root@$i 'echo -e "user:password" | chpasswd' && echo $i ; done
This post might be little bit outdated because everyone should be using keys instead of passwords.
At my work we use both this is why I wanted to do it almost automatically.
Below I present option that works very well.
On a local machine can perform command:
echo -e "user:password" | chpasswd
If we are not happy with pasting in password in plain text then we use mkpasswd to encrypt the password and modify slightly command for changing password:
root@debian:/var/www# mkpasswd
Password:
TqDuqPhgvp7pM
Then we use our encrypted password in command:
echo -e "user:TqDuqPhgvp7pM" | chpasswd -e
What about running this command remotely on a server:
ssh root@IP_ADDRESS 'echo -e "user:password" | chpasswd'
encrypted version works almost the same
ssh root@IP_ADDRESS 'echo -e "user:encypted_password" | chpasswd -e'
What if I want to change password on multiple servers at once:
create a file (list.txt) with a list of ip addresses one under another
212.77.100.101
212.77.100.102
...
and run a command in a loop:
for i in $(cat list.txt); do ssh root@$i 'echo -e "user:password" | chpasswd' && echo $i ; done
This post might be little bit outdated because everyone should be using keys instead of passwords.
At my work we use both this is why I wanted to do it almost automatically.
sobota, 10 stycznia 2015
Compile kernel on CentOs 7 (should be very similar on RedHat and Fedora)
For me the reason why I decided to compile kernel was that in work I am testing software that is not included in default release.
Steps required to compile your own kernel:
Download kernel from https://www.kernel.org/.
Extract kernel by command tar -xvzf archive_name
Copy configuration file to location where you have extracted kernel:
cp /boot/config-3.10.0-123.el7.x86_64 your_extracted_archive_location
Prerequisites (install packages required):
yum groupinstall "Development Tools"
yum install bc.x86_64
yum install ncurses-devel
Configure what you want to be compiled to your new kernel:
- make menuconfig (choose option load file that you took earlier from /boot/config*, make modifications, choose save )
- make bzImage -j your_number_here (-j stands for the number of jobs (commands) to run simultaneously, I usually set one job per one core of processor)
- make modules -j your_number_here
- make modules_install -j your_number_here
- make install
The reason why I decided to choose configuration file from /boot/config* is that to do it manually properly would take much time, there is also less chance that I will make an error which will make machine to be unable boot. It is much easier and faster to edit existing proper configuration file.
Make install does all the magic, modifies grub but does not set new kernel as default.
In order to use compiled kernel during next boot modify file /etc/default/grub.
[root@localhost ~]# cat /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
#GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.keymap=pl2 crashkernel=auto vconsole.font=latarcyrheb-sun16 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
As you can see I've added GRUB_DEFAULT=0 and commented out "#GRUB_DEFAULT=saved".
I have read some articles that compiling kernel does not necessarily make Linux work faster but I have this strange filling that it does (even login via ssh takes less time).
A proof that it went through successfully:
[root@localhost ~]# uname -r
3.18.0-rc1
Steps required to compile your own kernel:
Download kernel from https://www.kernel.org/.
Extract kernel by command tar -xvzf archive_name
Copy configuration file to location where you have extracted kernel:
cp /boot/config-3.10.0-123.el7.x86_64 your_extracted_archive_location
Prerequisites (install packages required):
yum groupinstall "Development Tools"
yum install bc.x86_64
yum install ncurses-devel
Configure what you want to be compiled to your new kernel:
- make menuconfig (choose option load file that you took earlier from /boot/config*, make modifications, choose save )
- make bzImage -j your_number_here (-j stands for the number of jobs (commands) to run simultaneously, I usually set one job per one core of processor)
- make modules -j your_number_here
- make modules_install -j your_number_here
- make install
The reason why I decided to choose configuration file from /boot/config* is that to do it manually properly would take much time, there is also less chance that I will make an error which will make machine to be unable boot. It is much easier and faster to edit existing proper configuration file.
Make install does all the magic, modifies grub but does not set new kernel as default.
In order to use compiled kernel during next boot modify file /etc/default/grub.
[root@localhost ~]# cat /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
#GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.keymap=pl2 crashkernel=auto vconsole.font=latarcyrheb-sun16 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
As you can see I've added GRUB_DEFAULT=0 and commented out "#GRUB_DEFAULT=saved".
I have read some articles that compiling kernel does not necessarily make Linux work faster but I have this strange filling that it does (even login via ssh takes less time).
A proof that it went through successfully:
[root@localhost ~]# uname -r
3.18.0-rc1
Subskrybuj:
Posty (Atom)