вівторок, 28 вересня 2021 р.

Backup btrfs. Transfer snapshots to files on an external drive.


 And yes, we have:

  1. SanDisk 64GB usb3.1 USB stick with exFat partition with the LABEL "sunbeam".
  2. My not very old LinuxBox with usb-port usb2.0.
  3.  /.snapshots/root-2021-09-27 - Snapshot of the partition with the root of the operating system.
  4.  /.snapshots/var-2021-09-27 - Snapshot of the /var partition with OS variables.

To transfer a snapshot to a file on an external USB drive, use the command:


% sudo sh -c "btrfs send /.snapshots/root-2021-09-27 >| /run/media/user/sunbeam/root-2021-09-27.bin ; sync"


or


% sudo sh -c "btrfs send -f /run/media/user/sunbeam/root-2021-09-27.bin /.snapshots/root-2021-09-27 ; sync"


And for a snapshot of the /var partition:


% sudo sh -c "btrfs send /.snapshots/var-2021-09-27 >| /run/media/user/sunbeam/var-2021-09-27.bin ; sync"


or


% sudo sh -c "btrfs send -f /run/media/user/sunbeam/var-2021-09-27.bin /.snapshots/var-2021-09-27 ; sync"


After the operation, we check the availability of the files we need (In my case, transferring a snapshot

 of a root partition to external media took 45 minutes.) :


% ls -lah /run/media/user/sunbeam

-rwxr-xr-x 1 user users 7.7G Sep 27 21:38 root-2021-09-27.bin

-rwxr-xr-x 1 user users 421M Sep 28 10:53 var-2021-09-27.bin


You can now delete these snapshots from linuxbox using the appropriate btrfs subvolume delete 

command. And if necessary, restore them with the command:


% sudo sh -c "btrfs receive -f /run/media/user/sunbeam/root-2021-09-27.bin /.snapshots/ ; sync"


or


% sudo sh -c "cat /run/media/user/sunbeam/root -2021-09-27.bin |btrfs receive /.snapshots/ ; sync"


And accordingly for a /var snapshot:


% sudo sh -c "btrfs receive -f /run/media/user/sunbeam/var-2021-09-27.bin /.snapshots/ ; sync"


or


% sudo sh -c "cat /run/media/user/sunbeam/var-2021-09-27.bin |btrfs receive /.snapshots/ ; sync"


неділю, 2 серпня 2020 р.

Fedora 32 Minimal on the Orange Pi Zero plus.

<< Previos


Orange Pi Zero plus can be configured for use as a wifi router or webcam as a NAS or small CCTV server. For him, there are very few images are FreeBSD, NetBSD, openWRT and Armbian. In my opinion, the most adapted Armbian (My respect for its developers). Most ARM-Linux distributions are limited to images for the raspberri-pi and Pine-64 platforms. I was interested in one thing, I will not name it, it is my secret, which is well done in Fedora Linux. I will not describe everything in detail, I will only say that comparing the codes from Kernel.org and the Armbian repository, the difference was crazy, about 6,000 files differed. Therefore, it was not possible for me to view all this and I limited myself to what is needed for Orange Pi Zero plus. The patches I chose can be found here. The Fedora-32-Minimal disk image I created for Orange Pi Zero plus can be found here.

(md5

f593464dd183b808d83c88e3316bd651 *Fedora-Minimal-32-1.6.OrangePiZeroplus.aarch64.raw.xz

sha256

39c1ed484d6f9957eb9bdf05efe5441d2a257474e0a2240b8933a0d4262dfe21 *Fedora-Minimal-32-1.6.OrangePiZeroplus.aarch64.raw.xz)



 I added WiFi support and CPU recognition. SELinux enabled and secure boot works perfectly. Rpm packages compiled using% fedpkg local are located in the user's home directory. You can try to run the OS on a disk on other platforms with Allwinner a64, H5, H6 (the boot may not work if the Device Tree is radically different).


(write image: 

% sudo sh -c "xzcat Fedora-Minimal-32-1.6.OrangePiZeroplus.aarch64.raw.xz |dd of=/dev/sdX bs=4M iflag=fullblock oflag=direct status=progress; sync" 

replace sdX with the device name of your SD card) 


