Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, September 29, 2021

Fixing Ubuntu with kernel 5.11

I previously mentioned the kernel 5.11 image was completely unusable. Well, these 2 were definitely missing and I need to install manually:
sudo apt-get install linux-headers-5.11.0-36-generic
sudo apt-get install linux-modules-extra-5.11.0-36-generic
The above took care of the networking unavailable issue for me. 

Now to get the display working with proper resolutions (no 640x480 please!)
sudo apt purge nvidia* libnvidia*
This removed my previously manually installed Nvidia display driver and after reboot it shows clearly it uses the X.Org open source driver instead of "Continue using a manually uninstalled driver" 


I hope this becomes stable for another few months. Keeping my fingers crossed.

Credits go to: Nvidia's official website (the post for fixing nvidia-smi >> Failed to initialize NVML: Driver/library version mismatch) 
This seems useful for installing Nvidia driver but I did not need to follow it. 

Ubuntu and GRUB default image

My Manjaro experiment has kinda failed because it would hang from time to time. Well, with Linux you always have workarounds, in this case, use the most "mainstream" distro: Ubuntu. I actually use a less resource intensive variant of Ubuntu called Ubuntu Mate. However, one of the updates must have broken compatibility with some existing drivers (e.g. NVIDIA Driver Version: 390.138) and I ended up always going back to the oldest kernel image which I choose manually from the Boot menu of GRUB. This is the guide to change the default so no more manual intervention is needed! (BTW, I was so worried that the Wifi driver is broken for some reason even in that image. It turns out the Wifi-disabled issue went away after hitting the "hardware" Wifi button on my machine a few times. Whew!)

Monday, September 28, 2020

One Note Samba

If you came here for the song, please go to YouTube.  This is my one note for fixing my SAMBA-related issue on my Manjaro box. Basically gio mount gave me the following error:

Failed to mount Windows share: Software caused connection abort

Fortunately I found this post, in my case, I created a new smb.conf file as root and added the global protocol line to it. 

Thursday, September 24, 2020

Manjaro

三個月前的今天剛裝了Elementary OS,可是陳年60GB HD那個partition已極速爆滿,是時候換新SSD,今次買的240GB比當年那個60GB還要便宜!

 因為新鮮感已失,加上日本語輸入法使用甚不方便,所以打算「從新出發」,在新SSD上裝一個未用過的Linux Distro, 讀了好幾篇關於Linux Distro的文章,決定先試以前曾有不俗經驗的Arch Linux, 見有一個甚獲好評名為EndeavourOS的新Arch Linux-based Distro, 於是下載了ISO, 用dd抄了去USB手指,boot時到BIOS指定用USB即成,在Live env試了一會就裝,由於HD是全新,所以安裝沒有甚麼特別選擇,完成後reboot,循例update了所有packages, 然後再reboot就只有白紅藍全營幕輪流出現!再重裝一次又是如此。 

為確定不是HD問題,於是用dd把舊HD複製到新HD,保留了原本所有boot records/partitions/OS, 可進入原來的Elementary OS了,再下一步是玩玩GParted: 複製後新HD有180GB左右的Unallocated space, 有甚麼方法加到Elementary OS那個爆滿的Partition呢?首先,我消滅了兩者之間的小小swap partition,原來還要把這個Unallocated space「撥入」Elementary OS那個Partition的parent才可以resize, reboot時GRUB就找不到Boot record了,看了此文,估計名字變動了,即管試試set prefix,果然全中!於是update-grub and grub-install. 有了可用的installation,又再心癢試新事物,今次是另一個Arch Linux based Distro: Manjaro, 難題是要和Elementary OS的Partition共存,所以徵用那個已廢的Ubuntu partition,不過Installer認為無free space而安裝失敗,於是我再用GParted把那個partition recreated, 今次Manjaro installer沒問題了。 

裝好Manjaro之後,為證明比Elementary OS優勝,「試題」是再裝倉頡日本語一較高下。「解題」用了四個小時,不過「答案」的確更好。閒話少講,關鍵是跟此君要用pamac安裝ibus, ibus-table-chinese, ibus-mozc(這個需要在機上build, 失敗了三次才成功,浪費了不少時間)然後setup IBUS加Japanese-MOZC, Chinese-Cangjie3 最後一步是找個file to force autostart, 又找了好一會,答案是:

