Rock64 / Débian : Ajouter un disque dur externe

74 x served & 14 x viewed

Je viens de prendre un disque dur externe car j’ai pas trop confiance dans les cartes SD ( désolé Michel).

Etape 1 : Le formatage, pour cela il faut fdisk !

rock64@rock64:~$ cat /etc/debian_version 
9.9

rock64@rock64:~$ sudo whereis fdisk
fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz

rock64@rock64:~$ dpkg -S /sbin/fdisk
util-linux: /sbin/fdisk

rock64@rock64:~$ sudo fdisk -l               
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mtdblock0: 4 MiB, 4128768 bytes, 8064 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mmcblk1: 59.5 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 9CFDF7D8-766C-43DE-9354-57097D428E8F

Device          Start       End   Sectors  Size Type
/dev/mmcblk1p1     64      8063      8000  3.9M Linux filesystem
/dev/mmcblk1p2   8064      8191       128   64K Linux filesystem
/dev/mmcblk1p3   8192     16383      8192    4M Linux filesystem
/dev/mmcblk1p4  16384     24575      8192    4M Linux filesystem
/dev/mmcblk1p5  24576     32767      8192    4M Linux filesystem
/dev/mmcblk1p6  32768    262143    229376  112M Microsoft basic data
/dev/mmcblk1p7 262144 124735454 124473311 59.4G Linux filesystem


Disk /dev/sda: 1.8 TiB, 2000398933504 bytes, 3907029167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x88185100

Device     Boot Start        End    Sectors  Size Id Type
/dev/sda1  *       64 3907024128 3907024065  1.8T  7 HPFS/NTFS/exFAT

rock64@rock64:~$ sudo mkfs.ext3 /dev/sda1
mke2fs 1.43.4 (31-Jan-2017)
/dev/sda1 contains a ntfs file system labelled 'Seagate Portable Drive'
Proceed anyway? (y,N) y
Creating filesystem with 488378008 4k blocks and 122101760 inodes
Filesystem UUID: 42a1cde2-2269-4582-b4a0-2bb6272b0990
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848

Allocating group tables: done       

A noter qu’en cas de crash durant le formatage, je conseille alors :

rock64@rock64:~$ sudo mkfs -t ext4 /dev/sda1
[sudo] password for rock64: 
mke2fs 1.43.4 (31-Jan-2017)
Creating filesystem with 488378008 4k blocks and 122101760 inodes
Filesystem UUID: 3e48d36d-20e7-45b8-abea-97a6b234cfcc
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information:   

Et si la connexion n’est pas stable pendant le formatage :

rock64@rock64:~$ sudo apt-get install screen
...
rock64@rock64:~$ sudo screen -dmS "format"  mkfs -t ext4 /dev/sda1
...

Etape 2 : Préparation du montage sur l’OS :

rock64@rock64:~$ sudo mkdir /disk1

rock64@rock64:~$ sudo mount /dev/sda1 /disk1

rock64@rock64:~$ df -H

Filesystem      Size  Used Avail Use% Mounted on
udev            2.1G     0  2.1G   0% /dev
tmpfs           412M  5.6M  406M   2% /run
/dev/mmcblk1p7   63G   41G   20G  68% /
tmpfs           2.1G     0  2.1G   0% /dev/shm
tmpfs           5.3M  4.1k  5.3M   1% /run/lock
tmpfs           2.1G     0  2.1G   0% /sys/fs/cgroup
/dev/mmcblk1p6  118M  1.1M  117M   1% /boot/efi
tmpfs           412M     0  412M   0% /run/user/1000
/dev/sda1       2.0T   80M  1.9T   1% /disk1

Etape 3 : Modification du fstab :

rock64@rock64:~$ sudo vi /etc/fstab 

Etape 3 bis: On peut aussi utiliser les labels:

rock64@rock64:~$ sudo e2label /dev/sda1 nextcloud
rock64@rock64:~$ sudo vi /etc/fstab 
rock64@rock64:~$ sudo cat /etc/fstab 
LABEL=boot /boot/efi vfat defaults,sync 0 0
LABEL=nextcloud /disk1 ext4 defaults 1 1

ATTENTION, il faut tester le fichier /etc/fstab AVANT le reboot … sinon c’est LA MORT

