Category: Proxmox

  • Proxmox Host backup

    Backup the following folders/files:

    /var/lib/pve-cluster/config.db
    /etc/corosync/*
    /etc/network/interfaces
    /etc/hostname
    /etc/hosts

  • Proxmox backup already exists

    When you run into this error:

    “TASK ERROR: zfs error: cannot create ‘rpool/vm-302-state-update’: dataset already exists”

    Try this solution:

    zfs destroy rpool/vm-302-state-update
    
  • Proxmox ZFS replace drive

    1: have a look what is there:

    ls -alh /dev/disk/by-id/
    zpool status
    zpool list -v

    2: set the hard drive you want to change offline:

    zpool offline "POOLNAME"  "HARD-DRIVE-ID or the whole path"
    ## example:
    zpool offline rpool wwn-0x50014ee25ba1a5e4

    3: change the hard drives physically
    shutdown and replace the disk (no hot-swap)

    4: create an empty GPT Partition Table on the new hdd with parted:

    parted /dev/new-disk
    (parted)# print
    (parted)# mklabel GPT
    (parted)# Yes
    (parted)# q

    5: replace them in the ZFS Pool:

    zpool replace "POOLNAME" "HARD-DRIVE-ID or the whole path old hard drive"  "HARD-DRIVE-ID or the whole path NEW hard drive"
    ## example:
    zpool replace rpool wwn-0x50014ee25ba1a5e4 wwn-0x5000cca27edf438f

    6: have a look what’s going on:

    zpool status
    ....
    resilver in progress since Sat Feb 29 11:43:52 2020
    328G scanned at 3,77G/s, 75,5G issued at 888M/s, 328G total
      8,83G resilvered, 23,01% done, 0 days 00:04:51 to go
    ....
  • Remove Proxmox 6.x/5.1+ Subscription Notice

    (source: https://johnscs.com/remove-proxmox51-subscription-notice/)

    With the release of Proxmox 5.1 and newer (including 6.2) you’ll find the code related to the no subscription message that pops up on login has changed and prior instructions for removing it wont work.

    To remove “You do not have a valid subscription for this server” run the command bellow. You will need to SSH to your Proxmox machine or use the node console through the PVE web interface.

    If you update your Proxmox server and the update includes a new version of the file we are about to edit then you’ll need to run the command again.

    Run the following one line command and then clear your browser cache (depending on the browser you may need to open a new tab or restart the browser):

    sed -i.bak "s/data.status !== 'Active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && systemctl restart pveproxy.service

    Here are alternative step by step instructions so you can understand what the above command is doing:

    1. Change to working directory
      cd /usr/share/javascript/proxmox-widget-toolkit
    2. Make backup of file
      cp proxmoxlib.js proxmoxlib.js.bak
    3. Edit the file
      nano proxmoxlib.js
    4. Locate this line of code inside the file (use ctrl+w in nano)
      if (data.status !== 'Active') {
    5. Replace it with this
      if (false) {
    6. Restart the Proxmox service (also be sure to clear your browser cache, depending on the browser you may need to open a new tab or restart the browser)
      systemctl restart pveproxy.service
  • Xpenology Proxmox e1000e driver

    To get the e1000e driver working, do the following steps:

    Make backup

    cp /usr/share/pve-manager/js/pvemanagerlib.js /usr/share/pve-manager/js/pvemanagerlib.js.dist
    
    # add e1000e
    sed -i 's/|e1000|/|e1000|e1000e|/' /usr/share/pve-manager/js/pvemanagerlib.js
    sed -i "/\['e1000', 'Intel E1000'\],/a \      ['e1000e', 'Intel e1000e']," /usr/share/pve-manager/js/pvemanagerlib.js
    
    # backup updated script
    
    cp /usr/share/pve-manager/js/pvemanagerlib.js /usr/share/pve-manager/js/pvemanagerlib.js.e1000e
    
    # make backup
    
    cp /usr/share/perl5/PVE/QemuServer.pm /usr/share/perl5/PVE/QemuServer.pm.dist
    # add e1000e
    
    sed -i "s/'e1000',  'pcnet'/'e1000', 'e1000e', 'pcnet'/" /usr/share/perl5/PVE/QemuServer.pm
    
    # backup updated script
    
    cp /usr/share/perl5/PVE/QemuServer.pm /usr/share/perl5/PVE/QemuServer.pm.e1000e
    
    
    
    Make changes take effect
    service pveproxy restart
    service pvedaemon restart
    
  • Proxmox gui not responding

    Proxmox gui not responding

    It could happen that the Proxmox GUI is not responding to http request.
    One reason could be that the webdaemon is not running or has crashed.

    Try restart of the service:

    service pveproxy restart
    
  • Proxmox – Add external usb drive to LXC container

    Proxmox – Add external usb drive to LXC container

    How to mount an external USB(3) drive to a LXC container

    In this example we make use of a Western Digital 1TB external USB3 drive.
    This device is NTFS formatted, which is easy to handle in Windows.

    Our container is used for samba services and has ID 102.

    At the host system (Proxmox)

    – Check which device the drive has been given on the host.
    lsblk (in this case ‘sdg’, partition ‘sdg1’)

    – Add a mounting location
    mkdir /mnt/ext-usb

    – Install the ntfs-3g package
    apt-get update && apt-get install ntfs-3g

    – Mount the disk to the mountlocation
    mount -t ntfs-3g /dev/sdg1 /mnt/ext-usb

    AT LXC client (container)

    – Add a mount location inside the LXC container
    mkdir /mnt/ext-usb

    At the host

    – Mount the drive to the container in this example we use mp1 (check if mp1 is not allready used!)
    pct set 102 -mp1 /mnt/ext-usb,mp=/mnt/ext-usb

  • Proxmox – add SSD cache

    Proxmox – add SSD cache

    To increase the speed of your ZFS pool, you can add a SSD cache for faster access, write- and read speeds.
    You have to make 2 partitions, one for cache and another for log.

    format ssd into 2 logical partitions, type 48.
    For example both partitions, half the size of the SSD.
    fdisk /dev/sdf

    Show status of the zpool
    zpool status

    Add partition sdf1 as cache
    zpool add rpool cache /dev/sdf1

    Add partition sdf2 as log
    zpool add rpool log /dev/sdf2

    Check your modified pool
    zpool status

  • Configure proxmox email notification

    Configure proxmox email notification

    Follow the steps below to configure the Proxmox email notification.

    1. Install the authentication library:
      apt-get install libsasl2-modules
    2. If Gmail has 2FA enabled, go to App Passwords and generate a new password just for Proxmox
    3. Create a password file:
      nano /etc/postfix/sasl_passwd
    4. Insert your login details:
      smtp.gmail.com youremail@gmail.com:yourpassword
    5. Save the password file
    6. Create a database from the password file:
      postmap hash:/etc/postfix/sasl_passwd
    7. Protect the text password file:
      chmod 600 /etc/postfix/sasl_passwd
    8. Edit the postfix configuration file:
      nano /etc/postfix/main.cf
    9. Add/change the following (certificates can be found in /etc/ssl/certs/):
      relayhost = smtp.gmail.com:587
      smtp_use_tls = yes
      smtp_sasl_auth_enable = yes
      smtp_sasl_security_options =
      smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
      smtp_tls_CAfile = /etc/ssl/certs/Entrust_Root_Certification_Authority.pem
      smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_tls_session_cache
      smtp_tls_session_cache_timeout = 3600s
      
    10. Reload the updated configuration:postfix reload

    Testing

    echo "test message" | mail -s "test subject" youremail@gmail.com

  • Proxmox – Change VM ID

    Change VMID from 100 to 302

    Stop/Shutdown a VM.

      1. Login using SSH to Proxmox Machine or using Shell menu in Web Interface.
      2. Rename image directory name and image filename.
        root@PROXMOX01:/# cd /dev/pve
        root@PROXMOX01:/dev/pve# ls
        root swap vm-100-disk-1
        root@PROXMOX01:/dev/pve# mv vm-100-disk-1 vm-302-disk-1
        root@PROXMOX01:/dev/pve# ls
        vm-302-disk-1.qcow2

    (more…)