cat .xprofile 
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

ibus-daemon -drx

各位網友晚安! 

後記:分享一個師兄教路在Xfce "Dock"加App的方法(其實是他舉出Xfce如何難用的例子)

Thursday, September 10, 2020

PDF to Image solution

I wrote about using Mac OS X Automator for converting a PDF to images. How about Linux? I found this solution: At command line,  execute 

pdftoppm -jpeg <pdf file name> <prefix of jpg files to be created>

It might be already installed in your Linux box. If not, it is part of poppler-util. 

Wednesday, June 24, 2020

Elementary OS Cangjie input

作為電腦玩家,最興奮的事莫過於有新電腦用;不過換腦是數年一度的「盛事」,退而求其次就是拿舊電腦翻新。幾天前電腦界師兄推薦Elementary OS, 我的實驗用Linux box又剛好boot不起,正是裝新OS的好機會了。

玩了一會才有需要打中文,記得使用Ubuntu的話,這只是在System settings(-> Language -> Input Method加倉頡**)就可以攪定的簡單動作,不過在Elementary OS就試了大半小時也無功而還!結果找到這篇教裝FCITX的帖文 。不同的是我要裝倉頡Version 3:
sudo apt install fcitx-table-cangjie3 im-config

Reboot後還有一步(參考此帖文):
fcitx-configtool 
在此工具內加入Cangjie3,之後Ctrl-Space即可toggle英文和倉頡。(用慣Mac OS X的CapsLock作toggle會很不慣,但也沒辦法了,留意CapsLock時即使已選倉頡也打不到中文的)

註**:
以上方法是使用FCITX,另一個「老字號」系統是IBus,其實只改System settings的話,只差這一步就能用IBus的倉頡:
im-config
由default改為IBus



Saturday, September 12, 2015

Back to Ubuntu 14.04

I have been experimenting with different OS on this old Toshiba Core i5 15" laptop since its HD with the original Win7 image became unstable last year. I started with Ubuntu 14.04 (installed via a bootable USB flash drive) Then moved on to Ubuntu Kylin 14.10, which targets Chinese but has quite a bit of errors/crashes for some unknown reasons (the pop-up dialog became annoying!) The Chinese functionality doesn't seem too useful anyway. So I decided to wipe it clean. Ubuntu offers 14.04.3 LTS (The Long Term Support version comes with five years of security and maintenance updates, guaranteed) It's basically usable out-of-the-box but of course I need to install Flash separately: WatchESPN links to Adobe which links to Ubuntu Software Center which cannot find the plugin. Command line is still the way to do (follow these steps)

Monday, November 10, 2014

Linux Desktop

To be honest, I never have much opinion on such a controversial topic among Linux users (it's kinda like emacs vs vi) I basically use whatever come with default install like your typical dumb user. I have no problem with GNOME or KDE. And if I have to pick one, I picked JWM. I have no idea what desktop I got when I installed Ubuntu 14.04. It turned out to be yet another controversial desktop called Unity, which I saw a lot of negative comments. What is so great about the open source community is that people are actually passionate about the technology. This guy wrote a looooong post to compare GNOME, KDE and Unity!

Saturday, November 01, 2014

Resuming Ubuntu from sleep makes thick black borders around windows to appear

This is an annoying bug of Ubuntu 14.04 but I found the workaround here:
1. Press the "Ctrl+Alt+F2" key combination (Warning: you will be sent to a text console where you won't be able to read this).
2. Press "Ctrl+Alt+F7".

Tuesday, October 28, 2014

Ubuntu was borned 10 years ago today

Can't believe I wrote two posts about tech "birthdays" in this month! Let's face it: you lose "street cred" when admitting running Ubuntu instead of the more "hardcore" distro of Linux (like Arch?) but I really enjoy using it for "desktop activities" (i.e., playing back music/video, surfing web) rather than the "server stuff" (like serving up files or pages) I definitely feel the improvement during these 10 years: it became more and more usable "out-of-the-box" (i.e., right after installation) Less tweaking or installing additional drivers were needed to make things work.

Thursday, October 23, 2014

Video editing software

I have always enjoyed editing home/music video. Back in the early 00's, I actually bought Adobe Premiere for such purpose. Of course, newer versions of Windows come with Windows Movie Maker free and I stopped using my purchased copy of Premiere. So, what's the alternative to Windows Movie Maker on Linux? There are at least five.

Tuesday, October 07, 2014

Tech from the olden days

I am cleaning up some really old posts that I wrote way back yet still in draft status. The title used the term my daughter likes to play with: olden days (which apparently many others found interesting too. In fact, it has a long history according to this.)  All those posts are consolidated here.

1) Workaround was needed for sharing files from Win2K to Win7 Home Premium Edition (dated 2009.) Those were the days I still used a Win2K laptop as our home NAS. It required a registry change.

2) Guest Additions (dated 2010) was for VirtualBox. I needed it back then for sharing files between my VM and the host (and I still need it now!)