rock64@rock64:~$ sudo mount -a /etc/fstab 

Voir même un petit text de copie :

rock64@rock64:~$ sudo cp -r /var/www/html/nextcloud/ /disk1/.

Jenkins / LibVirt / Qemu / Fédora : Brouillon d’une tentative de mise en place …

31 x served & 6 x viewed

!!! CECI EST UN BROUILLON !!!

Sur Jenkins j’ai mis le bon plugins : Libvirt Slaves

C’est pour l’instant en projet … mais j’essaye de faire une installation propre afin de facilité la validation automatique :

$ apt-get install qemu-kvm qemu virt-manager virt-viewer libvirt-bin

$ apt install libguestfs-tools

On télécharge pour une cible armhfp :

$ curl -O https://dl.fedoraproject.org/pub/fedora/linux/releases/30/Spins/armhfp/images/Fedora-Minimal-armhfp-30-1.2-sda.raw.xz
 
$ unxz Fedora-Minimal-armhfp-30-1.2-sda.raw.xz
 
$ sudo virt-builder -v -x --get-kernel Fedora-Minimal-armhfp-30-1.2-sda.raw
command line: virt-builder -v -x --get-kernel Fedora-Minimal-armhfp-30-1.2-sda.raw
virt-get-kernel --verbose -x --add 'Fedora-Minimal-armhfp-30-1.2-sda.raw'
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: add_drive "Fedora-Minimal-armhfp-30-1.2-sda.raw" "readonly:true" "protocol:file"
libguestfs: creating COW overlay to protect original drive content
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: disk_create "/tmp/libguestfsEd6WdG/overlay1" "qcow2" -1 "backingfile:/home/farias/Fedora-Minimal-armhfp-30-1.2-sda.raw"
…
 
$ sudo mv Fedora-Minimal-armhfp-30-1.2-sda.raw initramfs-5.0.9-301.fc30.armv7hl.img vmlinuz-5.0.9-301.fc30.armv7hl /var/lib/libvirt/images/.
 
$ sudo virt-install -v --name Fedora-Minimal-armhfp-30-1.2-sda.raw --ram 4096 --arch armv7l --import --os-variant fedora22 \
                     --disk /var/lib/libvirt/images/Fedora-Minimal-armhfp-30-1.2-sda.raw \
                     --boot kernel=/var/lib/libvirt/images/vmlinuz-5.0.9-301.fc30.armv7hl,initrd=/var/lib/libvirt/images/initramfs-5.0.9-301.fc30.armv7hl.img,kernel_args="console=ttyAMA0 rw root=LABEL=_/ rootwait"

File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in 
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

Pour fixer ce problème :

$ sudo rm -rf /usr/lib/python2.7/dist-packages/OpenSSL

$ sudo rm -rf /usr/lib/python2.7/dist-packages/pyOpenSSL-0.15.1.egg-info

$ sudo pip install pyopenssl

On reprends l’installation :

$ sudo virt-install -v --name Fedora-Minimal-armhfp-30-1.2-sda.raw --ram 4096 --arch armv7l --import --os-variant fedora22 \
                     --disk /var/lib/libvirt/images/Fedora-Minimal-armhfp-30-1.2-sda.raw \
                     --boot kernel=/var/lib/libvirt/images/vmlinuz-5.0.9-301.fc30.armv7hl,initrd=/var/lib/libvirt/images/initramfs-5.0.9-301.fc30.armv7hl.img,kernel_args="console=ttyAMA0 rw root=LABEL=_/ rootwait"

Pour l’instant j’ai un problème sur le lancement :

....
[  OK  ] Started udev Wait for Complete Device Initialization.
[  452.577419] audit: type=1130 audit(1568017972.419:65): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-udev-settle comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
         Starting Activation of DM RAID sets...
[  OK  ] Started Activation of DM RAID sets.
[  455.227583] audit: type=1130 audit(1568017975.069:66): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dmraid-activation comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  455.239316] audit: type=1131 audit(1568017975.081:67): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dmraid-activation comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Reached target Local Encrypted Volumes.
[  OK  ] Reached target Local File Systems (Pre).
         Mounting /boot...
[  456.625813] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
[  OK  ] Mounted /boot.
         Mounting /boot/efi...