The loading lasts about 50 seconds, the indicators do not light up, the end of the loading can be observed on the network card when the Network Manager tries to configure the network. Login via SSH over Ethernet. We find the IP address using nmap (for example: # nmap -sP 172.31.255.1/24 where instead of 172.31.255.1 you specify the IP of the router of your local network, and instead of 24 the size of the mask of your subnet) login: poltawer (aka root), password: Fedora.


Original Fedora 32 Minimal aarch64 image , kernel package and uboot 


How do I create the disk image ^^^^^^

понеділок, 27 квітня 2020 р.

How I ran Fedora 31 Minimal on an Orange Pi zero plus.

                                                                                                                                                      next >>

I create image Fedora 31 Minimal for Orange Pi zero plus. Summary of the changes I made during installation Fedora.
  1. Add swap file 2GB
  2. Installing my custom kernel
  3. Disable SELinux
  4. Create administrator (user name: ‘poltawer’, password: ‘Fedora’)
(Warning: I don't know how loaded in kernel a dtb overlays, because something is not working. For example GPIO. I'll be grateful for your help in this matter)

 Download image
Demo
  1. Fedora installer Dracut needs 2GB of RAM, Orange Pi zero plus has only 500MB. IMHO is three variants for solving problems. For the first I do not have enough money, the second is questionable, and the third is what I did, if someone was interested in it then I will describe in the next post.
  2. I get the source from git Armbian and kernel.org and create a patch. Now, these .patch files are a shame to show, I have to clean them, I hope everything will be fine and I'll post them. In the Fedora kernel config file, I made some changes relative to the Orange Pi architecture. And build a kernel.
  3. Secure Boot doesn’t loaded unsigned kernel. Fedora Team or the system owner can sign the kernel. I hope my work is useful for someone, so it would not be ethical to put my private key in someone else's system. So if you need Secure Boot and you trust me, you can sign my kernel with your key or use native kernel or builded your own signed kernel.
  4. To secure your system change the user name and password. And enjoy!

вівторок, 29 березня 2016 р.

Tomcat jmx interface


$ uname -srm
FreeBSD 10.2-RELEASE amd64

without GUI

 $ java -version
openjdk version "1.8.0_66"
OpenJDK Runtime Environment (build 1.8.0_66-b17)
OpenJDK 64-Bit Server VM (build 25.66-b17, mixed mode)


I have a running service Tomcat 8. The JVM LISTENs  to a http interface on port 8080 and an  AJP interface on port 8009.



USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
www jsvc 14008 48 tcp4 6 *:8080 *:*
www jsvc 14008 53 tcp4 6 *:8009 *:*

I need remote connect to an java server over JMX and I created file setenv.sh.

 cat /usr/local/apache-tomcat-8.0/bin/setenv.sh
#!/bin/sh
export CATALINA_OPTS="Djava.awt.headless=true -Xmx128M -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=172.16.11.4"


Restart server:
# service tomcat8 restart

The Tomcat restarted but did not LISTEN a port 1090.
What am I doing wrong?

понеділок, 28 грудня 2015 р.

SkyStar 2 eXpress HD w Linux


Zbiórka i instalacja modułów jadra dla dvb-karty SkyStar 2 eXpress HD. Jak to zrobić jest opisano w tym wiki.
Dla SUSE to niczym się nie odróżnia ale ja opisze swój wariant.
Najpierw budujemy swoje środowisko developerskie, dla tego z konta root wykonujemy następne komendy

# zypper in -t pattern devel_C_C++ devel_basis devel_kernel devel_perl devel_rpm_build
# zypper in mercurial



Kiedy zostanie wszystko zainstalowane wracamy do zwykłego użytkownika, ściągamy źródła i budujemy moduł Perl Proc::ProcessTable. Ten moduł nam potrzebny będzie przy zbiórce modułów jadra.


$ wget -P Downloads/ http://search.cpan.org/CPAN/authors/id/J/JW/JWB/Proc-ProcessTable-0.53.tar.gz
$ mkdir stuff
$ cd stuff/
$ tar -zxvf ~/Downloads/Proc-ProcessTable-0.53.tar.gz
$ cd ~/stuff/Proc-ProcessTable-0.53
$ perl Makefile.PL
$ make
$ make test
$ su -
# cd /home/user/stuff/Proc-ProcessTable-0.53
# make install

  Teraz można przestępować do budowania modułów dla dvb-kart
$ cd ~/stuff
$ hg clone http://linuxtv.org/hg/%7Eendriss/media_build_experimental_work
$ cd media_build_experimental_work
$ make download
$ make untar
$ make
$ su -
# cd /home/user/stuff/media_build_experimental_work
# make install 


Po instalacje przeładujemy komputera i u nas musi się zjawić urządzenie /dev/dvb/adapter0


$ ls -R /dev/dvb

/dev/dvb:
adapter0

/dev/dvb/adapter0:
demux0 dvr0 frontend0 net0

.
Żeby to przetestować potrzebujemy oprogramowania dla oglądania telewizji, temu dodajemy repozytorium packman i instalujemy niezbędne pakiety. Tutaj można przeczytać o dodatkowych repozytoriach 



# zypper ar -f -n packman http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_13.2/ packman
# zypper in dvbcut dvbsnoop dvbstream dvb vdr



Najpierw otrzymujemy spisek kanałów przy pomoce dvbscan

$ dvbscan -s 3 /usr/share/dvb/dvb-s/Astra-19.2E > Astra-`date +%F`.conf

using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
ERROR: cannot parse'S2 10729000 V 22000000 2/3 8PSK
'
initial transponder 10744000 H 22000000 5
initial transponder 10759000 V 22000000 5
ERROR: cannot parse'S2 10773000 H 22000000 3/4 8PSK
'
initial transponder 10788000 V 22000000 5
ERROR: cannot parse'S2 10803000 H 22000000 3/4 8PSK
8< ------ 8< ------ 8< ------ 8< ------ 8<
nieco wycięto
8< ------ 8< ------ 8< ------ 8< ------ 8<
DVB-S IF freq is 1841000
Network Name 'ASTRA 1'
0x044e 0x1965: pmt_pid 0x0064 CSAT -- NAT GEO WILD (???, scrambled)
0x044e 0x1966: pmt_pid 0x00c8 CSAT -- MEZZO LIVE (???, scrambled)
0x044e 0x1967: pmt_pid 0x012c CSAT -- M6 MUSIC (???, scrambled)
0x044e 0x1968: pmt_pid 0x0190 CSAT -- DJAZZ.TV (???, scrambled)
0x044e 0x1969: pmt_pid 0x01f4 CSAT -- SERIE CLUB (???, scrambled)
0x044e 0x196a: pmt_pid 0x0258 CSAT -- OCS MAX (???, scrambled)
8< ------ 8< ------ 8< ------ 8< ------ 8<


W rezultacie otrzymujemy plik Astra-2015-12-27.conf, co mieści świeże listę kanałów zdjęte z 4-go portu DiSEqC-a (opcja -s 3). Сzyli liczba idzie od zera, dla przykładu do 1-go portu DiSEqC-a u mnie podłączona głowica naprawiona na satelitę Amos 4W, dla niej będę wykorzystana opcja -s 0.


$ dvbscan -s 0 /usr/share/dvb/dvb-s/Amos-4w > Amos-`date +%F`.conf

U Państwa mogę być ustawione głowicy na inne porty DiSEqC-a, temu opcje -s będę swoje. Pliki z danymi satelitów zawarte w katalogu /usr/share/dvb/dvb-s/, z tego tez trzeba wybrać swój.

Po zakończeniu skanowania przeglądamy otrzymane pliki

$ cat /home/user/Hotbird-2015-12-27.conf

Discovery Channel:10719:v:2:27500:175:140:4416
TVP Regionalna:10719:v:2:27500:170:120:4411
TVP INFO:10719:v:2:27500:169:116:4410
TVS:10719:v:2:27500:162:88:4403
KINO POLSKA:10719:v:2:27500:164:96:4405
TV PULS:10719:v:2:27500:171:124:4462
TV PULS:10719:v:2:27500:171:124:4412
TVP SPORT:10719:v:2:27500:161:84:4402
8< ------ 8< ------ 8< ------ 8< ------ 8<

Widzimy mnóstwo znalezionych kanałów, próbujemy podłączyć się do jednego z nich,do kanału TV PULS za pomocą szap.

$ szap -r -x -c /home/user/Hotbird-2015-12-27.conf TV\ PULS

reading channels from file '/home/user/Hotbird-2015-12-27.conf'
zapping to 6 'TV PULS':
sat 2, frequency = 10719 MHz V, symbolrate 27500000, vpid = 0x00ab, apid = 0x007c sid = 0x116e
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
status 1f | signal 9999 | snr 6058 | ber 00000000 | unc 00000000 | FE_HAS_LOCK

Jeżeli w końcu wyświetlonego wiersza otrzymujemy FE_HAS_LOCK, to kanał jest podłączony, wszystko pracuje i możemy zdejmować video-strumienie i patrzeć telewizje satelitarne. Jak to zrobić napisze następnym razem.


# zypper in tvheadend tvheadend-debuginfo vlc vlc-codecs phonon-backend-gstreamer phonon-backend-vlc
# zypper in kodi kodi-pvr.addons

середу, 21 січня 2015 р.

Mój szybki start z SUSE KIWI.


(w stylu tarantiniego)
Mnie więcej się podoba obrazy zebrane za pomocą libvirt.

Mnie był potrzebny obraz Xen wirtualnej maszyny z systemem openSUSE 13.2. Poradzili mi skorzystać z serwisu KIWI.

Wykonujemy trzy prostych komendy z interfejsu wiersza poleceń.

# cd /usr/share/doc/packages/kiwi/examples/suse-13.2/
# date && kiwi --prepare ./suse-xen-guest --root /var/lib/xen/images/myxen/ && date

Sun Jan 18 21:30:30 EET 2015
Jan-18 21:30:31 <1> : Description provides no MD5 hash, check
Jan-18 21:30:31 <1> : Reading image description [Prepare]...
Jan-18 21:30:32 <1> : Set root log: /var/lib/xen/images/myxen/.25254.screenrc.log...                                                done
8<- - - -8<- - - -8<- - - -8<- - - -8<- - - -
 Jan-18 21:51:56 <1> : Cleanup temporary copy of sysconfig/proxy                                                                     done
Jan-18 21:51:57 <1> : KIWI exited successfully
Jan-18 21:51:57 <1> : Complete logfile at: /var/lib/xen/images/myxen/.log                                                           done
Sun Jan 18 21:51:58 EET 2015



 # kiwi --create /var/lib/xen/images/myxen --type vmx -d /var/lib/libvirt/images/myxen-result

Jan-18 23:04:46 <1> : Description provides no MD5 hash, check
Jan-18 23:04:46 <1> : Reading image description [Create]...
Jan-18 23:04:46 <1> : Destination: /var/lib/libvirt/images/myxen-result doesn't exist
Jan-18 23:04:46 <1> : Would you like kiwi to create it [yes/no] ? yes
Jan-18 23:04:51 <1> : Image update:
Jan-18 23:04:51 <1> : --> Install/Update: kernel-xen
Jan-18 23:04:51 <1> : --> Remove: kernel-ec2
Jan-18 23:04:51 <1> : Description provides no MD5 hash, check
Jan-18 23:04:51 <1> : Reading image description [Upgrade]...
Jan-18 23:04:52 <1> : Set root log: /var/lib/xen/images/myxen.5238.screenrc.log...                                                  done
Jan-18 23:04:52 <1> : Setting up package manager: zypper                                                                            done
Jan-18 23:04:53 <1> : Mounting required file systems                                                                                done

8<- - - -8<- - - -8<- - - -8<- - - -8<- - - -
Jan-18 23:14:23 <1> : Creating image Xen configuration file...                                                                      skipped
Jan-18 23:14:23 <2> : No disk device setup found in machine section                                                                 skipped
Jan-18 23:14:24 <1> : Find build results at: /var/lib/libvirt/images/myxen-result                                                   done
Jan-18 23:14:24 <1> : KIWI exited successfully
Jan-18 23:14:24 <1> : Complete logfile at: /var/lib/xen/images/myxen.log             
                                               done

To już wszystko gotowe. :)