3) Dell DJ 20 Gen 2 was my latest toy in 2010 (and I still listen to it almost every night!) When it was newly released in 2004, it cost >$100 and I bought it for $40.

Its drivers were still available for download from Dell in 2010 (not sure if the link works now.) It is not a plug-and-play device on Win7 and the Windows driver needed to be installed for it to be recognized. The WinXP driver actually works on Win7 too. Also, to use subscription service like Rhapsody, one needed to upgrade the player with a PlaysForSure compatible firmware (the last one on the page) Unfortunately that .exe only works on WinXP so you need to somehow find one. And when I ran it, it stuck on "Restarting player" even though the player was restarted (and upgraded) Fortunately it didn't matter. I just close the installer and it didn't cause any problem. Once the player has been upgraded, you could still transfer subscription tunes using a Win7 computer.

Fast forward to 2014: I could use my Dell DJ 20 on my Win8 PC in plug-and-play fashion. I couldn't get it to work with the Rhapsody client though. Rhapsody no longer officially supported it (no more PlaysForSure?) Today it plays non-DRMed files for me only.

4) CopyTrans is a free tool for copying songs to iDevice without iTunes

5) 2009 was the 50th anniversary of COBOL. It was obviously an important milestone but it's also one of the few major computer programming languages that I knew little about.

6) Shozu was an iPhone App I experimented with (and wanted to recommend) for posting to Blogger. I don't think I used it that much after I drafted that post in 2008 with it though :P

Fast forward to 2014: the official Blogger app on iOS is free yet still not very good. I'm writing this on a PC instead.

7) I wanted to raise awareness of radiation level in Hong Kong back in March 2012. Excerpt from the CNN article:
When Pieter Franken visited Hong Kong one of the first things he did was measure the level of radiation in his hotel room. "The whole idea is to measure everything (rather than only performing spot checks)," said Franken. Hong Kong lies just 50 kilometers from a nuclear power station located in Daya Bay in Guangdong province, but its 12 permanent radiation monitoring stations are not in heavily populated urban areas. On a six-hour drive around the city's major commercial and residential, Franken mapped radiation levels with a portable monitoring kit devised by Safecast. All the data is publicly viewable as interactive heat maps on Safecast's website. The drive revealed that Hong Kong had a constant level of radiation that hovered around 0.2 microsievert per hour for an annualized dose of 2 millisieverts. This was slightly higher than the 0.1 microsievert per hour that Safecast mapped in the major urban centres of Tokyo and Beijing. One millisievert per year is an internationally-recognized nuclear factory guideline for exposure to radiation by the general public, according to Dr. John Leung, radiation expert and physics professor at the University of Hong Kong. "Your risk of having cancer is increased for 4 to 5% per sievert of radiation your body absorbs," explained Leung. "The way to control it is to receive as little as possible." On his drive around Hong Kong Franken wanted to see how localized the radiation was, "but it seems to be all over," he said. Franken believed that the common denominator throughout the city, concrete, was a key source of the radiation. Or more specifically, the locally-sourced granite aggregates used in place of pricier cement to make the concrete. "Hong Kong is lying on a high-background radiation level because the radionuclide content in the granite in this region of the country is a bit higher than the world average," said Leung. "There is more uranium and thorium in our granite. It's natural." A study conducted by Leung and his colleagues in 1990 found that the gamma radiation dose rate of local soil to be 1.8 times the world average. Hong Kong's concrete infrastructure poses no immediate harm to residents' health, but some wonder if more attention should be given to how buildings are made in the city. "When we make concrete, we don't pay attention to the mineral content of the rock, so long as it is strong enough," said University of Hong Kong structural engineering professor, Albert Kwan. "If it's really is the case (that local granite has elevated radioactivity), perhaps we should import our granite from elsewhere." The everyday doses of radiation we encounter are far from being fatal in one shot, but it is the accumulated exposure that may be cause for concern. To reduce everyday levels of radiation Safecast suggests opening doors and windows to ventilate rooms. This minimizes the accumulation of radon - a radioactive gas produced by the decay of naturally occurring uranium and thorium. Inhaling radon - one of the leading sources of human exposure to natural radiation - in the home and workplace causes tens of thousands of deaths from lung cancer annually, according to the World Health Organization.