[  OK  ] Mounted /boot/efi.
[  OK  ] Reached target Local File Systems.
         Starting Tell Plymouth To Write Out Runtime Data...
         Starting Restore /run/initramfs on shutdown...
         Starting Create Volatile Files and Directories...
         Starting Rebuild Dynamic Linker Cache...
[  OK  ] Started Tell Plymouth To Write Out Runtime Data.
[  461.320751] audit: type=1130 audit(1568017981.162:68): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=plymouth-read-write comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  461.328420] audit: type=1131 audit(1568017981.170:69): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=plymouth-read-write comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Started Restore /run/initramfs on shutdown.[  461.762211] audit: type=1130 audit(1568017981.604:70): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dracut-shutdown comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
 
[  OK  ] Started Rebuild Dynamic Linker Cache.
[  468.259621] audit: type=1130 audit(1568017988.101:71): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=ldconfig comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Started Create Volatile Files and Directories.
[  470.643545] audit: type=1130 audit(1568017990.485:72): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-tmpfiles-setup comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
         Starting Security Auditing Service...
         Starting Rebuild Journal Catalog...
[  473.210959] audit: type=1305 audit(1568017993.053:73): audit_enabled=1 old=1 auid=4294967295 ses=4294967295 subj=system_u:system_r:auditd_t:s0 res=1
[  OK  ] Started Rebuild Journal Catalog.
         Starting Update is Completed...
[  OK  ] Started Update is Completed.
[  OK  ] Started Security Auditing Service.
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Started Update UTMP about System Boot/Shutdown.
[  OK  ] Reached target System Initialization.
[  OK  ] Started daily update of the root trust anchor for DNSSEC.
[  OK  ] Listening on SSSD Kerberos…ache Manager responder socket.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting NTP client/server...
         Starting firewalld - dynamic firewall daemon...
         Starting OpenSSH ecdsa Server Key Generation...
         Starting OpenSSH rsa Server Key Generation...
         Starting Initial Setup configuration program...
         Starting System Security Services Daemon...
[  OK  ] Started Hardware RNG Entropy Gatherer Daemon.
         Starting OpenSSH ed25519 Server Key Generation...
[  OK  ] Started dnf makecache --timer.
[  OK  ] Reached target Timers.
[ 2049.261075] fbcon: Taking over console
================================================================================
================================================================================
1) [x] Language settings                 2) [x] Time settings
       (English (United States))                (America/New_York timezone)
3) [x] Network configuration             4) [!] Root password
       (Wired (eth0) connected)                 (Password is not set.)
5) [!] User creation
       (No user will be created)

C’est super long pour avoir « fbcon » .

A suivre.

JENKINS : Mémo pour l’update (version 2.193)

En passant

68 x served & 6 x viewed

Je me fais un petit mémo pour l’update de Jenkins :

jenkins:~$ sudo wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
--2019-09-04 08:08:33--  http://mirrors.jenkins-ci.org/war/latest/jenkins.war
Resolving mirrors.jenkins-ci.org (mirrors.jenkins-ci.org)... 52.202.51.185
Connecting to mirrors.jenkins-ci.org (mirrors.jenkins-ci.org)|52.202.51.185|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ftp-chi.osuosl.org/pub/jenkins/war/2.193/jenkins.war [following]
--2019-09-04 08:08:34--  http://ftp-chi.osuosl.org/pub/jenkins/war/2.193/jenkins.war
Resolving ftp-chi.osuosl.org (ftp-chi.osuosl.org)... 64.50.236.52, 2600:3402:200:227::2
Connecting to ftp-chi.osuosl.org (ftp-chi.osuosl.org)|64.50.236.52|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 78246752 (75M) [application/x-java-archive]
Saving to: ‘jenkins.war’
 
jenkins.war                               100%[=====================================================================================>]  74.62M  1.80MB/s    in 45s
 
2019-09-04 08:09:19 (1.66 MB/s) - ‘jenkins.war’ saved [78246752/78246752]
 
jenkins:~$ sudo systemctl stop jenkins
jenkins:~$ cp /usr/share/jenkins/jenkins.war jenkins.war.old
jenkins:~$ sudo mv jenkins.war /usr/share/jenkins/jenkins.war
jenkins:~$ sudo systemctl start jenkins

