2019年8月25日 星期日

機械鍵盤 - 換軸,驚心記

機械鍵盤,要換軸,只能把它解焊下來



要除鍚之後,先補一些錫,比較好解焊。
技巧,要加熱稍久一點,錫才能吸乾淨。加熱熔解後,數 1 , 2 .. 5,移開烙鐵,吸錫。

換好後,測試,鍵都能正常反應,唯獨 [Enter] 鍵沒反應。把改的線路都拆了,仍不正常。心裡好緊張,想說好不容易換完軸,卻不能用,白白損失了一個幾乎全新的鍵盤。

最後,只好把按鍵再解焊下來,一看,原來這個鍵沒法完全除焊,只好一邊加熱,一邊用力翹,把貫孔也給拔下來了,電路也拔斷了。

好在廠商為了配合不同的鍵盤配置,有 2個 [Enter] 鍵的焊孔,把它跳線過來就好了。




2019年8月22日 星期四

在老舊機器上使用大容量硬碟

2008 年買的 HP 伺服器,好像 BIOS 只能用 MBR,沒辦法用 GPT。可以建立 GPT,但是執行 mkfs.ext4 時,就會出現 I/O error。原來是懷疑 Seagate 的 8TB 硬碟有問題,換成 WD 的 4TB 的 NAS 碟,還是一樣死掉。

後來想到可能是 GPT 的問題,改用 MBR,卻無法建立超過 2TB 的磁區。好吧,那就用 LVM,可是卻只能建2個磁區,第3個就會一直抱怨 overlap。8TB 的硬碟只能用一半的空間,這怎能接受。後來看到 LVM 可以使用整個硬碟,不用建分割區,問題就完全解決。用 dmesg 看系統訊息,也完全不再有 error 的訊息,我本該懺悔,錯怪硬碟了。

但是,隔一晚之後,它還是死了。看看在硬碟上的註記,就能知道對這硬碟已經完全放棄了,而且非常生氣。


使用整顆硬碟來建立 LVM
建立 PV 及 VG

# [root@localhost ~]# pvcreate /dev/sdb
WARNING: dos signature detected on /dev/sdb at offset 510. Wipe it? [y/n]: y
  Wiping dos signature on /dev/sdb.
  Physical volume "/dev/sdb" successfully created.

[root@localhost ~]# vgcreate vg_dspace /dev/sdb
  Volume group "vg_dspace" successfully created
檢視建立的 VG

# vgdisplay vg_dspace
  --- Volume group ---
  VG Name               vg_dspace
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <7.28 TiB
  PE Size               4.00 MiB
  Total PE              1907721
  Alloc PE / Size       1887437 / 7.20 TiB
  Free  PE / Size       20284 / 79.23 GiB
  VG UUID               MWcmt5-QcYs-TmOK-yEWD-O5O4-uH4L-vyYuhL
   


G

[root@localhost ~]# lvcreate -L 7.2TB vg_dspace  -n vc_dspace
  Rounding up size to full physical extent 7.20 TiB
  Logical volume "vc_dspace" created.

[root@localhost ~]# mkfs.ext4 /dev/vg_dspace/vc_dspace 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
241594368 inodes, 1932735488 blocks
96636774 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4081057792
58983 block groups
32768 blocks per group, 32768 fragments per group
4096 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
        102400000, 214990848, 512000000, 550731776, 644972544

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


G

[root@localhost ~]# lsblk
NAME                  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                     8:0    0  1.8T  0 disk 
├─sda1                  8:1    0    1G  0 part /boot
└─sda2                  8:2    0  1.8T  0 part 
  ├─centos-root       253:0    0   50G  0 lvm  /
  ├─centos-swap       253:1    0  6.9G  0 lvm  [SWAP]
  └─centos-home       253:2    0  1.8T  0 lvm  /home
sdb                     8:16   0  7.3T  0 disk 
└─vg_dspace-vc_dspace 253:3    0  7.2T  0 lvm  
sr0                    11:0    1 1024M  0 rom  

   


[root@localhost ~]# lvremove /dev/vg_dspace/vc_dspace
Do you really want to remove active logical volume vg_dspace/vc_dspace? [y/n]: y
  Logical volume "vc_dspace" successfully removed



                           cfdisk (util-linux 2.23.2)

                              Disk Drive: /dev/sdb
                      Size: 4000787030016 bytes, 4000.7 GB
            Heads: 25   Sectors per Track: 3   Cylinders: 104187162

    Name        Flags    Part Type  FS Type          [Label]        Size (MB)
 ------------------------------------------------------------------------------
    sdb1                    Primary   Linux                          2000300.01 
    sdb2                    Primary   Linux                          2000487.03*



partprobe