8) I was experimenting with booting to a Live version of Arch Linux on a USB drive on my personal laptops in 2009. larch was the next thing to try after my FaunOS experiment.

I basically followed the instructions and also did the followings:
I) make a copy of an existing profile. I copied xmini to a new one named "my"
II) I changed the addedpacks by
- remove all xfce* lines and added one line with jwm (pacman cannot find those xfce related packages and I prefer jwm anyway)
- remove aufs (otherwise I got error about dependency on pre-2.26.29 kernel. It has actually become part of the new kernel anyway. However, the included one is aufs2 and it doesn't support "Merging overlays" when you save sessions from running the resulting image of larch.)
III) create a directory for building the image. Make sure it is on a filesystem with lots of free space!
IV) the command should be./mklarch -ug -p ./larch/profile/my [dir created in 3]

Fast forward to 2014: I tried something similar again: Live Ubuntu on USB on my Intel Core i5 laptop. The performance was horrific. Slow to boot and slow after boot (probably worse than the 2009 experiment!) I ended up buying a $50 60 Gb SSD (el cheapo and SSD didn't appear in the same sentence back in 2009) and installed Ubuntu 14.04 properly on it. I like this setup. It didn't require much tweaking at all and most things work out of the box (except this)   

Saturday, August 30, 2014

Ubuntu 14.04 System freezes on wakeup from suspended state

After using Ubuntu on my Toshiba Satellite notebook for 2 days, the most annoying issue that prevented me from keep using it is actually an oven-overlooked feature: suspend. The title of this post said it all (in fact, you could google it and find a post on AskUbuntu) That's how I found out it has to do with the Nvidia (display) driver. However, I didn't follow the suggestions there (there's a link to a post in which a reply listed a multi-steps complicated solution) to make Ubuntu using the Nvidia proprietary driver) Instead I use the Ubuntu built-in "Additional Driver" utility. Switched from the open source driver to the proprietary one (the first choice, see image):
After making this change and reboot, I am able to suspend and wakeup :)

Friday, January 28, 2011

Tech of the day: Debian static IP

My Dockstar has been getting its IP via DHCP. And I want to assign it a permanent IP address so I followed this guide. Basically commented out the line for dhcp in /etc/network/interface and add static IP like:
iface eth0 inet static
[tab]address 192.168.1.200
[tab]network 192.168.1.0
[tab]netmask 255.255.255.0
[tab]broadcast 192.168.1.255
[tab]gateway 192.168.1.1
[tab]dns-nameservers 192.168.1.1

Then I restarted networking:
/etc/init.d/networking restart

Wednesday, December 08, 2010

Tech of the day: Dockstar as print server

It seems that one major use of embedded device/plug computer is print server. Setting up printers on Linux was not known for being a user-friendly process though. It has changed a lot thanks to CUPS. (I wrote about it before for my Arch Linux install)

For Debian, I found its Wiki entry very useful. What I did was very similar:
1) apt-get install cups cups-client hplip
I used hplip because I have a HP PhotoSmart printer.