Uruchomiamy maszynę wirtualną za pomocą virt-manager, wybrawszy opcje <Import existing disk image>.



Pierwsze ładowanie
Start systemu zbudowanego za pomocą KIWI.


Stworzony obraz można wzięć dla testowania tutaj, dla logina root  hasło "Linux".

w rolach głównych:

CPU: AMD Athlon
OS: openSUSE Linux 13.1

 A teraz od początku.

Najpierw szukam potrzebnych pakietów.

# zypper se kiwi


S | Name | Summary | Type
--+---------------------------------------+------------------------------------------+-----------
| kiwi | openSUSE - KIWI Image System | package
| kiwi | openSUSE - KIWI Image System | srcpackage
| kiwi-config-openSUSE | KDE live CD | package
| kiwi-desc-isoboot | openSUSE - KIWI Image System ISO boot | package
| kiwi-desc-isoboot-requires | openSUSE - KIWI Image System ISO boot -> | package
| kiwi-desc-netboot | openSUSE - KIWI Image System PXE netwo-> | package
| kiwi-desc-netboot-requires | openSUSE - KIWI Image System NET boot -> | package
| kiwi-desc-oemboot | openSUSE - KIWI image descriptions | package
| kiwi-desc-oemboot-requires | openSUSE - KIWI Image System oem boot -> | package
| kiwi-desc-vmxboot | openSUSE - KIWI Image System Virtual M-> | package
| kiwi-desc-vmxboot-requires | openSUSE - KIWI Image System VMX boot -> | package
| kiwi-doc | openSUSE - KIWI Image System Documenta-> | package
| kiwi-instsource | Installation Source creation | package
| kiwi-instsource-plugins-openSUSE-12-1 | OpenSuSE - KIWI Image System | package
| kiwi-media-requires | openSUSE - packages which should be pa-> | package
| kiwi-pxeboot | openSUSE - KIWI Image System PXE boot -> | package
| kiwi-templates | openSUSE - KIWI JeOS system image temp-> | package
| kiwi-test | Unit tests for kiwi | package
| kiwi-tools | openSUSE - KIWI tools collection | package 
Wiele niezbędnych pakietów do budowy rożnych obrazów, ale niema dla Xena.

 Instaluje to wszystko, bo nie wiem co się potrzebne a co nie.
 