[[root@localhost ~]# vgdisplay vg_dspace
  --- Volume group ---
  VG Name               vg_dspace
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               <3.64 TiB
  PE Size               4.00 MiB
  Total PE              953861
  Alloc PE / Size       0 / 0   
  Free  PE / Size       953861 / <3.64 TiB
  VG UUID               aLTwuw-I8Cc-JAhn-2wtB-9UQr-42Td-XuZHLk



[root@localhost ~]# pvcreate /dev/sdb1 /dev/sdb2
  Physical volume "/dev/sdb1" successfully created.
  Physical volume "/dev/sdb2" successfully created.
[root@localhost ~]# vgcreate vg_dspace /dev/sdb1 /dev/sdb2
  Volume group "vg_dspace" successfully created



巨巨
[[root@localhost ~]# lvcreate -L 3.64TB  -n vc_dspace  vg_dspace
  Rounding up size to full physical extent 3.64 TiB
  Volume group "vg_dspace" has insufficient free space (953861 extents): 954205 required.

[root@localhost ~]# lvcreate -L 3.635TB  -n vc_dspace  vg_dspace
  Rounding up size to full physical extent <3.64 TiB
  Logical volume "vc_dspace" created.


[root@localhost ~]# mkfs.ext4 /dev/vg_dspace/vc_dspace 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
243941376 inodes, 975763456 blocks
48788172 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3124756480
29778 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
 102400000, 214990848, 512000000, 550731776, 644972544

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:            
Warning, had trouble writing out superblocks.



[root@localhost ~]# mkfs.ext4 /dev/vg_dspace/vc_dspace 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
243941376 inodes, 975763456 blocks
48788172 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3124756480
29778 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
 102400000, 214990848, 512000000, 550731776, 644972544

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:            
Warning, had trouble writing out superblocks.




[ 1761.247023] sd 4:0:0:0: [sdb] tag#0 CDB: Write(16) 8a 00 00 00 00 00 e8 f1 a9 f0 00 00 02 98 00 00
[ 1761.247030] blk_update_request: I/O error, dev sdb, sector 3908151792
[ 1761.256705] sd 4:0:0:0: [sdb] Read Capacity(16) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[ 1761.256717] sd 4:0:0:0: [sdb] Sense not available.
[ 1761.257615] sd 4:0:0:0: [sdb] Read Capacity(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[ 1761.257621] sd 4:0:0:0: [sdb] Sense not available.
[ 1761.257790] sdb: detected capacity change from 4000787030016 to 0
[ 1761.545493] VFS: Dirty inode writeback failed for block device dm-3 (err=-5).
[ 1827.839344] scsi_io_completion: 58 callbacks suppressed
[ 1827.839358] sd 4:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[ 1827.839365] sd 4:0:0:0: [sdb] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00
[ 1846.090413] sd 4:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[ 1846.090430] sd 4:0:0:0: [sdb] tag#0 CDB: ATA command pass through(16) 85 06 2c 00 00 00 00 00 00 00 00 00 00 00 e5 00
.

後來,先在 3TB 的硬碟上裝好 CentOS 7,然後再用 LVM 擴充硬碟。在舊機器,最多只能支援 3TB 的硬碟。

# vgextend centos /dev/sdb1
umount /home
userdel agee

不支援 xfs
mkfs.ext4 /dev/centos/home
# lvreduce --resize --size 100G /dev/centos/home
# lvcreate -L 3.64TB  -n dspace  centos

修改 /etc/fstab,改用 ext4

useradd -g users -G lp,wheel,audio,cdrom -m john
passwd john

2019年8月21日 星期三

在 CentOS 安裝 xrdp server

無法安裝
錯誤訊息如下
[root@box ~]# yum -y install xrdp
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.serverspace.co.uk
 * epel: mirrors.coreix.net
 * extras: mirror.sov.uk.goscomb.net
 * updates: mirror.sov.uk.goscomb.net
Resolving Dependencies
--> Running transaction check
---> Package xrdp.x86_64 1:0.9.10-1.el7 will be installed
--> Processing Dependency: xrdp-selinux = 1:0.9.10-1.el7 for package: 1:xrdp-0.9.10-1.el7.x86_64
--> Processing Dependency: xorgxrdp for package: 1:xrdp-0.9.10-1.el7.x86_64
--> Running transaction check
---> Package xorgxrdp.x86_64 0:0.2.10-4.el7 will be installed
--> Processing Dependency: xorg-x11-server-Xorg(x86-64) = 1.20.4 for package: xorgxrdp-0.2.10-4.el7.x86_64
---> Package xrdp-selinux.x86_64 1:0.9.10-1.el7 will be installed
--> Finished Dependency Resolution
Error: Package: xorgxrdp-0.2.10-4.el7.x86_64 (epel)
           Requires: xorg-x11-server-Xorg(x86-64) = 1.20.4
           Installed: xorg-x11-server-Xorg-1.20.1-5.6.el7_6.x86_64 (@updates)
               xorg-x11-server-Xorg(x86-64) = 1.20.1-5.6.el7_6
           Available: xorg-x11-server-Xorg-1.20.1-3.el7.x86_64 (base)
               xorg-x11-server-Xorg(x86-64) = 1.20.1-3.el7
           Available: xorg-x11-server-Xorg-1.20.1-5.el7.x86_64 (updates)
               xorg-x11-server-Xorg(x86-64) = 1.20.1-5.el7
           Available: xorg-x11-server-Xorg-1.20.1-5.1.el7.x86_64 (updates)
               xorg-x11-server-Xorg(x86-64) = 1.20.1-5.1.el7
           Available: xorg-x11-server-Xorg-1.20.1-5.2.el7_6.x86_64 (updates)
               xorg-x11-server-Xorg(x86-64) = 1.20.1-5.2.el7_6
           Available: xorg-x11-server-Xorg-1.20.1-5.3.el7_6.x86_64 (updates)
               xorg-x11-server-Xorg(x86-64) = 1.20.1-5.3.el7_6
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest


解決方式,參考 How to interpret this yum dependency error? 的討論

Having the same issue, I installed manually archived xorgxrdp yum -y install https://archive.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/x/xorgxrdp-0.2.9-1.el7.x86_64.rpm then yum -y install xrdpand it works – zigarn 15 hours ago

$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)


在執行 yum update 中,查看
$ yum list | grep -i xorgxrdp
xorgxrdp.x86_64                         0.2.9-1.el7                    @/xorgxrdp-0.2.9-1.el7.x86_64
xorgxrdp.x86_64                         0.2.11-1.el7                   epel 

update 之後
$ yum list | grep -i xorgxrdp
xorgxrdp.x86_64                          0.2.11-1.el7                    @epel 
[agee@localhost ~]$

$ cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)





網誌存檔