2) I edited cupsd.conf as suggested.
So I was able to administer CUPS on port 49631 from other PCs (which is necessary 'coz I am not running X on my Dockstar!)
Then I added my HP printer as a local printer by picking one of the choice listed: HP photosmart 7350 USB MY25S3308N3Y HPLIP (HP photosmart 7350)
However, I was not able to add the printer on my Windows 7 PC using HTTP URL.

To do that, I followed the steps from CUPS Mini-HOWTO at LinuxFoundation and edited /etc/samba/smb.conf.

Finally my Win7 box was able to see the printer on Dockstar automatically when I chose to add a network printer. The only remaining step is to manually pick the driver in the Generic section labeled MS Publisher Color Printer as suggested by the aforementiond Debian Wiki.

I found lots of info from other links like 1 and 2 but these are kinda outdated.

BTW, my root partition became full quickly halfway through installing CUPS and became unusable. My fix was to move /var and /usr out of it (by following the instructions found here):
1) use fdisk to create a new partition. Don't forget to format with mke2fs or it won't mount.

2) mount the new filesystem in /mnt
# mkdir /mnt/new
# mount /dev/hda3 /mnt/new

3) tar up /var/*

4) untar in /mnt/new

5) Rename the /var directory (to make sure this has worked before deleting it!)
# cd /
# mv var var.old

6) Make new var directory
# mkdir var

7) Unmount the new partition
# umount /dev/hda3

8) Remount it as /var
# mount /dev/hda3 /var

9) Edit /etc/fstab to include the new partition, with /var given as the mount point

I also did something similar for /usr. Instead of a primary partition, I created an extended partition (sda4) and then a logical partition out of it (sda5, which is the one to be formatted and mounted) (or I would have used up the maximum of 4 primary partition and won't be able to create any other partition in the future)

Saturday, December 04, 2010

Tech of the day: Dockstar w/ Debian file sharing

Before we could share anything, we need to mount the drive(s) first!

I have some NTFS as well as FAT32 formatted drives in USB Enclosures. To mount them, first find out the "name" (sdb1 or sdc5) of your attached drives by:
fdisk -l

For NTFS, I installed NTFS-3G:
apt-get install ntfs-3g

Then mount as:
mount -t ntfs-3g /dev/sdb1 [dir name]

For FAT32, simply mount as:
mount -t vfat /dev/sdc1 [dir name]

Next, install and configure samba following these steps. Basically we need to add a user to the server (useradd) and add a SMB password for this user (smbpasswd -a) Then edit the followings accordingly:
/etc/samba/smb.conf
/etc/samba/smbusers

[Update] After the above steps, I was unable to move/add/delete any file on the USB drive if I'm not logon as root to Dockstar, which isn't very useful. I google quite a bit and got many suggestions:
- chmod 777 [the mount point]
- add writeable = yes to smb.conf
- add the mount point to fstab with umask=000 in the 4th column
Well, I did all 3 and it works for me now (not sure which one is the key though)

Friday, December 03, 2010

Tech of the day: Debian on Dockstar

I bought a Seagate Dockstar (for fear of it being discontinued soon! Amazon is pushing its newer replacement) last week. I have no intention to use the remote file sharing service PogoPlug (requires payment after the 1st year) And Dockstar cannot be used without PogoPlug unless you modify the firmware. I might as well run Debian (or OpenWRT) on it. Here are my steps:
0) Connect it to a PC running Linux (e.g. booted from a Live Ubuntu CD) with an Ethernet cable. Turn off internet on the PC.

1) Find out its IP by following Alexander Holler's instructions.

2) Plug in a flash drive and mount it
mount /dev/sda1 /mnt

3) Backup the stock image to /mnt
Using the instructions from the same link as (1)

4) Disable PogoPlug's daemon so that it won't attempt to phone home
killall hbwd
killall hbplug
mount -o remount,rw /
vi /etc/init.d/rcS
press "i" (to get into insert mode)
change the line "/etc/init.d/hbmgr.sh start" to "#/etc/init.d/hbmgr.sh start"
[esc] and ":wq" (write & quit)

After shutting the Dockstar down, it would be a good time to copy the backup images by unplugging the flash drive and plug to the PC.

5) Now the Dockstar is ready to be connected to the internet (by plugging the Ethernet cable to the router)

6) Follow Jeff Doozan's guide to install Debian (on a flash drive)
In case you couldn't find fdisk, it is under /sbin. Delete any existing partition. Hit 'n' to add the first Linux partition as primary partition 1. Accept the default first cylinder and +512M for the last cylinder.
Make it bootable.
Hit 'n' again to add the 2nd partition as primary partition 2. Also accept the default first cylinder but +256M for the last cylinder.
Hit 't' to change the system type of the 2nd partition. The Hex code is 82 (for Linux Swap)
Finally hit 'w' to write the partition to the drive (and wipe out everything you had originally!)
Now the drive is ready for Debian installation (just follow the rest of Jeff's steps)

Next I'll configure it for Samba and file sharing.

Tuesday, November 24, 2009

Tech of the day: First day with Toshiba Satellite P505

My goal is to dual boot this desktop-replacement notebook with Windows 7 and Arch Linux. It actually comes with Windows Vista Home Premium (M$/Toshiba offers free upgrade to Win 7 but for some reason Toshiba's registration system is down so I'll try again later) According to instruction I googled, Vista provides a "Shrink" feature in its Disk Management but some reported it didn't work for them. I tried it and it shrunked my Vista partition from 360Gb to 180Gb, which leaves ~180Gb for Linux. I was so glad it worked out (but my euphoria was premature) Next I used Toshiba's recovery disc creator to create the recovery disc immediately (it is very possible that a simple mistake could render everything unusable) Finally, I put my Arch Linux (64 bit) installation CD in and rebooted. The first thing went wrong was that the installation requires network (I opted for the CD that does NOT include everything) Second, Arch's installer used cfdisk and it complained about "bad primary partition 2 partition ends in the final partial cylinder" And nobody has offered any good solution except for wiping the HDD!

So there we went. I rebooted with my newly created recovery DVD. I chose the option "Erase the hard disk" which led to 2 choices "delete all data and partitions from the hard disk" or "delete all partitions and overwrite all sectors on the hard disk" The latter is supposed to take a long time so I picked the former. Well, it takes a long time too (2 hr 15 mins) And it doesn't seem to be absolutely necessary from reinstalling Vista! Anyway, I picked the option that allowed me to pick the size of my partition (and I chose not to create an extra partition for System Recovery, i.e., will rely on my DVDs from now on) After it slowly created the partitions, I was prompted to insert the 3 DVDs one after another, for it to slowly copy all the files back. That took another hour. Finally it rebooted with Vista! And as usual, Vista needs to slowly set itself up. Just when I thought it's done, another Toshiba program took over for "configuring system" then reboot. This cycle has repeated so many times that it seems never ending. I think what it actually did was re-installing all those Toshiba's drivers (noticed the screen went from lo-res to hi-res) Anyway, another hour of my life was wasted on this. I knew it's done when Vista asked me to create a new user account.

Now it's ready for another attempt to install Arch, using the "core" CD which does not rely on FTP to complete the install. And this time the installer (or cfdisk) didn't complain about the partitions and the installation went all the way 'til completion. Happy ending? Well, far from it. For one thing, networking required setup. I was smart enough to start with wired networking. Even that didn't work out of the box and after lots of googling (the Wiki suggests to use hwdetect, which wasn't installed and without access to the net I have no way to install it! The Wiki also suggested dhclient instead of dhcpcd. Again, no internet no installation!)

So it's time to try a different distro. Before that, I preferred to clean out Arch first by blowing away the 2 partitions (root and swap) on my HDD, and took out GRUB from the MBR. The latter was actually trickier that I thought on Vista: I had to reboot with my Toshiba Recovery DVD and choose Recovery Console from one of the Recovery Options. Once in the console, execute: bootrec.exe /FixMbr

Next, I reluctantly went with the popular and familiar, Ubuntu. (I think Canonical drops support on releases way too soon so users need to keep updating in order not to left behind. On the other hand, users who update too soon could run into their own problems, see below) Ubuntu 9.10 was right out of Canonical's "door!" Again, installation went well, as it has always been. And again, trouble started when I tried to get network working! To troubleshoot, I enlisted the help of Arch's Wiki (yeah, the same steps work for both Arch and Ubuntu) and found that my Ethernet adapter uses the module atl1c. Looked for this in dmesg and I saw a bunch of errors related to ACPI (also caused Wireless adapter to fail) So, the workaround is to disable ACPI (here is how) Or try compiling the newer kernel. After 12 hours of tinkering with it, enough is enough and I called it a night.