# zypper in kiwi kiwi-desc-netboot \
kiwi-desc-oemboot kiwi-desc-netboot-requires \
kiwi-desc-vmxboot kiwi-desc-oemboot-requires \
kiwi-desc-vmxboot-requires  kiwi-instsource \
kiwi-doc  kiwi-instsource-plugins-openSUSE-12-1 \
kiwi-media-requires kiwi-templates kiwi-tools \
kiwi-test


Wchodzimy w dyrektorium /example jak to rekomendowano w oficjalnym "openSUSE-KIWI Image System.Cookbook”. Patrzymy.


/usr/share/doc/packages/kiwi/examples # ls


README  extras  suse-12.1  suse-12.2  suse-12.3  suse-13.1
Ne gęsto :( potrzebnej 13.2 nie ma.
Szukamy konfiguracja dla Xena.



# find /usr/share/doc/packages/kiwi/examples | grep xen

./suse-12.1/suse-xen-guest/config.xml
8<- - - -
8<- - - -8<- - - -8<- - - -8<- - - -
./suse-12.2/suse-xen-guest/config.xml 
8<- - - -8<- - - -8<- - - -8<- - - -8<- - - -
./suse-12.3/suse-xen-guest/config.xml 
8<- - - -8<- - - -8<- - - -8<- - - -8<- - - -
 
Jeszce gorzej, konfiguracji dla SUSE 13 z Xen4 nie ma, jest tylko dla 12 z Xen3 a u nich rożne skrypty pygrub.
 Dalej robi takie fokusy, kopiuje dyrektorium suse-12.3 w suse-13.2PK

# cp -aR suse-12.3 suse-13.2PK

Wchodzę w stworzony dyrektorium suse-13.2PK i we wszystkich plikach zamieniam cyfry 12.3 na 13.2 za pomocą niżej podanego skryptu.

#!/bin/sh
 for i in  \
 `grep -H 12.3 ./*/* 2>/dev/null | cut -f1 -d: | sort -u | tr "\12" " "`;
  do cat $i | sed 's/12.3/13.2/g' >| $i.tmp && cat $i.tmp > $i && rm -f $i.tmp;
 done


Myślę, że tego wystarczy już, żeby zregenerować potrzebny obrazek, ale założy się, że inżynierowie SUSE nie przewidzieli w swoich skryptach takiej dystrybucji jak 13.2PK, dla tego tworze dowiązania symboliczne o prawidłowej nazwę:


# ln -s suse-13.2PK/ suse-13.2

Zapomniałem, jeszcze niewielki kresek, prawie dyrektorium dla szablonów obrazów.Tam też nie ma szablonu dla suse-13.2.


# cd /usr/share/kiwi/image/vmxboot
# ln -s suse-13.1 suse-13.2

пʼятницю, 16 січня 2015 р.

Xen PV guest OpenSUSE 13.2 (x86_64)


As I needed a PostgreSQL 9.3 database for my phpBB3 forum installation, I decided to use an OpenSUSE 13.2 distribution. 

The virtual machine PV Xen is located on logical volumes LVM2, so that the creation of  snapshot backups on the fly is possible. The kernel, initram and grub2 loader are located on a common ext2 partition. Minimal miscellaneous server is installed (without Xorg). PostgreSQL wasn’t installed in order to make the image maximally generic. The size of the disk is 10 GB, which is rather generous. Second disk can be added to the volume group, if more space is needed.

The image can be found here with configuration files for Xen3 (SLES11 SP3 I CentOS5.11) included.
Properties “name” and “vif” have to be configured according to your needs. The rest can be used as is, or adjusted to your environment or taste.

Xen4 (OpenSUSE 13.1) configuration files are needless as I raised the image with VM-Manager by means of <Import existing disk image>.

SSHD is enabled and activated, so it is possible to connect either via VNC or via SSH.
Login: poltawer
Password: Linux (the same for root)
Don’t forget to change the credentials after the first run ;)
I hope somebody could need it.

Any feedback is welcome!
CentOS 5.11
OpenSUSE 13.1