J’adore Jenkins 🙂

MUNIN : Comment ajouter un multiping ?

77 x served & 11 x viewed

Le multiping permet d’avoir sur un même graphique le ping de plusieurs noms de domaine. Cela permet de comprendre quelques problèmes.

Voici donc les étapes :

Etape n°1 : : Ajouter dans /etc/munin/plugin-conf.d/munin-node (à la fin):

[multiping]       
env.host www.orange.fr www.cyber-neurones.org
env.ping_args -c 3

Etape n°2 : : Le lien symbolique

$ sudo ln -s /usr/share/munin/plugins/multiping /etc/munin/plugins/multiping
$ sudo munin-node-configure

Normalement on doit voir :

...
multiping                  | yes  |
...

Etape n°3 : : Relancer le service

$ sudo systemctl restart munin-node.service

Etape n°4 : Le test via le telnet :

$ telnet localhost 4949
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
list
cpu df df_inode entropy forks freeboxv5_atm freeboxv5_attenuation freeboxv5_crc freeboxv5_fec freeboxv5_hec freeboxv5_rates freeboxv5_snr freeboxv5_status freeboxv5_uptime fw_packets http_loadtime httpresponsetime if_err_eth0 if_err_wlan0 if_eth0 if_wlan0 interrupts load memory multiping munin_stats netstat nfs4_client nfs_client ntp_kernel_err ntp_kernel_pll_freq ntp_kernel_pll_off ntp_offset open_files open_inodes proc_pri processes swap temper_x threads uptime users vmstat
fetch multiping
site1_packetloss.value 0
site1.value 0.017078
site2_packetloss.value 0
site2.value 0.016857

L’autre solution de test :

$ sudo su - munin --shell=/bin/bash
$ /usr/share/munin/munin-update --debug --nofork --host localhost.localdomain --service multiping

Ou encore :

$ sudo munin-run multiping
site1_packetloss.value 0
site1.value 0.016789
site2_packetloss.value 0
site2.value 0.016709

Bien vérifier les DNS dans /etc/resolv.conf ( ou dans /etc/resolvconf.conf ), voir même faire un ping avant.

A noter que le multiping est dans la catégorie « network ».

Dernier point, si vous êtes sur une Raspberry il faut penser à installer dnsutils pour avoir les outils dig et nslookup:

$ apt-get install dnsutils
$ dig www.cyber-neurones.org

; <<>> DiG 9.10.3-P4-Raspbian <<>> www.cyber-neurones.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58459
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1460
;; QUESTION SECTION:
;www.cyber-neurones.org.		IN	A

;; ANSWER SECTION:
www.cyber-neurones.org.	2881	IN	A	188.130.25.102
www.cyber-neurones.org.	2881	IN	A	188.130.25.202

;; Query time: 17 msec
;; SERVER: 81.253.149.10#53(81.253.149.10)
;; WHEN: Thu May 23 21:28:00 UTC 2019
;; MSG SIZE  rcvd: 83

$ nslookup www.cyber-neurones.org
Server:		81.253.149.10
Address:	81.253.149.10#53

Non-authoritative answer:
Name:	www.cyber-neurones.org
Address: 188.130.25.202
Name:	www.cyber-neurones.org
Address: 188.130.25.102

Jenkins & Confluence : Pour l’instant cela ne fonctionne pas

88 x served & 16 x viewed

Ce qui est dommage c’est que le plugin n’indique pas quel est l’erreur … il y a seulement une exception sur un pointeur NULL. ( https://wiki.jenkins.io/display/JENKINS/Confluence+Publisher+Plugin )

ERROR: Build step failed with exception
java.lang.NullPointerException
       at rocks.inspectit.releaseplugin.releasenotes.ConfluenceReleaseNotesPublisher.perform(ConfluenceReleaseNotesPublisher.java:99)
       at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
       at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
       at hudson.model.Build$BuildExecution.build(Build.java:206)
       at hudson.model.Build$BuildExecution.doRun(Build.java:163)
       at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
       at hudson.model.Run.execute(Run.java:1818)
       at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
       at hudson.model.ResourceController.execute(ResourceController.java:97)
       at hudson.model.Executor.run(Executor.java:429)
Build step 'Publish Release Notes on Confluence' marked build as failure

Misère.